From ae822c7a4dc908fe483d622ff4b391719b447703 Mon Sep 17 00:00:00 2001 From: rnet Date: Thu, 4 Apr 2024 00:48:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.=20exec=E5=91=BD=E4=BB=A4=E9=80=82?= =?UTF-8?q?=E9=85=8D=E7=89=88=E6=9C=AC=EF=BC=9B2.=20=E6=96=B0=E7=89=88cook?= =?UTF-8?q?ie=E4=BD=8D=E6=95=B0=E9=80=BB=E8=BE=91=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=88=E6=97=A0=E6=B3=95=E8=BF=87=E6=A3=80=E6=B5=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 3 +- package.json | 1 - src/config/codemap_v2.json | 2 +- src/handler/Cookie.js | 156 +++++++++++-------- src/handler/parser/common/dynamicExec.js | 72 --------- src/handler/parser/common/index.js | 1 - src/handler/parser/common/modeEncrypt.js | 4 +- src/handler/parser/common/numarrAddTime.js | 4 +- src/handler/parser/common/random.js | 4 +- src/handler/parser/common/runTask.js | 165 ++++++++++++++++----- src/handler/parser/r2mka.js | 7 +- src/handler/parser/task/index.js | 25 +++- src/handler/viewer/dkeys.js | 14 ++ src/handler/viewer/index.js | 3 + src/makeCodeHigh.js | 11 +- utils/getCode.js | 42 +++++- utils/initGv.js | 7 +- utils/request.js | 8 + 18 files changed, 332 insertions(+), 197 deletions(-) delete mode 100644 src/handler/parser/common/dynamicExec.js create mode 100644 src/handler/viewer/dkeys.js create mode 100644 src/handler/viewer/index.js create mode 100644 utils/request.js diff --git a/main.js b/main.js index 0d6e1d3..98cfa8a 100755 --- a/main.js +++ b/main.js @@ -120,7 +120,7 @@ module.exports = yargs coerce: (input) => { if (['1', '2'].includes(input)) { gv._setAttr('version', Number(input)); - return paths.exampleResolve('codes', `${input}-\$_ts-full.json`); + return paths.exampleResolve('codes', `${input}-\$_ts.json`); } return input; } @@ -131,6 +131,7 @@ module.exports = yargs Math.random = () => 0.1253744220839037; const gv = require('@utils/initGv')(argv.file); Object.assign(global, gv.utils); + Object.assign(global, require('@src/handler/viewer/')); const output = JSON.stringify(eval(argv.code)); console.log([`\n 输入:${argv.code}`, `输出:${output}\n`].join('\n ')); } diff --git a/package.json b/package.json index 0c24453..f70715e 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "README.md", "utils", "main.js", - "test", "src", "example" ], diff --git a/src/config/codemap_v2.json b/src/config/codemap_v2.json index f628474..efefbf5 100644 --- a/src/config/codemap_v2.json +++ b/src/config/codemap_v2.json @@ -1 +1 @@ -{"0":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] != _$cG; _$$o[_$fF++] = _$cG","1":"_$fF--; _$cG = _$fF; _$iZ(); _$cG = _$j3[_$h8](_$$o[_$cG])","2":"_$b$ = _$el[++_$$w]; _$_S = _$$o.slice(_$fF - _$b$, _$fF); _$fF -= _$b$; _$iZ(); _$$o[_$fF++] = _$$F(_$j3[_$h8], _$_S)","3":"_$cG = _$$o[--_$fF]; _$iZ(); _$cG = _$j3[_$h8] |= _$cG","4":"_$cG = _$j3[_$h8]++","5":"_$fF -= 2; _$cG = _$fF; _$iZ(); _$$o[_$fF++] = _$j3[_$h8](_$$o[_$cG], _$$o[_$cG + 1])","6":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] - _$cG; _$$o[_$fF++] = _$cG","7":"_$ji = _$el[++_$$w]; _$$o[_$fF++] = _$jH[_$ji][_$el[++_$$w]]","8":"_$cG = _$$o[--_$fF]; _$bb[4] = 1; _$bb[5] = _$cG; _$$w = _$dp","9":"_$$o[_$fF++] = _$gk[_$el[++_$$w]]","10":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] > _$cG; _$$o[_$fF++] = _$cG","11":"_$b$ = _$el[++_$$w]; _$$w -= _$b$","12":"_$$e(_$jI, _$el[++_$$w], _$el[++_$$w], _$b$ = _$el[++_$$w], _$el[++_$$w], _$$w + 1, _$gk, _$bb); _$bb[4] ? _$$w = _$dp : _$$w += _$b$","13":"_$cG = _$$o[--_$fF]; _$j3 = _$$o[_$fF - 1]; _$j3[_$go[_$el[++_$$w]]] = _$cG","14":"_$cG = _$$o[--_$fF]; _$iZ(); _$j3[_$h8] = _$cG","15":"_$cG = _$$o[--_$fF]; _$j3 = _$$o[--_$fF]; _$$o[_$fF++] = _$j3[_$cG]","16":"_$$o[_$fF++] = _$jn[_$el[++_$$w]]","17":"_$fF -= 2; _$cG = _$fF; _$iZ(); _$j3 = _$j3[_$h8]; _$$o[_$fF++] = _$j3(_$$o[_$cG], _$$o[_$cG + 1])","18":"_$fF--; _$cG = _$fF; _$iZ(); _$$o[_$fF++] = _$j3[_$h8](_$$o[_$cG])","19":"_$$o[_$fF++] = _$cu[_$el[++_$$w]]","20":"_$el[_$$w] = 102; _$h8 = _$go[_$el[++_$$w]]; _$el[_$$w] = _$h8; _$cG = _$$o[--_$fF]; _$$o[_$fF++] = _$cG[_$h8]","21":"_$el[_$$w] = 23; _$h8 = _$el[++_$$w]; _$cG = _$fW[_$h8]; _$el[_$$w] = _$cG; _$$o[_$fF++] = _$cG","22":"_$fF -= 3; _$cG = _$fF; _$iZ(); _$j3 = _$j3[_$h8]; _$cG = _$j3(_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2])","23":"_$$o[_$fF++] = _$el[++_$$w]","24":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] + _$cG; _$$o[_$fF++] = _$cG","25":"_$iZ(); _$$o[_$fF++] = _$j3[_$h8]()","26":"_$fF -= 2; _$cG = _$fF; _$iZ(); _$cG = _$j3[_$h8](_$$o[_$cG], _$$o[_$cG + 1])","27":"_$el[_$$w] = 64; _$h8 = _$go[_$el[++_$$w]]; _$el[_$$w] = _$h8; _$j3 = _$$o[--_$fF]","28":"_$iZ(); _$j3 = _$j3[_$h8]; _$$o[_$fF++] = _$j3()","29":"_$fF--; _$cG = _$fF; _$iZ(); _$j3 = _$j3[_$h8]; _$cG = _$j3(_$$o[_$cG])","30":"_$cG = typeof _$$o[--_$fF]; _$$o[_$fF++] = _$cG","31":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] & _$cG; _$$o[_$fF++] = _$cG","32":"_$el[_$$w] = 64; _$h8 = _$fW[_$el[++_$$w]]; _$el[_$$w] = _$h8; _$j3 = _$$o[--_$fF]","33":"_$h8 = _$el[++_$$w]; _$j3 = _$jn","34":"_$$o[_$fF++] = _$jU[_$el[++_$$w]]","35":"_$cG = _$$o[--_$fF]; _$$o[_$fF++] = !_$cG","36":"_$cG = _$$o[--_$fF]; _$j3 = _$$o[_$fF - 1]; _$j3[_$fW[_$el[++_$$w]]] = _$cG","37":"_$fF--; _$cG = _$fF; _$iZ(); _$j3 = _$j3[_$h8]; _$$o[_$fF++] = _$j3(_$$o[_$cG])","38":"_$h8 = _$$o[--_$fF]; _$j3 = _$$o[--_$fF]","39":"_$b$ = _$el[++_$$w]; _$$w += _$b$","40":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] * _$cG; _$$o[_$fF++] = _$cG","41":"_$cG = _$$o[--_$fF]; _$b$ = _$el[++_$$w]; _$cG ? 0 : _$$w += _$b$","42":"_$bb[4] = 2; _$$w = _$dp","43":"_$h8 = _$el[++_$$w]; _$cG = _$$o[--_$fF]; !_$cG ? (_$$w += _$h8, ++_$fF) : 0","44":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] === _$cG; _$$o[_$fF++] = _$cG","45":"_$$o[_$fF++] = {}","46":"_$$o[_$fF++] = false","47":"_$ji = _$el[++_$$w]; _$h8 = _$el[++_$$w]; _$j3 = _$d5[_$ji]","48":"_$h8 = _$el[++_$$w]; _$j3 = _$jU","49":"_$fF -= 2; _$cG = _$fF; _$iZ(); _$j3 = _$j3[_$h8]; _$cG = _$j3(_$$o[_$cG], _$$o[_$cG + 1])","50":"_$el[_$$w] = 23; _$h8 = _$el[++_$$w]; _$cG = _$ke[_$h8]; _$el[_$$w] = _$cG; _$$o[_$fF++] = _$cG","51":"_$h8 = _$el[++_$$w]; _$j3 = _$gk","52":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] == _$cG; _$$o[_$fF++] = _$cG","53":"_$$o[_$fF++] = true","54":"_$iZ(); _$j3 = _$j3[_$h8]; _$cG = _$j3()","55":"_$h8 = _$el[++_$$w]; _$$o[_$fF++] = _$gI(_$jI._$gr[_$h8], _$bb)","56":"_$$o[_$fF++] = []","57":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] < _$cG; _$$o[_$fF++] = _$cG","58":"_$ji = _$el[++_$$w]; _$$o[_$fF++] = _$d5[_$ji][_$el[++_$$w]]","59":"_$cG = _$$o[--_$fF]; _$j3 = _$$o[_$fF - 1]; _$j3.push(_$cG)","60":"_$h8 = _$el[++_$$w]; _$cG = _$$o[--_$fF]; _$cG ? (_$$w += _$h8, ++_$fF) : 0","61":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] !== _$cG; _$$o[_$fF++] = _$cG","62":"_$cG = _$$o[--_$fF]; _$iZ(); _$cG = _$j3[_$h8] += _$cG","63":"_$h8 = _$el[++_$$w]; _$j3 = _$cu","64":"_$h8 = _$el[++_$$w]; _$j3 = _$$o[--_$fF]","65":"_$cG = _$j3[_$h8]--","66":"_$$o[_$fF++] = _$j3[_$h8]++","67":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] | _$cG; _$$o[_$fF++] = _$cG","68":"_$b$ = _$el[++_$$w], _$cG = _$$o[--_$fF], _$$w++;; for (_$ji in _$cG) {\n _$j3[_$h8] = _$ji, _$kB(_$jI, _$$w, _$$w + _$b$, _$bb);\n if (_$bb[4]) {\n _$$w = _$dp;\n break;\n }\n}; _$$w += _$b$ - 1;","69":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] + _$cG","70":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] << _$cG; _$$o[_$fF++] = _$cG","71":"_$fF -= 4; _$cG = _$fF; _$iZ(); _$j3 = _$j3[_$h8]; _$cG = _$j3(_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2], _$$o[_$cG + 3])","72":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] / _$cG; _$$o[_$fF++] = _$cG","73":"--_$fF; _$j3 = _$$o; _$h8 = _$fF","74":"_$cG = _$$o[--_$fF]; _$iZ(); _$cG = _$j3[_$h8] &= _$cG","75":"_$fF -= 4; _$cG = _$fF; _$iZ(); _$j3 = _$j3[_$h8]; _$$o[_$fF++] = _$j3(_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2], _$$o[_$cG + 3])","76":"_$fF -= 4; _$cG = _$fF; _$iZ(); _$cG = _$j3[_$h8](_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2], _$$o[_$cG + 3])","77":"_$h8 = _$el[++_$$w]; _$cG = _$$o[--_$fF]; _$cG = _$cG[_$h8]","78":"_$cG = -_$$o[--_$fF]; _$$o[_$fF++] = _$cG","79":"_$fF -= 3; _$cG = _$fF; _$iZ(); _$j3 = _$j3[_$h8]; _$$o[_$fF++] = _$j3(_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2])","80":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] >> _$cG; _$$o[_$fF++] = _$cG","81":"_$cG = _$$o[--_$fF]; _$iZ(); _$j3[_$h8] = _$cG; _$$o[_$fF++] = _$cG","82":"_$ji = _$el[++_$$w]; _$h8 = _$el[++_$$w]; _$j3 = _$jH[_$ji]","83":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] instanceof _$cG; _$$o[_$fF++] = _$cG","84":"_$cG = _$$o[--_$fF], _$iZ(), _$cG = _$j3[_$h8] -= _$cG","85":"debugger;","86":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] >= _$cG; _$$o[_$fF++] = _$cG","87":"_$h8 = _$el[++_$$w]; _$cG = _$cG[_$h8]","88":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] ^ _$cG; _$$o[_$fF++] = _$cG","89":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] >>> _$cG; _$$o[_$fF++] = _$cG","90":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] in _$cG; _$$o[_$fF++] = _$cG","91":"_$fF -= 4; _$cG = _$fF; _$iZ(); _$$o[_$fF++] = _$j3[_$h8](_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2], _$$o[_$cG + 3])","92":"_$$o[_$fF++] = ++_$j3[_$h8]","93":"_$$o[_$fF++] = --_$j3[_$h8]","94":"_$$o[_$fF++] = null","95":"_$el[_$$w] = 102; _$h8 = _$fW[_$el[++_$$w]]; _$el[_$$w] = _$h8; _$cG = _$$o[--_$fF]; _$$o[_$fF++] = _$cG[_$h8]","96":"_$b$ = _$el[++_$$w], _$fF -= _$b$, _$_S = _$$o.slice(_$fF, _$fF + _$b$), _$iZ(), _$cG = _$j3[_$h8].apply(_$j3, _$_S)","97":"_$cG = _$$o[--_$fF], _$h8 = _$el[++_$$w], _$j3 = _$dY[_$h8], _$b$ = _$j3[_$cG], _$b$ == _$cq ? _$b$ = _$el[++_$$w] : ++_$$w, _$$w += _$b$","98":"_$cG = _$$o[--_$fF], _$iZ(), _$cG = _$j3[_$h8] ^= _$cG","99":"throw _$$o[--_$fF];","100":"_$cG = delete _$j3[_$h8]","101":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] <= _$cG; _$$o[_$fF++] = _$cG","102":"_$h8 = _$el[++_$$w]; _$cG = _$$o[--_$fF]; _$$o[_$fF++] = _$cG[_$h8]","103":"_$fF -= 3; _$cG = _$fF; _$iZ(); _$$o[_$fF++] = _$j3[_$h8](_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2])","104":"_$fF -= 5; _$cG = _$fF; _$iZ(); _$$o[_$fF++] = _$j3[_$h8](_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2], _$$o[_$cG + 3], _$$o[_$cG + 4])","105":"_$b$ = _$el[++_$$w]; _$_S = _$$o.slice(_$fF - _$b$, _$fF); _$fF -= _$b$; _$iZ(); _$cG = _$$F(_$j3[_$h8], _$_S)","106":"_$iZ(); _$cG = _$j3[_$h8]()","107":"_$cG = _$$o[--_$fF]; _$$o[_$fF++] = ~_$cG","108":"_$h8 = _$el[++_$$w]; _$$o[_$fF++] = _$cG[_$h8]","109":"_$fF -= 3; _$cG = _$fF; _$iZ(); _$cG = _$j3[_$h8](_$$o[_$cG], _$$o[_$cG + 1], _$$o[_$cG + 2])","110":"_$cG = _$$o[--_$fF]; _$cG = _$$o[--_$fF] % _$cG; _$$o[_$fF++] = _$cG","111":"_$h8 = _$el[++_$$w]; _$cG = _$$o[--_$fF]; !_$cG ? _$$w += _$h8 : 0","112":"_$cG = ++_$j3[_$h8]","113":"_$cG = _$el[++_$$w]","name":"_$j9","params":["_$jI","_$aj","_$dp","_$bb"],"varible":["_$$w","_$j9","_$j3","_$h8","_$cG","_$ji","_$b$","_$el","_$gk","_$d5","_$cu","_$jH","_$$o","_$fF","_$_S"],"taskarr":"_$el","ret2":"_$gk","ret3":"_$d5","ret0":"_$cu","ret1":"_$jH","dataKey":"_$$o","dataIdx":"_$fF","forcur":"_$$w","formax":"_$dp","commonFunc":"function _$iZ() {\n var _$jI;\n _$jI = _$el[++_$$w], _$jI <= 38 ? _$jI <= 27 ? (_$el[_$$w] = 64, _$h8 = _$go[_$el[++_$$w]], _$el[_$$w] = _$h8, _$j3 = _$$o[--_$fF]) : _$jI <= 32 ? (_$el[_$$w] = 64, _$h8 = _$fW[_$el[++_$$w]], _$el[_$$w] = _$h8, _$j3 = _$$o[--_$fF]) : _$jI <= 33 ? (_$h8 = _$el[++_$$w], _$j3 = _$jn) : (_$h8 = _$$o[--_$fF], _$j3 = _$$o[--_$fF]) : _$jI <= 63 ? _$jI <= 47 ? (_$ji = _$el[++_$$w], _$h8 = _$el[++_$$w], _$j3 = _$d5[_$ji]) : _$jI <= 48 ? (_$h8 = _$el[++_$$w], _$j3 = _$jU) : _$jI <= 51 ? (_$h8 = _$el[++_$$w], _$j3 = _$gk) : (_$h8 = _$el[++_$$w], _$j3 = _$cu) : _$jI <= 64 ? (_$h8 = _$el[++_$$w], _$j3 = _$$o[--_$fF]) : _$jI <= 73 ? (--_$fF, _$j3 = _$$o, _$h8 = _$fF) : (_$ji = _$el[++_$$w], _$h8 = _$el[++_$$w], _$j3 = _$jH[_$ji]);\n}","globalRes":"_$jU","loopRes":"_$jn"} \ No newline at end of file +{"0":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] != _$k1; _$j5[_$dJ++] = _$k1","1":"_$dJ--; _$k1 = _$dJ; _$h5(); _$k1 = _$$N[_$$v](_$j5[_$k1])","2":"_$_c = _$ae[++_$c3]; _$kX = _$j5.slice(_$dJ - _$_c, _$dJ); _$dJ -= _$_c; _$h5(); _$j5[_$dJ++] = _$aB(_$$N[_$$v], _$kX)","3":"_$k1 = _$j5[--_$dJ]; _$h5(); _$k1 = _$$N[_$$v] |= _$k1","4":"_$k1 = _$$N[_$$v]++","5":"_$dJ -= 2; _$k1 = _$dJ; _$h5(); _$j5[_$dJ++] = _$$N[_$$v](_$j5[_$k1], _$j5[_$k1 + 1])","6":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] - _$k1; _$j5[_$dJ++] = _$k1","7":"_$kK = _$ae[++_$c3]; _$j5[_$dJ++] = _$cx[_$kK][_$ae[++_$c3]]","8":"_$k1 = _$j5[--_$dJ]; _$iN[4] = 1; _$iN[5] = _$k1; _$c3 = _$eK","9":"_$j5[_$dJ++] = _$dl[_$ae[++_$c3]]","10":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] > _$k1; _$j5[_$dJ++] = _$k1","11":"_$_c = _$ae[++_$c3]; _$c3 -= _$_c","12":"_$d3(_$cK, _$ae[++_$c3], _$ae[++_$c3], _$_c = _$ae[++_$c3], _$ae[++_$c3], _$c3 + 1, _$dl, _$iN); _$iN[4] ? _$c3 = _$eK : _$c3 += _$_c","13":"_$k1 = _$j5[--_$dJ]; _$$N = _$j5[_$dJ - 1]; _$$N[_$cF[_$ae[++_$c3]]] = _$k1","14":"_$k1 = _$j5[--_$dJ]; _$h5(); _$$N[_$$v] = _$k1","15":"_$k1 = _$j5[--_$dJ]; _$$N = _$j5[--_$dJ]; _$j5[_$dJ++] = _$$N[_$k1]","16":"_$j5[_$dJ++] = _$dO[_$ae[++_$c3]]","17":"_$dJ -= 2; _$k1 = _$dJ; _$h5(); _$$N = _$$N[_$$v]; _$j5[_$dJ++] = _$$N(_$j5[_$k1], _$j5[_$k1 + 1])","18":"_$dJ--; _$k1 = _$dJ; _$h5(); _$j5[_$dJ++] = _$$N[_$$v](_$j5[_$k1])","19":"_$j5[_$dJ++] = _$ix[_$ae[++_$c3]]","20":"_$ae[_$c3] = 102; _$$v = _$cF[_$ae[++_$c3]]; _$ae[_$c3] = _$$v; _$k1 = _$j5[--_$dJ]; _$j5[_$dJ++] = _$k1[_$$v]","21":"_$ae[_$c3] = 23; _$$v = _$ae[++_$c3]; _$k1 = _$jD[_$$v]; _$ae[_$c3] = _$k1; _$j5[_$dJ++] = _$k1","22":"_$dJ -= 3; _$k1 = _$dJ; _$h5(); _$$N = _$$N[_$$v]; _$k1 = _$$N(_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2])","23":"_$j5[_$dJ++] = _$ae[++_$c3]","24":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] + _$k1; _$j5[_$dJ++] = _$k1","25":"_$h5(); _$j5[_$dJ++] = _$$N[_$$v]()","26":"_$dJ -= 2; _$k1 = _$dJ; _$h5(); _$k1 = _$$N[_$$v](_$j5[_$k1], _$j5[_$k1 + 1])","27":"_$ae[_$c3] = 64; _$$v = _$cF[_$ae[++_$c3]]; _$ae[_$c3] = _$$v; _$$N = _$j5[--_$dJ]","28":"_$h5(); _$$N = _$$N[_$$v]; _$j5[_$dJ++] = _$$N()","29":"_$dJ--; _$k1 = _$dJ; _$h5(); _$$N = _$$N[_$$v]; _$k1 = _$$N(_$j5[_$k1])","30":"_$k1 = typeof _$j5[--_$dJ]; _$j5[_$dJ++] = _$k1","31":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] & _$k1; _$j5[_$dJ++] = _$k1","32":"_$ae[_$c3] = 64; _$$v = _$jD[_$ae[++_$c3]]; _$ae[_$c3] = _$$v; _$$N = _$j5[--_$dJ]","33":"_$$v = _$ae[++_$c3]; _$$N = _$dO","34":"_$j5[_$dJ++] = _$cN[_$ae[++_$c3]]","35":"_$k1 = _$j5[--_$dJ]; _$j5[_$dJ++] = !_$k1","36":"_$k1 = _$j5[--_$dJ]; _$$N = _$j5[_$dJ - 1]; _$$N[_$jD[_$ae[++_$c3]]] = _$k1","37":"_$dJ--; _$k1 = _$dJ; _$h5(); _$$N = _$$N[_$$v]; _$j5[_$dJ++] = _$$N(_$j5[_$k1])","38":"_$$v = _$j5[--_$dJ]; _$$N = _$j5[--_$dJ]","39":"_$_c = _$ae[++_$c3]; _$c3 += _$_c","40":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] * _$k1; _$j5[_$dJ++] = _$k1","41":"_$k1 = _$j5[--_$dJ]; _$_c = _$ae[++_$c3]; _$k1 ? 0 : _$c3 += _$_c","42":"_$iN[4] = 2; _$c3 = _$eK","43":"_$$v = _$ae[++_$c3]; _$k1 = _$j5[--_$dJ]; !_$k1 ? (_$c3 += _$$v, ++_$dJ) : 0","44":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] === _$k1; _$j5[_$dJ++] = _$k1","45":"_$j5[_$dJ++] = {}","46":"_$j5[_$dJ++] = false","47":"_$kK = _$ae[++_$c3]; _$$v = _$ae[++_$c3]; _$$N = _$be[_$kK]","48":"_$$v = _$ae[++_$c3]; _$$N = _$cN","49":"_$dJ -= 2; _$k1 = _$dJ; _$h5(); _$$N = _$$N[_$$v]; _$k1 = _$$N(_$j5[_$k1], _$j5[_$k1 + 1])","50":"_$ae[_$c3] = 23; _$$v = _$ae[++_$c3]; _$k1 = _$i7[_$$v]; _$ae[_$c3] = _$k1; _$j5[_$dJ++] = _$k1","51":"_$$v = _$ae[++_$c3]; _$$N = _$dl","52":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] == _$k1; _$j5[_$dJ++] = _$k1","53":"_$j5[_$dJ++] = true","54":"_$h5(); _$$N = _$$N[_$$v]; _$k1 = _$$N()","55":"_$$v = _$ae[++_$c3]; _$j5[_$dJ++] = _$el(_$cK._$b1[_$$v], _$iN)","56":"_$j5[_$dJ++] = []","57":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] < _$k1; _$j5[_$dJ++] = _$k1","58":"_$kK = _$ae[++_$c3]; _$j5[_$dJ++] = _$be[_$kK][_$ae[++_$c3]]","59":"_$k1 = _$j5[--_$dJ]; _$$N = _$j5[_$dJ - 1]; _$$N.push(_$k1)","60":"_$$v = _$ae[++_$c3]; _$k1 = _$j5[--_$dJ]; _$k1 ? (_$c3 += _$$v, ++_$dJ) : 0","61":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] !== _$k1; _$j5[_$dJ++] = _$k1","62":"_$k1 = _$j5[--_$dJ]; _$h5(); _$k1 = _$$N[_$$v] += _$k1","63":"_$$v = _$ae[++_$c3]; _$$N = _$ix","64":"_$$v = _$ae[++_$c3]; _$$N = _$j5[--_$dJ]","65":"_$k1 = _$$N[_$$v]--","66":"_$j5[_$dJ++] = _$$N[_$$v]++","67":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] | _$k1; _$j5[_$dJ++] = _$k1","68":"_$_c = _$ae[++_$c3], _$k1 = _$j5[--_$dJ], _$c3++;; for (_$kK in _$k1) {\n _$$N[_$$v] = _$kK, _$bo(_$cK, _$c3, _$c3 + _$_c, _$iN);\n if (_$iN[4]) {\n _$c3 = _$eK;\n break;\n }\n}; _$c3 += _$_c - 1;","69":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] + _$k1","70":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] << _$k1; _$j5[_$dJ++] = _$k1","71":"_$dJ -= 4; _$k1 = _$dJ; _$h5(); _$$N = _$$N[_$$v]; _$k1 = _$$N(_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2], _$j5[_$k1 + 3])","72":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] / _$k1; _$j5[_$dJ++] = _$k1","73":"--_$dJ; _$$N = _$j5; _$$v = _$dJ","74":"_$k1 = _$j5[--_$dJ]; _$h5(); _$k1 = _$$N[_$$v] &= _$k1","75":"_$dJ -= 4; _$k1 = _$dJ; _$h5(); _$$N = _$$N[_$$v]; _$j5[_$dJ++] = _$$N(_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2], _$j5[_$k1 + 3])","76":"_$dJ -= 4; _$k1 = _$dJ; _$h5(); _$k1 = _$$N[_$$v](_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2], _$j5[_$k1 + 3])","77":"_$$v = _$ae[++_$c3]; _$k1 = _$j5[--_$dJ]; _$k1 = _$k1[_$$v]","78":"_$k1 = -_$j5[--_$dJ]; _$j5[_$dJ++] = _$k1","79":"_$dJ -= 3; _$k1 = _$dJ; _$h5(); _$$N = _$$N[_$$v]; _$j5[_$dJ++] = _$$N(_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2])","80":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] >> _$k1; _$j5[_$dJ++] = _$k1","81":"_$k1 = _$j5[--_$dJ]; _$h5(); _$$N[_$$v] = _$k1; _$j5[_$dJ++] = _$k1","82":"_$kK = _$ae[++_$c3]; _$$v = _$ae[++_$c3]; _$$N = _$cx[_$kK]","83":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] instanceof _$k1; _$j5[_$dJ++] = _$k1","84":"_$k1 = _$j5[--_$dJ], _$h5(), _$k1 = _$$N[_$$v] -= _$k1","85":"debugger;","86":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] >= _$k1; _$j5[_$dJ++] = _$k1","87":"_$$v = _$ae[++_$c3]; _$k1 = _$k1[_$$v]","88":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] ^ _$k1; _$j5[_$dJ++] = _$k1","89":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] >>> _$k1; _$j5[_$dJ++] = _$k1","90":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] in _$k1; _$j5[_$dJ++] = _$k1","91":"_$dJ -= 4; _$k1 = _$dJ; _$h5(); _$j5[_$dJ++] = _$$N[_$$v](_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2], _$j5[_$k1 + 3])","92":"_$j5[_$dJ++] = ++_$$N[_$$v]","93":"_$j5[_$dJ++] = --_$$N[_$$v]","94":"_$j5[_$dJ++] = null","95":"_$ae[_$c3] = 102; _$$v = _$jD[_$ae[++_$c3]]; _$ae[_$c3] = _$$v; _$k1 = _$j5[--_$dJ]; _$j5[_$dJ++] = _$k1[_$$v]","96":"_$_c = _$ae[++_$c3], _$dJ -= _$_c, _$kX = _$j5.slice(_$dJ, _$dJ + _$_c), _$h5(), _$k1 = _$$N[_$$v].apply(_$$N, _$kX)","97":"_$k1 = _$j5[--_$dJ], _$$v = _$ae[++_$c3], _$$N = _$bS[_$$v], _$_c = _$$N[_$k1], _$_c == _$jt ? _$_c = _$ae[++_$c3] : ++_$c3, _$c3 += _$_c","98":"_$k1 = _$j5[--_$dJ], _$h5(), _$k1 = _$$N[_$$v] ^= _$k1","99":"throw _$j5[--_$dJ];","100":"_$k1 = delete _$$N[_$$v]","101":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] <= _$k1; _$j5[_$dJ++] = _$k1","102":"_$$v = _$ae[++_$c3]; _$k1 = _$j5[--_$dJ]; _$j5[_$dJ++] = _$k1[_$$v]","103":"_$dJ -= 3; _$k1 = _$dJ; _$h5(); _$j5[_$dJ++] = _$$N[_$$v](_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2])","104":"_$dJ -= 5; _$k1 = _$dJ; _$h5(); _$j5[_$dJ++] = _$$N[_$$v](_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2], _$j5[_$k1 + 3], _$j5[_$k1 + 4])","105":"_$_c = _$ae[++_$c3]; _$kX = _$j5.slice(_$dJ - _$_c, _$dJ); _$dJ -= _$_c; _$h5(); _$k1 = _$aB(_$$N[_$$v], _$kX)","106":"_$h5(); _$k1 = _$$N[_$$v]()","107":"_$k1 = _$j5[--_$dJ]; _$j5[_$dJ++] = ~_$k1","108":"_$$v = _$ae[++_$c3]; _$j5[_$dJ++] = _$k1[_$$v]","109":"_$dJ -= 3; _$k1 = _$dJ; _$h5(); _$k1 = _$$N[_$$v](_$j5[_$k1], _$j5[_$k1 + 1], _$j5[_$k1 + 2])","110":"_$k1 = _$j5[--_$dJ]; _$k1 = _$j5[--_$dJ] % _$k1; _$j5[_$dJ++] = _$k1","111":"_$$v = _$ae[++_$c3]; _$k1 = _$j5[--_$dJ]; !_$k1 ? _$c3 += _$$v : 0","112":"_$k1 = ++_$$N[_$$v]","113":"_$k1 = _$ae[++_$c3]","name":"_$aW","params":["_$cK","_$cC","_$eK","_$iN"],"varible":["_$c3","_$aW","_$$N","_$$v","_$k1","_$kK","_$_c","_$ae","_$dl","_$be","_$ix","_$cx","_$j5","_$dJ","_$kX"],"taskarr":"_$ae","ret2":"_$dl","ret3":"_$be","ret0":"_$ix","ret1":"_$cx","dataKey":"_$j5","dataIdx":"_$dJ","forcur":"_$c3","formax":"_$eK","commonFunc":"function _$h5() {\n var _$cK;\n _$cK = _$ae[++_$c3], _$cK <= 38 ? _$cK <= 27 ? (_$ae[_$c3] = 64, _$$v = _$cF[_$ae[++_$c3]], _$ae[_$c3] = _$$v, _$$N = _$j5[--_$dJ]) : _$cK <= 32 ? (_$ae[_$c3] = 64, _$$v = _$jD[_$ae[++_$c3]], _$ae[_$c3] = _$$v, _$$N = _$j5[--_$dJ]) : _$cK <= 33 ? (_$$v = _$ae[++_$c3], _$$N = _$dO) : (_$$v = _$j5[--_$dJ], _$$N = _$j5[--_$dJ]) : _$cK <= 63 ? _$cK <= 47 ? (_$kK = _$ae[++_$c3], _$$v = _$ae[++_$c3], _$$N = _$be[_$kK]) : _$cK <= 48 ? (_$$v = _$ae[++_$c3], _$$N = _$cN) : _$cK <= 51 ? (_$$v = _$ae[++_$c3], _$$N = _$dl) : (_$$v = _$ae[++_$c3], _$$N = _$ix) : _$cK <= 64 ? (_$$v = _$ae[++_$c3], _$$N = _$j5[--_$dJ]) : _$cK <= 73 ? (--_$dJ, _$$N = _$j5, _$$v = _$dJ) : (_$kK = _$ae[++_$c3], _$$v = _$ae[++_$c3], _$$N = _$cx[_$kK]);\n}","globalRes":"_$cN","keyname":"_$cF","loopRes":"_$dO","taskAttr":["_$aY","_$$M","_$$a","_$_2","_$b1"],"taskFactory":"_$el"} \ No newline at end of file diff --git a/src/handler/Cookie.js b/src/handler/Cookie.js index 0f9da04..4b16b75 100644 --- a/src/handler/Cookie.js +++ b/src/handler/Cookie.js @@ -13,6 +13,7 @@ const { uuid, string2ascii, execRandomByNumber, + execNumberByTime, hexnum, ascii2string, getFixedNumber, @@ -28,13 +29,27 @@ const { runTask, } = parser; +const developConfig = { + // 开发时用的配置,比如时间值固定、随机数固定等 + // 'window.innerWidth': 150, + // 'window.outerWidth': 1336, + // currentTime: 1711730658454, + // r2mkaTime: 1711712705, + // startTime: 1711730659, + // runTime: 1711730659, + // formatUid: 58854, + // random: 0.123, + execNumberByTime: 1778, +} + module.exports = class { constructor(ts, r2mkaText) { parser.init(ts, r2mkaText) + const current = new Date().getTime() + 1000; this.config = { 'window.navigator.maxTouchPoints': 0, 'window.eval.toString().length': 33, - 'window.navigator.userAgent': randomUseragent.getRandom(), + 'window.navigator.userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36', 'window.navigator.platform': 'MacIntel', 'window.name': '$_YWTU=LjFNq_oZCsth6KJ9xHOin6RRhL4fQt7Vsn8YCz9dRjl&$_YVTX=Wa&vdFm=_$hh', 'window.navigator.battery': { @@ -53,46 +68,52 @@ module.exports = class { 'window.innerWidth': 1680, 'window.outerHeight': 1025, 'window.outerWidth': 1680, + 'window.document.hidden': false, + formatUid: 46228, // 代码特征码 + currentTime: current, // 完整的时间戳 + runTime: Math.floor(current / 1000), // 运行时间 + startTime: Math.floor(current / 1000) - 1, // 模拟浏览器启动时间 + r2mkaTime: +ascii2string(gv.keys[21]), // r2mka文本解析出来的时间 + random: null, // 代替Math.random方法返回值 + execNumberByTime: execNumberByTime(), // 固定时间内的循环运行次数 + ...developConfig, } - this.runTime = Math.floor(new Date().getTime() / 1000); // 运行时间 - this.startTime = this.runTime - 1; // 模拟浏览器启动时间 - this.r2mkaTime = +ascii2string(gv.keys[21]); // r2mka文本解析出来的时间 + // console.log(this.config); } run() { + const basearr = this[`getBasearr_v${gv.version}`](); + const nextarr = numarrJoin( + numarrJoin( + 2, + numToNumarr4([this.config.r2mkaTime, this.config.startTime]), + gv.keys[2] + ), + encryptMode1( + xor( + numarrEncrypt(basearr), + gv.keys[2], + 16 + ), + numarrAddTime(gv.keys[17], this.config.runTime, this.config.random)[0], + 0 + ) + ) return '0' + numarr2string( - encryptMode1([ - ...numToNumarr4(this.r2mkaTime), - ...numarrJoin( - numarrJoin( - gv.r2mka("0>one>32-126").taskarr[73], - numarrJoin( - numToNumarr4([this.r2mkaTime, this.startTime]), - string2ascii(gv.cp0[399]) - ), - gv.keys[2] - ), - encryptMode1( - xor( - numarrEncrypt(this[`getBasearr_v${gv.version}`]()), - gv.keys[2], - 16 - ), - numarrAddTime(gv.keys[17], this.runTime)[0], - 0 - ) - )], - numarrAddTime(gv.keys[16], this.runTime)[0] + encryptMode1( + [ + ...numToNumarr4(uuid(nextarr)), + ...nextarr + ], + numarrAddTime(gv.keys[16], this.config.runTime, this.config.random)[0], + 1, + this.config.random ) ); } getBasearr_v2() { - // 第2版计算cookie方法 - const name = this.config['window.name'].split('&').reduce((ans, it) => { - const [key, val] = it.split('='); - return { ...ans, [key]: val }; - }, {}); + // 第2版计算cookie基础数组,cookie位数257位(当gv.keys[22]存在值) return numarrJoin( 3, numarrJoin( @@ -102,8 +123,8 @@ module.exports = class { 128, ...numToNumarr4(uuid(this.config['window.navigator.userAgent'])), string2ascii(this.config['window.navigator.platform']), - ...numToNumarr4(_random(500, 1000)), - ...execRandomByNumber(), + ...numToNumarr4(this.config.execNumberByTime), + ...execRandomByNumber(98, this.config.random), 0, 0, ...numToNumarr4(Number(hexnum('3136373737323136'))), @@ -114,50 +135,67 @@ module.exports = class { ...numToNumarr2(this.config['window.outerWidth']), ), 10, // 下标43 - [ - 0, // 运行时代码中传入的初始数组长度,由于传入的是空数组,因此为0 - 1, // 任务编号0>one>36>one>2-131的任务列表取得 - ...numToNumarr4(this.r2mkaTime + this.runTime - this.startTime), // ramka串返回的时间 + 当前时间 - 启动时间 - ...numToNumarr4(+ascii2string(gv.keys[19])), - ...numToNumarr8(Math.floor(Math.random() * 1048575) * 4294967296 + (((this.runTime * 1000) & 4294967295) >>> 0)), - ], - 7, // 下标63 + (() => { + const flag = +ascii2string(gv.keys[24]); + return [ + flag > 0 && flag < 8 ? 1 : 0, + 13, + ...numToNumarr4(this.config.r2mkaTime + this.config.runTime - this.config.startTime), // ramka串返回的时间 + 当前时间 - 启动时间 + ...numToNumarr4(+ascii2string(gv.keys[19])), + ...numToNumarr8(Math.floor((this.config.random || Math.random()) * 1048575) * 4294967296 + (((this.config.currentTime + 1) & 4294967295) >>> 0)), + flag, + ]; + })(), + 7, // 下标64 [ ...numToNumarr4(16777216), // gv.cp2取得 ...numToNumarr4(0), // 任务编号0-0的任务列表取得 ...numToNumarr2(getFixedNumber()), // 固定值5900 - ...numToNumarr2(46228), // 根据方法的toString()计算 + ...numToNumarr2(this.config.formatUid), // 根据方法的toString()计算, 使用了$_ts.aebi[1]作为任务的方法, ], 0, // 任务编号0>one>63-287的任务列表取得 [0], // 任务编号0>one>63>one>4-290的任务列表取得 - 6, // 下标80 + 6, // 下标81 [ // 编号510方法执行返回 1, ...numToNumarr2(0), ...numToNumarr2(0), - 0, - ...encryptMode2(decrypt(name.$_YWTU || ''), numarrAddTime(gv.keys[16])[0]), - ...numToNumarr2(+decode(decrypt(name.$_YVTX || ''))), + this.config['window.document.hidden'] ? 0 : 1, + ...encryptMode2(decrypt(ascii2string(gv.keys[22])), numarrAddTime(gv.keys[16])[0]), + ...numToNumarr2(+decode(decrypt(ascii2string(gv.keys[22])))), ], - 2, // 下标98 - [ - factorial(5) - factorial(3) * 2 + 100, // 100是cp2里取出来的,可能随版本变动 - 203, // cp2[76],检测window.HTMLFormElement是否存在 - 102, // cp2[120],检测document.createElement('from') - 103, // 检测window.top值是否为null - ], - 9, // 下标104 - [ - 0 | 8, // 8为cp2中的值 - ['bluetooth', 'cellular', 'ethernet', 'wifi', 'wimax'].indexOf(this.config['window.navigator.connection'].type) + 1, - ], + 2, // 下标99 + (() => { + const taskmap = {} + runTask('0>one>71>one>4-342', [taskmap]); + return [29, 30, 31, 32].map(it => { + return taskmap[ascii2string(gv.keys[it])](); + }) + })(), + 9, // 下标105 + (() => { // 编号133方法 + const { connType } = this.config['window.navigator.connection']; + const { charging, chargingTime, level } = this.config['window.navigator.battery'] + const connTypeIdx = ['bluetooth', 'cellular', 'ethernet', 'wifi', 'wimax'].indexOf(connType) + 1; + let oper = 0; + if (level) oper |= 2; + if (charging) oper |= 1; + if (connTypeIdx !== undefined) oper |= 8 + return [ + oper, + level * 100, + chargingTime >> 8, + chargingTime & 255, + connTypeIdx, + ] + })(), 13, [0], ) } getBasearr_v1() { - // 第1版计算cookie方法 + // 第1版计算cookie基础数组,cookie位数236位 const { getTaskNumber: gtn } = this; return numarrJoin( 3, diff --git a/src/handler/parser/common/dynamicExec.js b/src/handler/parser/common/dynamicExec.js deleted file mode 100644 index f546039..0000000 --- a/src/handler/parser/common/dynamicExec.js +++ /dev/null @@ -1,72 +0,0 @@ -const gv = require('@src/handler/globalVarible'); -const monitor = require('@utils/monitor'); -const logger = require('@utils/logger'); - -module.exports = function(...params) { - logger.trace('执行开始!'); - try { - return dynamicExec(...params); - } catch (err) { - logger.error(String(err)); - throw err; - } finally { - logger.trace('执行结束!'); - } -} - -function dynamicExec(taskItem, start = 0, args = [], loop_res = {}, global_res = {}) { - const codemap = gv.config.codemap; - const { key, taskarr: task } = taskItem; - args = monitor(args, `${key}_args`, { getLog: true, setLog: true }); - loop_res = monitor(loop_res, `${key}_loop_res`, { getLog: true, setLog: true }); - global_res = monitor(global_res, `${key}_global_res`, { getLog: true, setLog: true }); - logger.trace(`动态代码运行,任务列表:${key}, 起点:${start},长度:${task.length}`); - const data = []; - const ret = []; - ret[0] = args; - ret[2] = [ 'window', args ]; - const vars = [ - `${codemap.params[0]} = taskItem`, - `${codemap.params[1]} = start`, - `${codemap.params[2]} = task.length`, - `${codemap.params[3]} = ret`, - // 任务列表 - `${codemap.taskarr} = taskItem.taskarr`, - // 数据数组 - `${codemap.dataKey} = data`, - // 数据数组游标 - `${codemap.dataIdx} = 0`, - `${codemap.ret0} = ret[0]`, - `${codemap.ret1} = ret[1]`, - `${codemap.ret2} = ret[2]`, - `${codemap.ret3} = ret[3]`, - // 全局资源 - `${codemap.globalRes} = global_res`, - // 本地资源 - `${codemap.loopRes} = loop_res`, - `${codemap.forcur} = start`, - `${codemap.formax} = task.length`, - ...codemap.varible, - ].join(', '); - eval(`var ${vars};${codemap.commonFunc}`) - for (let t_cursor = start, idx = 0; t_cursor < task.length; t_cursor++) { - idx ++; - if (typeof codemap[task[t_cursor]] !== 'string') { - logger.error(`codemap中下标${task[t_cursor]}不存在值!`) - } else { - eval(`${codemap.forcur}=t_cursor`); - codemap[task[t_cursor]].split(';').map(it => it.trim()).forEach(c => { - try { - eval(c); - } catch(err) { - logger.error(`代码: ${c} 执行失败,当前任务:${taskItem.key}`) - debugger; - throw err; - } - }) - eval(`t_cursor=${codemap.forcur}`); - } - } - return ret[5]; -} - diff --git a/src/handler/parser/common/index.js b/src/handler/parser/common/index.js index 2123dee..69bcff3 100644 --- a/src/handler/parser/common/index.js +++ b/src/handler/parser/common/index.js @@ -21,7 +21,6 @@ module.exports = { numarrEncrypt: require('./numarrEncrypt'), numarr2string: require('./numarr2string'), numarrJoin: require('./numarrJoin'), - dynamicExec: require('./dynamicExec'), numarrAlterByNumber: require('./numarrAlterByNumber'), runTask: require('./runTask'), } diff --git a/src/handler/parser/common/modeEncrypt.js b/src/handler/parser/common/modeEncrypt.js index 9d4720f..bc490cc 100644 --- a/src/handler/parser/common/modeEncrypt.js +++ b/src/handler/parser/common/modeEncrypt.js @@ -56,14 +56,14 @@ function getCfg(numarr) { return [ret, arr]; } -function encryptMode1(valarr, keyarr, flag = 1) { +function encryptMode1(valarr, keyarr, flag = 1, random) { const cfg = getCfg(keyarr); var _$iv, _$j7, _$kb, _$ka, _$dV, _$du, _$jb; const max = Math.floor(valarr.length / 16) + 1; let ans = [], arr; const fill = 16 - valarr.length % 16; if (flag) { - ans = arr = new Array(4).fill(4294967295).map(it => Math.floor(Math.random() * it)); + ans = arr = new Array(4).fill(4294967295).map(it => Math.floor((random || Math.random()) * it)); } const copyarr = numToNumarr4.reverse_sign([...valarr, ...new Array(fill).fill(fill)]); for (let i = 0; i < max; ) { diff --git a/src/handler/parser/common/numarrAddTime.js b/src/handler/parser/common/numarrAddTime.js index 4efa162..98e96ce 100644 --- a/src/handler/parser/common/numarrAddTime.js +++ b/src/handler/parser/common/numarrAddTime.js @@ -2,9 +2,9 @@ const gv = require('@src/handler/globalVarible'); const numToNumarr4 = require('./numToNumarr4'); -module.exports = function(numarr, time) { +module.exports = function(numarr, time, random) { // time为时间戳除以1000后向上取整,如果不传则取当前时间戳 - const ele = Math.ceil(Math.random() * 256); + const ele = Math.ceil((random || Math.random()) * 256); const now = time || Math.floor(new Date().getTime() / 1000); const arr = [...numarr, ...numToNumarr4(now)].map(it => it ^ ele); arr.push(ele); diff --git a/src/handler/parser/common/random.js b/src/handler/parser/common/random.js index ece7126..dca2764 100644 --- a/src/handler/parser/common/random.js +++ b/src/handler/parser/common/random.js @@ -10,11 +10,11 @@ exports.execNumberByTime = function (times = 3) { return i; } -exports.execRandomByNumber = function (nums = 98) { +exports.execRandomByNumber = function (nums = 98, random) { // 指定次数的随机数取平均值后四舍五入 if (typeof nums !== 'number') return; const arr = [] - for (let i = 0; i < nums; i++) arr.push(Math.random()); + for (let i = 0; i < nums; i++) arr.push(random || Math.random()); const avg = _sum(arr) / nums; return [ avg * 100, diff --git a/src/handler/parser/common/runTask.js b/src/handler/parser/common/runTask.js index 6e32fd4..1bd95b8 100644 --- a/src/handler/parser/common/runTask.js +++ b/src/handler/parser/common/runTask.js @@ -1,45 +1,138 @@ // 直接通过动态代码执行来运行任务 // 该方法并未完全还原,谨慎使用 const gv = require('@src/handler/globalVarible'); -const dynamicExec = require('./dynamicExec'); +const monitor = require('@utils/monitor'); +const logger = require('@utils/logger'); const custask = require('../task'); const error = require('@utils/error'); -const logger = require('@utils/logger'); -module.exports = function(taskid, args, allowTask) { - // taskid为任务id,allowTask为允许执行的任务 - const task = gv.r2mka(taskid); - if (!task) { - error(`任务未找到`, { taskid }); - } - const global_res = new Proxy({}, { - get(target, property, receiver) { - // 由于每个版本下标都会变,在解析cd值生成8位偏移数的时候只用到了cp2数组,因此这里只返回cp2,需要注意! - logger.debug(`global_res 获取下标: ${property}`); - return gv.cp2; - } - }) - const loop_res = new Proxy([], { - get(target, key, receiver) { - const child = gv.r2mka().child_one; - if (Number(key) < child.length) { - const current = child[key]; - if (!key) return current; - return (...params) => { - if (custask[current.key]) { - // 自定义任务 - return custask[current.key](...params); - } - if (allowTask && !allowTask[key]) { - error('当前任务未在允许列表!', { key: current.key }); - } - return dynamicExec(current, 0, params, loop_res, global_res); - } +module.exports = function(task, args, allowTask) { + if (typeof task === 'string') task = gv.r2mka(task); + if (!task) throw new Error('任务未找到'); + logger.debug(`${task.key}执行开始!`); + try { + const global_res = new Proxy({}, { + get(target, property, receiver) { + // 由于每个版本下标都会变,在解析cd值生成8位偏移数的时候只用到了cp2数组,因此这里只返回cp2,需要注意! + logger.debug(`global_res 获取下标: ${property}`); + return gv.cp2; } - if (gv.config.offsetConst[key]) return gv.config.offsetConst[key]; - error('loop_res取值未找到', { key }); - } - }) - return dynamicExec(task, 0, args, loop_res, global_res); + }) + const loop_res = new Proxy([], { + get(target, key, receiver) { + const child = gv.r2mka().child_one; + if (Number(key) < child.length) { + const current = child[key]; + if (!key) return current; + return (...params) => { + if (custask[current.key]) { + // 自定义任务 + return custask[current.key](...params); + } + if (allowTask && !allowTask[key]) { + error('当前任务未在允许列表!', { key: current.key }); + } + return dynamicExec(current, 0, params, loop_res, global_res); + } + } + if (gv.config.offsetConst[key]) return gv.config.offsetConst[key]; + error('loop_res取值未找到', { key }); + } + }) + return dynamicExec(task, 0, args, loop_res, global_res); + } catch (err) { + logger.error(String(err)); + throw err; + } finally { + logger.debug(`${task.key}执行结束!`); + } +} + +function taskFactory(task, args) { + return (...params) => { + if (custask[task.key]) return custask[task.key](...params); + return module.exports(task, params); + } +} + +function getParentSubTask(task, loopRes) { + const subTask = []; + if (!task) debugger; + while (task.isReset === 0 && task.key !== '0-0') { + subTask.push(['window', 'args', ...task.child_one.slice(2).map(it => taskFactory(it))]); + task = task.parent; + } + return [loopRes, ...subTask.reverse()]; +} + + +function dynamicExec(taskItem, start = 0, args = [], loop_res = {}, global_res = {}) { + const codemap = gv.config.codemap; + const { key, taskarr: task } = taskItem; + args = monitor(args, `${key}_args`, { getLog: true, setLog: true }); + loop_res = monitor(loop_res, `${key}_loop_res`, { getLog: true, setLog: true }); + global_res = monitor(global_res, `${key}_global_res`, { getLog: true, setLog: true }); + logger.debug(`动态代码运行,任务列表:${key}, 起点:${start},长度:${task.length}`); + const data = []; + const ret = []; + ret[0] = args; + ret[2] = [ 'window', args ]; + ret[3] = getParentSubTask(taskItem.parent, loop_res); + const taskItemProxy = new Proxy({}, { + get(target, property, receiver) { + const idx = codemap.taskAttr.indexOf(property); + if (idx === -1) debugger; + const name = ['lens', 'isReset', 'taskarr', 'child_one', 'child_two'][idx]; + if (!name) debugger; + return taskItem[name]; + } + }) + const vars = [ + `${codemap.params[0]} = taskItemProxy`, + `${codemap.params[1]} = start`, + `${codemap.params[2]} = task.length`, + `${codemap.params[3]} = ret`, + // 任务工厂函数 + `${codemap.taskFactory} = taskFactory`, + `${codemap.keyname} = gv.ts.cp[1]`, + // 任务列表 + `${codemap.taskarr} = task`, + // 数据数组 + `${codemap.dataKey} = data`, + // 数据数组游标 + `${codemap.dataIdx} = 0`, + `${codemap.ret0} = ret[0]`, + `${codemap.ret1} = ret[1]`, + `${codemap.ret2} = ret[2]`, + `${codemap.ret3} = ret[3]`, + // 全局资源 + `${codemap.globalRes} = global_res`, + // 本地资源 + `${codemap.loopRes} = loop_res`, + `${codemap.forcur} = start`, + `${codemap.formax} = task.length`, + ...codemap.varible, + ].join(', '); + eval(`var ${vars};${codemap.commonFunc}`) + for (let t_cursor = start, idx = 0; t_cursor < task.length; t_cursor++) { + idx ++; + if (typeof codemap[task[t_cursor]] !== 'string') { + logger.error(`codemap中下标${task[t_cursor]}不存在值!`) + } else { + logger.debug(`(${key}, ${idx})执行代码:${codemap[task[t_cursor]]}`); + eval(`${codemap.forcur}=t_cursor`); + codemap[task[t_cursor]].split(';').map(it => it.trim()).forEach(c => { + try { + eval(c); + } catch(err) { + logger.error(`代码: ${c} 执行失败,当前任务:${key}`) + debugger; + throw err; + } + }) + eval(`t_cursor=${codemap.forcur}`); + } + } + return ret[5]; } diff --git a/src/handler/parser/r2mka.js b/src/handler/parser/r2mka.js index 78c4356..e4d4f46 100644 --- a/src/handler/parser/r2mka.js +++ b/src/handler/parser/r2mka.js @@ -27,8 +27,9 @@ function gtHandler(str, curr) { const parse = (() => { let count = 0; const valMap = {}; - return function(val, deep = 0, deeps = [0]) { + return function(val, deep = 0, deeps = [0], parent = null) { const str = val.taskstr; + val.parent = parent; val.taskstr = str; val.val = {}; if (!str) { @@ -41,12 +42,12 @@ const parse = (() => { valMap[val.key] = val; val.child_one.map((it, idx) => { if (it) { - parse(it, deep + 1, [...deeps, 'one', idx]); + parse(it, deep + 1, [...deeps, 'one', idx], val); } }); val.child_two.map((it, idx) => { if (it) { - parse(it, deep + 1, [...deeps, 'two', idx]); + parse(it, deep + 1, [...deeps, 'two', idx], val); } }); return (key) => { diff --git a/src/handler/parser/task/index.js b/src/handler/parser/task/index.js index 997e205..f22307a 100644 --- a/src/handler/parser/task/index.js +++ b/src/handler/parser/task/index.js @@ -1,12 +1,29 @@ const gv = require('@src/handler/globalVarible'); -// 预期任务作用,实际还没有用到,需要多版本对比 -const expectTask = { - '0>one>71>one>4>one>3-344': '计算阶乘' -} +/* + * 1. 0>one>71>one>4>two>2-348与0>one>71>one>4>two>12-358返回值来源一致 + */ module.exports = { '0>one>21-23': (num) => { return Math.abs(num) % 8; }, + '0>one>71>one>4>two>2-348': () => { + // 该任务首先检测document.createElement('a')是否能成功,成功则返回gv.cp2中的固定值 + return 102; + }, + '0>one>71>one>4>two>12-358': () => { + // 该任务首先检测document.createElement('form')是否能成功,成功则返回gv.cp2中的固定值 + return 102; + }, + '0>one>71>one>4>two>4-350': () => { + // 该任务首先检测window.navigator.userAgent是否为string格式,是的话进行计算后返回 + // **需要注意是否返回同一值** + return 224; + }, + '0>one>71>one>4>two>14-360': () => { + // 该任务首先检测window.navigator.userAgent是否为string格式,是的话进行计算后返回 + // **需要注意是否返回同一值** + return 225; + } } diff --git a/src/handler/viewer/dkeys.js b/src/handler/viewer/dkeys.js new file mode 100644 index 0000000..f400a06 --- /dev/null +++ b/src/handler/viewer/dkeys.js @@ -0,0 +1,14 @@ +// 遇到的gv.keys使用放在这里方便归档查阅 +const gv = require('@src/handler/globalVarible'); + +exports.dkeys = function () { + return { + 7: gv.utils.ascii2string(gv.keys[7]).split(';'), + 22: gv.utils.ascii2string(gv.keys[22]), + 29: gv.utils.ascii2string(gv.keys[29]), + 30: gv.utils.ascii2string(gv.keys[30]), + 31: gv.utils.ascii2string(gv.keys[31]), + 33: gv.utils.ascii2string(gv.keys[33]), + 34: gv.utils.ascii2string(gv.keys[34]), + }; +} diff --git a/src/handler/viewer/index.js b/src/handler/viewer/index.js new file mode 100644 index 0000000..2daa7f4 --- /dev/null +++ b/src/handler/viewer/index.js @@ -0,0 +1,3 @@ +module.exports = { + ...require('./dkeys'), +} diff --git a/src/makeCodeHigh.js b/src/makeCodeHigh.js index 5dc1ea0..2c487c5 100644 --- a/src/makeCodeHigh.js +++ b/src/makeCodeHigh.js @@ -6,6 +6,7 @@ const Coder = require('./handler/Coder'); const Cookie = require('./handler/Cookie'); const unescape = require('@utils/unescape'); const gv = require('@src/handler/globalVarible'); +const getCode = require('@utils/getCode'); function parseR2mka(text) { const start = text.indexOf('"') + 1; @@ -13,15 +14,15 @@ function parseR2mka(text) { return unescape(text.substr(start, end)); } -module.exports = function (ts, immucfg) { - console.log('还原更多加密文件,如app.js等,作者开发中,可关注微信订阅号`码功`获取项目更新推送!'); - return +module.exports = function (ts, immucfg, mate) { gv._setAttr('_ts', ts); const startTime = new Date().getTime(); const coder = new Coder(ts, immucfg); const { code, $_ts } = coder.run(); const r2mkaText = parseR2mka(coder.r2mkaText); - const cookie = new Cookie($_ts, r2mkaText).run(); - return cookie; + const cookieVal = new Cookie($_ts, r2mkaText).run(); + const cookieKey = gv.utils.ascii2string(gv.keys[7]).split(';')[5] + 'P'; + debugger; + getCode(mate.url, `${cookieKey}=${cookieVal}`); } diff --git a/utils/getCode.js b/utils/getCode.js index 0526ba0..b4dee72 100644 --- a/utils/getCode.js +++ b/utils/getCode.js @@ -1,5 +1,5 @@ -// process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0" -const request = require('request-promise'); +process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0" +const { request, cookieJar } = require('./request'); const cheerio = require('cheerio'); const isValidUrl = require('./isValidUrl'); const _get = require('lodash/get'); @@ -7,16 +7,26 @@ const urlresolve = require('url').resolve; function addRequestHead(uri) { return { - // proxy: 'http://127.0.0.1:7777', - // gzip: true + proxy: 'http://127.0.0.1:8888', + gzip: true, uri, - "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36", resolveWithFullResponse: true, simple: false, + headers: { + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36', + 'Connection': 'keep-alive', + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', + 'Accept-Encoding': 'gzip, deflate, br, zstd', + 'Accept-Language': 'zh-CN,zh;q=0.9', + } } } -module.exports = async function getCode(url) { +module.exports = async function getCode(url, cookieStr) { + if (cookieStr) { + cookieJar.setCookie(request.cookie(cookieStr), url); + console.log(`当前cookie:${cookieJar.getCookieString(url)}`); + } if (!isValidUrl(url)) throw new Error('输入链接不正确'); const res = await request(addRequestHead(url)); const $ = cheerio.load(res.body); @@ -34,3 +44,23 @@ module.exports = async function getCode(url) { } throw new Error('js外链中没有瑞数的代码文件'); } + +// Host: wcjs.sbj.cnipa.gov.cn +// Connection: keep-alive +// Upgrade-Insecure-Requests: 1 +// sec-ch-ua: "Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123" +// sec-ch-ua-mobile: ?0 +// sec-ch-ua-platform: "macOS" +// User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 +// Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 +// Accept-Encoding: gzip, deflate, br, zstd +// Accept-Language: zh-CN,zh;q=0.9 +// Sec-Fetch-Dest: document +// Sec-Fetch-Mode: navigate +// +// Sec-Fetch-Site: none +// Sec-Fetch-User: ?1 +// +// +// Sec-Fetch-Site: same-origin +// Referer: https://wcjs.sbj.cnipa.gov.cn/sgtmi diff --git a/utils/initGv.js b/utils/initGv.js index c6ff182..708f326 100644 --- a/utils/initGv.js +++ b/utils/initGv.js @@ -3,14 +3,17 @@ const fs = require('fs'); const { init } = require('@src/handler/parser/'); const logger = require('./logger'); const gv = require('@src/handler/globalVarible'); +const Coder = require('@src/handler/Coder'); module.exports = function(filepath) { if (typeof filepath !== 'string') { if (typeof filepath === 'number') gv._setAttr('version', filepath); - filepath = paths.exampleResolve('codes', `${gv.version}-$_ts-full.json`) + filepath = paths.exampleResolve('codes', `${gv.version}-$_ts.json`) } if (!fs.existsSync(filepath)) throw new Error(`输入文件不存在: ${filepath}`); logger.debug(`初始化GlobalVarible变量,$_ts配置文件:${filepath}`); - init(JSON.parse(fs.readFileSync(filepath, 'utf8'))); + const coder = new Coder(JSON.parse(fs.readFileSync(filepath, 'utf8'))); + const { code, $_ts } = coder.run(); + init($_ts); return gv; }; diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..35a05e7 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,8 @@ +const rp = require('request-promise'); +const cookieJar = rp.jar() +const request = rp.defaults({ jar: cookieJar }) + +module.exports = { + request, + cookieJar, +}