fix: code optimization for the makecookie command

This commit is contained in:
rnet 2024-01-02 00:44:23 +08:00
parent 8186ef7915
commit fda003f6b1
3 changed files with 27 additions and 46 deletions

View File

@ -38,7 +38,7 @@ module.exports = class {
}
this.runTime = Math.floor(new Date().getTime() / 1000); // 运行时间
this.startTime = this.runTime - 1; // 模拟浏览器启动时间
this.firstTime = this.runTime - 1000; // 模拟浏览器第一次载入网页时间
this.r2mkaTime = +ascii2string(gv.keys[21]); // r2mka文本解析出来的时间
}
run() {
@ -61,13 +61,27 @@ module.exports = class {
gv.cp2[39],
[gtn('0>one>55>one>3-189', 6)],
)
const cookie = numarr2string(
const cookie = '0' + numarr2string(
encryptMode1([
...numToNumarr4(this.firstTime),
...numToNumarr4(this.r2mkaTime),
...numarrJoin(
numarrJoin(gv.r2mka("0>one>32-126").taskarr[73], numarrJoin(numToNumarr4([this.firstTime, this.startTime]), string2ascii(gv.cp0[399])), gv.keys[gv.cp2[56]]),
encryptMode1(xor(numarrEncrypt(cookieBaseArr), gv.keys[gv.cp2[56]], gv.cp2[2]), numarrAddTime(gv.keys[gv.cp2[24]], this.runTime)[0], 0)
numarrJoin(
gv.r2mka("0>one>32-126").taskarr[73],
numarrJoin(
numToNumarr4([this.r2mkaTime, this.startTime]),
string2ascii(gv.cp0[399])
),
gv.keys[gv.cp2[56]]
),
encryptMode1(
xor(
numarrEncrypt(cookieBaseArr),
gv.keys[gv.cp2[56]],
gv.cp2[2]
),
numarrAddTime(gv.keys[gv.cp2[24]], this.runTime)[0],
0
)
)],
numarrAddTime(gv.keys[gv.cp2[2]], this.runTime)[0]
)
@ -82,12 +96,12 @@ module.exports = class {
gtn('0>one>62>one>30-272', 550),
this.config['window.navigator.maxTouchPoints'],
this.config['window.eval.toString().length'],
gtn('0>one>62>one>28-270', 1) | (gtn('0>one>62>one>28-270', 92) << gv.cp2[23]), // check flag
gtn('0>one>62>one>28-270', 1) | (gtn('0>one>62>one>28-270', 92) << gv.cp2[23]),
...numToNumarr4(uuid(this.config['window.navigator.userAgent'])),
pfarr.length,
...pfarr,
...numToNumarr4(_random(500, 1000)),
...execRandomByNumber(), // check flag
...execRandomByNumber(),
gtn('0>one>62>one>12-246', 28),
gtn('0>one>62-235', 36),
...numToNumarr4(Number(hexnum(gv.cp0_96(6, 76))))
@ -99,9 +113,9 @@ module.exports = class {
return [
flag > 0 && flag < gv.cp2[52] ? 1 : 0,
gv.cp2[39],
...numToNumarr4(+ascii2string(gv.keys[21]) + 1), // ramka串返回的时间 + 当前时间 - 启动时间
...numToNumarr4(this.r2mkaTime + this.runTime - this.startTime), // ramka串返回的时间 + 当前时间 - 启动时间
...numToNumarr4(+ascii2string(gv.keys[gv.cp2[15]])),
...numToNumarr8(Math.floor(Math.random() * gv.cp2[207]) * gv.cp2[16] + ((new Date().getTime() & gv.cp2[17]) >>> 0)),
...numToNumarr8(Math.floor(Math.random() * gv.cp2[207]) * gv.cp2[16] + (((this.runTime * 1000) & gv.cp2[17]) >>> 0)),
flag,
]
}

View File

@ -10,12 +10,11 @@ exports.execNumberByTime = function (times = gv.cp2[58]) {
return i;
}
exports.execRandomByNumber = function (nums = gv.cp2[108], arr = []) {
exports.execRandomByNumber = function (nums = gv.cp2[108]) {
// 指定次数的随机数取平均值后四舍五入
if (typeof nums !== 'number') return;
if (arr.length === 0) {
for (let i = 0; i < nums; i++) arr.push(Math.random());
}
const arr = []
for (let i = 0; i < nums; i++) arr.push(Math.random());
const avg = _sum(arr) / nums;
return [
avg * gv.cp2[28],

View File

@ -1,32 +0,0 @@
const gv = require('../globalVarible');
const getTimeFlag = (time) => {
return [
time >>> gv.cp2[4] & gv.cp2[34],
time >>> gv.cp2[2] & gv.cp2[34],
time >>> gv.cp2[52] & gv.cp2[34],
time & gv.cp2[34]
];
}
const restoreTimeFlag = (timeFlag) => {
return timeFlag[0] << gv.cp2[4] | timeFlag[1] << gv.cp2[2] | timeFlag[2] << gv.cp2[52] | timeFlag[3];
}
exports.parse = function(numarr) {
const now = Math.ceil(new Date().getTime() / 1000);
const timeflag = [
now >>> gv.cp2[4] & gv.cp2[34],
now >>> gv.cp2[2] & gv.cp2[34],
now >>> gv.cp2[52] & gv.cp2[34],
now & gv.cp2[34]
];
const random = Math.ceil(Math.random() * gv.cp2[30]);
const ans = [...numarr, ...timeflag].map(it => it ^ 33)
ans.push(random);
return ans
}
exports.init = function() {
};