Commit 74229dc6 authored by wang's avatar wang

解密脚本编写

parent 7b77e54c
...@@ -508,7 +508,7 @@ for (let i = 0; i < keys.length; i++) { ...@@ -508,7 +508,7 @@ for (let i = 0; i < keys.length; i++) {
var map2 = {}; var map2 = {};
// 开始还原 // 开始还原
let funcTemp = {} let funcTemp = {}
for (let j = 0; j < 3; j++) { for (let j = 0; j < 20; j++) {
traverse(ast, { traverse(ast, {
VariableDeclaration(path) { VariableDeclaration(path) {
let {declarations} = path.node; let {declarations} = path.node;
...@@ -518,9 +518,9 @@ for (let j = 0; j < 3; j++) { ...@@ -518,9 +518,9 @@ for (let j = 0; j < 3; j++) {
let {id, init} = declaration; let {id, init} = declaration;
if (!init) return if (!init) return
if (!types.isIdentifier(init)) return; if (!types.isIdentifier(init)) return;
// if (init.name === '$d') { if (init.name === 'Bo') {
// debugger; debugger;
// } }
if (keys2.includes(init.name)) { if (keys2.includes(init.name)) {
let t = newMap[init.name]; let t = newMap[init.name];
...@@ -540,10 +540,10 @@ for (let j = 0; j < 3; j++) { ...@@ -540,10 +540,10 @@ for (let j = 0; j < 3; j++) {
let binding = scope.getBinding(id.name); let binding = scope.getBinding(id.name);
if (!binding) return; if (!binding) return;
console.log(id.name, init.name, keys2.includes(init.name), binding.references) // console.log(id.name, init.name, keys2.includes(init.name), binding.references)
if (id.name === 'xc') { if (id.name === 'Bo') {
// console.log(id.name, init.name, keys2.includes(init.name), binding.references) // console.log(id.name, init.name, keys2.includes(init.name), binding.references)
debugger debugger
} }
...@@ -558,9 +558,9 @@ for (let j = 0; j < 3; j++) { ...@@ -558,9 +558,9 @@ for (let j = 0; j < 3; j++) {
} }
if (arguments.length === 1 && types.isNumericLiteral(arguments[0])) { if (arguments.length === 1 && types.isNumericLiteral(arguments[0])) {
let res = funcTemp[t.name](arguments[0].value) let res = funcTemp[t.name](arguments[0].value)
if (id.name === 'zo') { if (init.name === 'Bo') {
// console.log(arguments[0].value, res) console.log(init.name, id.name, arguments[0].value, res)
} }
referencePath.parentPath.replaceWith(types.StringLiteral(res)) referencePath.parentPath.replaceWith(types.StringLiteral(res))
} }
...@@ -638,7 +638,7 @@ traverse(ast, { ...@@ -638,7 +638,7 @@ traverse(ast, {
debugger debugger
} }
if (!binding) return; if (!binding) return;
// console.log(id.name, init.name, binding.references) console.log(id.name, init.name, binding.references)
for (const referencePath of binding.referencePaths) { for (const referencePath of binding.referencePaths) {
// console.log(referencePath); // console.log(referencePath);
......
(function Sf(r, u, v, n) { const fs = require('fs');
for (var t = void 0, z = r; z <= u; z++) { const types = require("@babel/types");
(t = function pf(r) { const parser = require("@babel/parser");
// debugger; const {log} = require('console');
var u = r.index, const traverse = require("@babel/traverse").default;
v = r.puzzleHelperVars, const generator = require("@babel/generator").default;
n = r.targetHash,
t = v.fullNibbleMask,
z = v.zeroPad, //js混淆代码读取
f = v.fullNibblesMissing, process.argv.length > 2 ? encodeFile = process.argv[2] : encodeFile = "./main_ok.js";
e = v.partialNibble, process.argv.length > 3 ? decodeFile = process.argv[3] : decodeFile = "./decodeResult22.js";
w = v.leftPartOfSolution,
L = (z + (u & t).toString(16)).slice(-f), //将源代码解析为AST
s = w + (e + (u >> (f << 2))).toString(16) + L; let sourceCode = fs.readFileSync(encodeFile, {encoding: "utf-8"});
if (function (r) {
var u = "0123456789abcdef".split(""), let ast = parser.parse(sourceCode, {sourceType: 'script'});
v = [-2147483648, 8388608, 32768, 128],
n = [24, 16, 8, 0],
t = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298], console.time("处理完毕,耗时");
z = [];
function f() { function getRandomName(length) {
z[0] = z[16] = z[1] = z[2] = z[3] = z[4] = z[5] = z[6] = z[7] = z[8] = z[9] = z[10] = z[11] = z[12] = z[13] = z[14] = z[15] = 0;
this.blocks = z; let initArr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
this.h0 = 1779033703; let puzzleArr = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
this.h1 = 3144134277; let ranInx = Math.floor(Math.random() * initArr.length);
this.h2 = 1013904242; let randomName = initArr[ranInx];
this.h3 = 2773480762;
this.h4 = 1359893119; for (var i = 1; i < length; i++) {
this.h5 = 2600822924; ranInx = Math.floor(Math.random() * puzzleArr.length);
this.h6 = 528734635; randomName += puzzleArr[ranInx];
this.h7 = 1541459225; }
this.block = this.start = this.bytes = this.hBytes = 0;
this.finalized = this.hashed = false; return randomName;
this.first = true; }
}
return f.prototype.update = function (r) { let allNewNames = new Map(); //定义一个全局变量,保存需要处理的函数
if (!this.finalized && "string" == typeof r) {
for (var u = void 0, v = 0, t = void 0, z = r.length, f = this.blocks; v < z;) { function getUnusedIdentifier() {//获取未被使用的名称,返回 Identifier 类型。
for (this.hashed && (this.hashed = false, f[0] = this.block, f[16] = f[1] = f[2] = f[3] = f[4] = f[5] = f[6] = f[7] = f[8] = f[9] = f[10] = f[11] = f[12] = f[13] = f[14] = f[15] = 0), t = this.start; v < z && t < 64; ++v) { do {
(u = r.charCodeAt(v)) < 128 ? f[t >> 2] |= u << n[3 & t++] : u < 2048 ? (f[t >> 2] |= (192 | u >> 6) << n[3 & t++], f[t >> 2] |= (128 | 63 & u) << n[3 & t++]) : u < 55296 || u >= 57344 ? (f[t >> 2] |= (224 | u >> 12) << n[3 & t++], f[t >> 2] |= (128 | u >> 6 & 63) << n[3 & t++], f[t >> 2] |= (128 | 63 & u) << n[3 & t++]) : (u = 65536 + ((1023 & u) << 10 | 1023 & r.charCodeAt(++v)), f[t >> 2] |= (240 | u >> 18) << n[3 & t++], f[t >> 2] |= (128 | u >> 12 & 63) << n[3 & t++], f[t >> 2] |= (128 | u >> 6 & 63) << n[3 & t++], f[t >> 2] |= (128 | 63 & u) << n[3 & t++]); var newName = "$C_" + getRandomName(3);
}
this.lastByteIndex = t; } while (allNewNames.has(newName))
this.bytes += t - this.start;
t >= 64 ? (this.block = f[16], this.start = t - 64, this.hash(), this.hashed = true) : this.start = t; allNewNames.set(newName, 1);
}
return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 << 0, this.bytes = this.bytes % 4294967296), this; let UnusedIdentifier = types.Identifier(newName);
}
}, f.prototype.finalize = function () { return UnusedIdentifier;
if (!this.finalized) { }
this.finalized = true;
var r = this.blocks,
u = this.lastByteIndex; const renameFunc =
r[16] = this.block; {
r[u >> 2] |= v[3 & u]; FunctionDeclaration(path) {
this.block = r[16]; let {node, parentPath} = path;
u >= 56 && (this.hashed || this.hash(), r[0] = this.block, r[16] = r[1] = r[2] = r[3] = r[4] = r[5] = r[6] = r[7] = r[8] = r[9] = r[10] = r[11] = r[12] = r[13] = r[14] = r[15] = 0); let {id, params, body} = node;
r[14] = this.hBytes << 3 | this.bytes >>> 29; let name = id.name;
r[15] = this.bytes << 3;
this.hash(); if (params.length != 2 ||
} !types.isVariableDeclaration(body.body[0]) || !types.isReturnStatement(body.body[1])) {
}, f.prototype.hash = function () { return;
var r = this.h0, }
u = this.h1,
v = this.h2, let binding = parentPath.scope.getBinding(name);
n = this.h3,
z = this.h4, if (!binding || !binding.constant) {
f = this.h5, return;
e = this.h6, }
w = this.h7, let newNameId = getUnusedIdentifier();
L = void 0, // console.log('rename',name,newNameId)
s = void 0, // console.log(generator(path.parent).code)
o = void 0, for (let referPath of binding.referencePaths) {
g = void 0, referPath.replaceWith(newNameId);
K = void 0, }
D = void 0,
i = void 0, let newName = newNameId.name;
q = void 0, allNewNames.set(newName, name)
c = void 0, path.node.id.name = newName;
y = this.blocks; }
for (L = 16; L < 64; ++L) { }
s = ((K = y[L - 15]) >>> 7 | K << 25) ^ (K >>> 18 | K << 14) ^ K >>> 3;
o = ((K = y[L - 2]) >>> 17 | K << 15) ^ (K >>> 19 | K << 13) ^ K >>> 10; // traverse(ast, renameFunc);
y[L] = y[L - 16] + s + y[L - 7] + o << 0;
} allNewNames.clear();
for (c = u & v, L = 0; L < 64; L += 4) {
this.first ? (D = 704751109, w = (K = y[0] - 210244248) - 1521486534 << 0, n = K + 143694565 << 0, this.first = false) : (s = (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10), g = (D = r & u) ^ r & v ^ c, w = n + (K = w + (o = (z >>> 6 | z << 26) ^ (z >>> 11 | z << 21) ^ (z >>> 25 | z << 7)) + (z & f ^ ~z & e) + t[L] + y[L]) << 0, n = K + (s + g) << 0);
s = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10); function getBinding(scope, name, func) {
g = (i = n & r) ^ n & u ^ D; let binding = scope.getBinding(name);
e = v + (K = e + (o = (w >>> 6 | w << 26) ^ (w >>> 11 | w << 21) ^ (w >>> 25 | w << 7)) + (w & z ^ ~w & f) + t[L + 1] + y[L + 1]) << 0; console.log(`scope.get(${name}).length = ${binding.references}`)
s = ((v = K + (s + g) << 0) >>> 2 | v << 30) ^ (v >>> 13 | v << 19) ^ (v >>> 22 | v << 10); if (binding.references > 0) {
g = (q = v & n) ^ v & r ^ i; for (const referencePath of binding.referencePaths) {
f = u + (K = f + (o = (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7)) + (e & w ^ ~e & z) + t[L + 2] + y[L + 2]) << 0; func(referencePath)
s = ((u = K + (s + g) << 0) >>> 2 | u << 30) ^ (u >>> 13 | u << 19) ^ (u >>> 22 | u << 10); }
g = (c = u & v) ^ u & n ^ q; }
z = r + (K = z + (o = (f >>> 6 | f << 26) ^ (f >>> 11 | f << 21) ^ (f >>> 25 | f << 7)) + (f & e ^ ~f & w) + t[L + 3] + y[L + 3]) << 0;
r = K + (s + g) << 0; }
}
this.h0 = this.h0 + r << 0; var globalFuncs = {}
this.h1 = this.h1 + u << 0;
this.h2 = this.h2 + v << 0; function restoreValue(inName, scope, funcName) {
this.h3 = this.h3 + n << 0; let binding3 = scope.getBinding(inName);
this.h4 = this.h4 + z << 0; if (!binding3) return;
this.h5 = this.h5 + f << 0; console.log(funcName, inName, binding3.references)
this.h6 = this.h6 + e << 0; for (const inReferencePath of binding3.referencePaths) {
this.h7 = this.h7 + w << 0; console.log(generator(inReferencePath.parent).code, inReferencePath.parent.type)
}, f.prototype.hex = function () { if (types.isCallExpression(inReferencePath.parent)) {
this.finalize(); let {arguments} = inReferencePath.parent
var r = this.h0, if (arguments.length !== 1) continue
v = this.h1, let res = globalFuncs[funcName](arguments[0].value)
n = this.h2, // console.log(funcName,inName,arguments[0].value,res)
t = this.h3, inReferencePath.parentPath.replaceWith(types.valueToNode(res))
z = this.h4, } else if (types.isVariableDeclarator(inReferencePath.parent)) {
f = this.h5, // 如果是继续引用 直接再找
e = this.h6, let inName2 = inReferencePath.parent.id.name;
w = this.h7; restoreValue(inName2, inReferencePath.parentPath.scope, funcName)
return u[r >> 28 & 15] + u[r >> 24 & 15] + u[r >> 20 & 15] + u[r >> 16 & 15] + u[r >> 12 & 15] + u[r >> 8 & 15] + u[r >> 4 & 15] + u[15 & r] + u[v >> 28 & 15] + u[v >> 24 & 15] + u[v >> 20 & 15] + u[v >> 16 & 15] + u[v >> 12 & 15] + u[v >> 8 & 15] + u[v >> 4 & 15] + u[15 & v] + u[n >> 28 & 15] + u[n >> 24 & 15] + u[n >> 20 & 15] + u[n >> 16 & 15] + u[n >> 12 & 15] + u[n >> 8 & 15] + u[n >> 4 & 15] + u[15 & n] + u[t >> 28 & 15] + u[t >> 24 & 15] + u[t >> 20 & 15] + u[t >> 16 & 15] + u[t >> 12 & 15] + u[t >> 8 & 15] + u[t >> 4 & 15] + u[15 & t] + u[z >> 28 & 15] + u[z >> 24 & 15] + u[z >> 20 & 15] + u[z >> 16 & 15] + u[z >> 12 & 15] + u[z >> 8 & 15] + u[z >> 4 & 15] + u[15 & z] + u[f >> 28 & 15] + u[f >> 24 & 15] + u[f >> 20 & 15] + u[f >> 16 & 15] + u[f >> 12 & 15] + u[f >> 8 & 15] + u[f >> 4 & 15] + u[15 & f] + u[e >> 28 & 15] + u[e >> 24 & 15] + u[e >> 20 & 15] + u[e >> 16 & 15] + u[e >> 12 & 15] + u[e >> 8 & 15] + u[e >> 4 & 15] + u[15 & e] + (u[w >> 28 & 15] + u[w >> 24 & 15] + u[w >> 20 & 15] + u[w >> 16 & 15] + u[w >> 12 & 15] + u[w >> 8 & 15] + u[w >> 4 & 15] + u[15 & w]);
}, f.prototype.toString = f.prototype.hex, new f().update(r).hex(); }
}(s) === n) { }
return s; }
}
}({ for (let i = 0; i < 1; i++) {
index: z, traverse(ast, {
puzzleHelperVars: v, FunctionDeclaration(path) {
targetHash: n // 先找
})) && (console.log(JSON.stringify({ // function ip() {
index: z, // var t = ["NjR0QllZTQ", "bind", "reload", "NjR0QltQTw", "NjR0QV1dTw", "pxInit", "uid", "pxvid", "length", "72630ywVgnM", "platform", "vid", "trigger", "NjR0QVxRSA", "random", "67349mopHGY", "NjR0Ql9cQg", "306744MLTLsI", "NjR0QV9fTw", "_pxvid", "getTime", "xhrFailure", "527700doOldY", "_pxRootUrl", "_pxmvid", "top", "NjR0QVNQQg", "xhrResponse", "NjR0QVhbSg", "NjR0QV5QSg", "getItem", "_pxVid", "removeItem", "one", "NjR0QllfTg", "_asyncInit", "NjQ", "3060155IbqKSZ", "subscribe", "1026255lNKhiL", "self", "588762aejAEn", "xhrSuccess"];
puzzleHelperVars: v, // return (ip = function () {
targetHash: n // return t;
}), t), postMessage(t)); // })();
} // }
postMessage(false); // 这样的函数 解密内容的
}).apply(null, [0, 255804, {"fullNibbleMask":65535,"zeroPad":"0000","fullNibblesMissing":4,"partialNibble":0,"leftPartOfSolution":"ac9e3049cb2f7f391f38d2426d3e07be19cd069a490b05aea023f2cc568","startTime":3026.5}, "2ae40e50f07a63eac255fcb3537cde202bd49eaede6c6795060e43bbdd343dec"]) let {id, body, params} = path.node;
\ No newline at end of file let bodys = body.body;
if (bodys.length !== 2 || params.length !== 0) return;
let varDeclar = bodys[0];
if (!types.isVariableDeclaration(varDeclar)) return;
if (varDeclar.declarations.length !== 1 || !types.isArrayExpression(varDeclar.declarations[0].init)) return;
if (!types.isReturnStatement(bodys[1])) return;
let name = id.name;
let code = generator(path.node).code;
// if (name !== 'Ur') return;
let binding = path.parentPath.scope.getBinding(name);
console.log(`scope.get(${name}).length = ${binding.references}`)
if (binding.references > 0) {
let code1, code2, funcName;
for (const referencePath of binding.referencePaths) {
// console.log(code2);
// console.log('111',referencePath.parentPath.parent.type)
if (types.isUnaryExpression(referencePath.parentPath.parent)) {
code1 = generator(referencePath.parentPath.parent).code;
console.groupCollapsed(['改变顺序', code1])
} else if (types.isVariableDeclarator(referencePath.parentPath.parent)) {
code2 = generator(referencePath.parentPath.parentPath.parentPath.parentPath.parent).code;
funcName = referencePath.parentPath.parentPath.parentPath.parentPath.parent.id.name
console.groupCollapsed(['使用', code2])
}
}
let resCode = code + ';;;\n' + code1 + ';;;\n' + code2;
resCode += `
globalFuncs['${funcName}'] = ${funcName}
`
console.groupCollapsed([funcName, resCode])
eval(resCode)
// console.log(eval(`${funcName}(195)`))
let binding2 = path.parentPath.scope.getBinding(funcName);
// 找到Tp 的引用地方
for (const referencePath of binding2.referencePaths) {
console.log('referencePath', generator(referencePath.parent).code)
// if (types.isBlockStatement(referencePath.parentPath.parentPath.parent) ) {
if (!types.isUnaryExpression(referencePath.parentPath.parentPath.parentPath.parentPath.parentPath.parentPath.parent)) {
// 找到引用点 排除掉 修改变量顺序的引用
console.log(generator(referencePath.parent).code, referencePath.parent.type)
if (types.isCallExpression(referencePath.parent)) {
let {arguments} = referencePath.parent
if (arguments.length !== 1) continue
let res = eval(`${funcName}(arguments[0].value)`)
// console.log(funcName,inName,arguments[0].value,res)
referencePath.parentPath.replaceWith(types.valueToNode(res))
} else {
if (!referencePath.parent.id)continue;
// 继续找引用
let inName = referencePath.parent.id.name;
let binding3 = referencePath.scope.getBinding(inName);
if (!binding3) continue;
console.log('find', funcName, inName, binding3.references)
for (const inReferencePath of binding3.referencePaths) {
console.log('code ', generator(inReferencePath.parent).code, inReferencePath.parent.type)
if (types.isCallExpression(inReferencePath.parent)) {
let {arguments} = inReferencePath.parent
if (arguments.length !== 1) continue
let res = eval(`${funcName}(arguments[0].value)`)
// console.log(funcName,inName,arguments[0].value,res)
inReferencePath.parentPath.replaceWith(types.valueToNode(res))
} else if (types.isVariableDeclarator(inReferencePath.parent)) {
// 如果是继续引用 直接再找
let inName2 = inReferencePath.parent.id.name;
restoreValue(inName2, inReferencePath.parentPath.scope, funcName)
}
}
}
}
}
}
// console.log(name, code);
}
})
}
//end
console.timeEnd("处理完毕,耗时");
let {code} = generator(ast, opts = {jsescOption: {"minimal": true}});
fs.writeFile(decodeFile, code, (err) => {
});
\ No newline at end of file
...@@ -39,8 +39,6 @@ try { ...@@ -39,8 +39,6 @@ try {
} }
o[n] = u; o[n] = u;
} }
// console.log('i', n, u)
if (u === 'PX11379')debugger
return e(r), u; return e(r), u;
} }
var c = i; var c = i;
...@@ -269,7 +267,7 @@ try { ...@@ -269,7 +267,7 @@ try {
return B(e & n | ~e & r, t, e, a, o, i); return B(e & n | ~e & r, t, e, a, o, i);
} }
function B(t, e, n, r, a, o) { function B(t, e, n, r, a, o) {
return $C_dNB((i = $C_dNB($C_dNB(e, t), $C_dNB(r, o))) << (c = a) | i >>> 32 - c, n); return $C_oUF((i = $C_oUF($C_oUF(e, t), $C_oUF(r, o))) << (c = a) | i >>> 32 - c, n);
var i; var i;
var c; var c;
} }
...@@ -284,10 +282,10 @@ try { ...@@ -284,10 +282,10 @@ try {
var u = -271733879; var u = -271733879;
var l = -1732584194; var l = -1732584194;
var f = 271733878; var f = 271733878;
for (n = 0; n < t.length; n += 16) r = c, a = u, o = l, i = f, c = O(c, u, l, f, t[n], 7, -680876936), f = O(f, c, u, l, t[n + 1], 12, -389564586), l = O(l, f, c, u, t[n + 2], 17, 606105819), u = O(u, l, f, c, t[n + 3], 22, -1044525330), c = O(c, u, l, f, t[n + 4], 7, -176418897), f = O(f, c, u, l, t[n + 5], 12, 1200080426), l = O(l, f, c, u, t[n + 6], 17, -1473231341), u = O(u, l, f, c, t[n + 7], 22, -45705983), c = O(c, u, l, f, t[n + 8], 7, 1770035416), f = O(f, c, u, l, t[n + 9], 12, -1958414417), l = O(l, f, c, u, t[n + 10], 17, -42063), u = O(u, l, f, c, t[n + 11], 22, -1990404162), c = O(c, u, l, f, t[n + 12], 7, 1804603682), f = O(f, c, u, l, t[n + 13], 12, -40341101), l = O(l, f, c, u, t[n + 14], 17, -1502002290), c = _(c, u = O(u, l, f, c, t[n + 15], 22, 1236535329), l, f, t[n + 1], 5, -165796510), f = _(f, c, u, l, t[n + 6], 9, -1069501632), l = _(l, f, c, u, t[n + 11], 14, 643717713), u = _(u, l, f, c, t[n], 20, -373897302), c = _(c, u, l, f, t[n + 5], 5, -701558691), f = _(f, c, u, l, t[n + 10], 9, 38016083), l = _(l, f, c, u, t[n + 15], 14, -660478335), u = _(u, l, f, c, t[n + 4], 20, -405537848), c = _(c, u, l, f, t[n + 9], 5, 568446438), f = _(f, c, u, l, t[n + 14], 9, -1019803690), l = _(l, f, c, u, t[n + 3], 14, -187363961), u = _(u, l, f, c, t[n + 8], 20, 1163531501), c = _(c, u, l, f, t[n + 13], 5, -1444681467), f = _(f, c, u, l, t[n + 2], 9, -51403784), l = _(l, f, c, u, t[n + 7], 14, 1735328473), c = X(c, u = _(u, l, f, c, t[n + 12], 20, -1926607734), l, f, t[n + 5], 4, -378558), f = X(f, c, u, l, t[n + 8], 11, -2022574463), l = X(l, f, c, u, t[n + 11], 16, 1839030562), u = X(u, l, f, c, t[n + 14], 23, -35309556), c = X(c, u, l, f, t[n + 1], 4, -1530992060), f = X(f, c, u, l, t[n + 4], 11, 1272893353), l = X(l, f, c, u, t[n + 7], 16, -155497632), u = X(u, l, f, c, t[n + 10], 23, -1094730640), c = X(c, u, l, f, t[n + 13], 4, 681279174), f = X(f, c, u, l, t[n], 11, -358537222), l = X(l, f, c, u, t[n + 3], 16, -722521979), u = X(u, l, f, c, t[n + 6], 23, 76029189), c = X(c, u, l, f, t[n + 9], 4, -640364487), f = X(f, c, u, l, t[n + 12], 11, -421815835), l = X(l, f, c, u, t[n + 15], 16, 530742520), c = I(c, u = X(u, l, f, c, t[n + 2], 23, -995338651), l, f, t[n], 6, -198630844), f = I(f, c, u, l, t[n + 7], 10, 1126891415), l = I(l, f, c, u, t[n + 14], 15, -1416354905), u = I(u, l, f, c, t[n + 5], 21, -57434055), c = I(c, u, l, f, t[n + 12], 6, 1700485571), f = I(f, c, u, l, t[n + 3], 10, -1894986606), l = I(l, f, c, u, t[n + 10], 15, -1051523), u = I(u, l, f, c, t[n + 1], 21, -2054922799), c = I(c, u, l, f, t[n + 8], 6, 1873313359), f = I(f, c, u, l, t[n + 15], 10, -30611744), l = I(l, f, c, u, t[n + 6], 15, -1560198380), u = I(u, l, f, c, t[n + 13], 21, 1309151649), c = I(c, u, l, f, t[n + 4], 6, -145523070), f = I(f, c, u, l, t[n + 11], 10, -1120210379), l = I(l, f, c, u, t[n + 2], 15, 718787259), u = I(u, l, f, c, t[n + 9], 21, -343485551), c = $C_dNB(c, r), u = $C_dNB(u, a), l = $C_dNB(l, o), f = $C_dNB(f, i); for (n = 0; n < t.length; n += 16) r = c, a = u, o = l, i = f, c = O(c, u, l, f, t[n], 7, -680876936), f = O(f, c, u, l, t[n + 1], 12, -389564586), l = O(l, f, c, u, t[n + 2], 17, 606105819), u = O(u, l, f, c, t[n + 3], 22, -1044525330), c = O(c, u, l, f, t[n + 4], 7, -176418897), f = O(f, c, u, l, t[n + 5], 12, 1200080426), l = O(l, f, c, u, t[n + 6], 17, -1473231341), u = O(u, l, f, c, t[n + 7], 22, -45705983), c = O(c, u, l, f, t[n + 8], 7, 1770035416), f = O(f, c, u, l, t[n + 9], 12, -1958414417), l = O(l, f, c, u, t[n + 10], 17, -42063), u = O(u, l, f, c, t[n + 11], 22, -1990404162), c = O(c, u, l, f, t[n + 12], 7, 1804603682), f = O(f, c, u, l, t[n + 13], 12, -40341101), l = O(l, f, c, u, t[n + 14], 17, -1502002290), c = _(c, u = O(u, l, f, c, t[n + 15], 22, 1236535329), l, f, t[n + 1], 5, -165796510), f = _(f, c, u, l, t[n + 6], 9, -1069501632), l = _(l, f, c, u, t[n + 11], 14, 643717713), u = _(u, l, f, c, t[n], 20, -373897302), c = _(c, u, l, f, t[n + 5], 5, -701558691), f = _(f, c, u, l, t[n + 10], 9, 38016083), l = _(l, f, c, u, t[n + 15], 14, -660478335), u = _(u, l, f, c, t[n + 4], 20, -405537848), c = _(c, u, l, f, t[n + 9], 5, 568446438), f = _(f, c, u, l, t[n + 14], 9, -1019803690), l = _(l, f, c, u, t[n + 3], 14, -187363961), u = _(u, l, f, c, t[n + 8], 20, 1163531501), c = _(c, u, l, f, t[n + 13], 5, -1444681467), f = _(f, c, u, l, t[n + 2], 9, -51403784), l = _(l, f, c, u, t[n + 7], 14, 1735328473), c = X(c, u = _(u, l, f, c, t[n + 12], 20, -1926607734), l, f, t[n + 5], 4, -378558), f = X(f, c, u, l, t[n + 8], 11, -2022574463), l = X(l, f, c, u, t[n + 11], 16, 1839030562), u = X(u, l, f, c, t[n + 14], 23, -35309556), c = X(c, u, l, f, t[n + 1], 4, -1530992060), f = X(f, c, u, l, t[n + 4], 11, 1272893353), l = X(l, f, c, u, t[n + 7], 16, -155497632), u = X(u, l, f, c, t[n + 10], 23, -1094730640), c = X(c, u, l, f, t[n + 13], 4, 681279174), f = X(f, c, u, l, t[n], 11, -358537222), l = X(l, f, c, u, t[n + 3], 16, -722521979), u = X(u, l, f, c, t[n + 6], 23, 76029189), c = X(c, u, l, f, t[n + 9], 4, -640364487), f = X(f, c, u, l, t[n + 12], 11, -421815835), l = X(l, f, c, u, t[n + 15], 16, 530742520), c = I(c, u = X(u, l, f, c, t[n + 2], 23, -995338651), l, f, t[n], 6, -198630844), f = I(f, c, u, l, t[n + 7], 10, 1126891415), l = I(l, f, c, u, t[n + 14], 15, -1416354905), u = I(u, l, f, c, t[n + 5], 21, -57434055), c = I(c, u, l, f, t[n + 12], 6, 1700485571), f = I(f, c, u, l, t[n + 3], 10, -1894986606), l = I(l, f, c, u, t[n + 10], 15, -1051523), u = I(u, l, f, c, t[n + 1], 21, -2054922799), c = I(c, u, l, f, t[n + 8], 6, 1873313359), f = I(f, c, u, l, t[n + 15], 10, -30611744), l = I(l, f, c, u, t[n + 6], 15, -1560198380), u = I(u, l, f, c, t[n + 13], 21, 1309151649), c = I(c, u, l, f, t[n + 4], 6, -145523070), f = I(f, c, u, l, t[n + 11], 10, -1120210379), l = I(l, f, c, u, t[n + 2], 15, 718787259), u = I(u, l, f, c, t[n + 9], 21, -343485551), c = $C_oUF(c, r), u = $C_oUF(u, a), l = $C_oUF(l, o), f = $C_oUF(f, i);
return [c, u, l, f]; return [c, u, l, f];
} }
function $C_dNB(t, e) { function $C_oUF(t, e) {
return (t >> 16) + (e >> 16) + ((65535 & t) + (65535 & e) >> 16) << 16 | 65535 & (65535 & t) + (65535 & e); return (t >> 16) + (e >> 16) + ((65535 & t) + (65535 & e) >> 16) << 16 | 65535 & (65535 & t) + (65535 & e);
} }
function F(t) { function F(t) {
...@@ -331,8 +329,7 @@ try { ...@@ -331,8 +329,7 @@ try {
} catch (t) {} } catch (t) {}
}(); }();
function H(t) { function H(t) {
let res = l(U) === "function" ? U(t) : function (t) { return l(U) === "function" ? U(t) : function (t) {
var e; var e;
var n; var n;
var r; var r;
...@@ -351,9 +348,6 @@ try { ...@@ -351,9 +348,6 @@ try {
return null; return null;
} }
}(t); }(t);
// console.log('H', t, res)
return res
} }
var J; var J;
var z; var z;
...@@ -866,7 +860,7 @@ try { ...@@ -866,7 +860,7 @@ try {
function je(t) { function je(t) {
return t ? he : Ie; return t ? he : Ie;
} }
function $C_pDI(t, e) { function $C_dAY(t, e) {
var n = jt(t, e); var n = jt(t, e);
return -1 !== n ? n : (t.push(e), t.length - 1); return -1 !== n ? n : (t.push(e), t.length - 1);
} }
...@@ -1081,13 +1075,10 @@ try { ...@@ -1081,13 +1075,10 @@ try {
} }
for (var ir = [], cr = {}, ur = 0; ur < 256; ur++) ir[ur] = (ur + 256).toString(16).substr(1), cr[ir[ur]] = ur; for (var ir = [], cr = {}, ur = 0; ur < 256; ur++) ir[ur] = (ur + 256).toString(16).substr(1), cr[ir[ur]] = ur;
function lr(t, e, n, r) { function lr(t, e, n, r) {
// uuid
return 'b8a39670-7866-11ee-9655-63a4f05cd5d1'
var a = ""; var a = "";
if (r) try { if (r) try {
for (var o = (new Date().getTime() * Math.random() + "").replace(".", ".".charCodeAt()).split("").slice(-16), i = 0; i < o.length; i++) o[i] = parseInt(10 * Math.random()) * +o[i] || parseInt(Math.random() * 36); for (var o = (new Date().getTime() * Math.random() + "").replace(".", ".".charCodeAt()).split("").slice(-16), i = 0; i < o.length; i++) o[i] = parseInt(10 * Math.random()) * +o[i] || parseInt(Math.random() * 36);
a = $C_gLP(o, 0); a = $C_oHI(o, 0);
} catch (t) {} } catch (t) {}
var c = e && n || 0; var c = e && n || 0;
var u = e || []; var u = e || [];
...@@ -1102,10 +1093,10 @@ try { ...@@ -1102,10 +1093,10 @@ try {
var d = f / 4294967296 * 1e4 & 268435455; var d = f / 4294967296 * 1e4 & 268435455;
u[c++] = d >>> 8 & 255, u[c++] = 255 & d, u[c++] = d >>> 24 & 15 | 16, u[c++] = d >>> 16 & 255, u[c++] = l >>> 8 | 128, u[c++] = 255 & l; u[c++] = d >>> 8 & 255, u[c++] = 255 & d, u[c++] = d >>> 24 & 15 | 16, u[c++] = d >>> 16 & 255, u[c++] = l >>> 8 | 128, u[c++] = 255 & l;
for (var p = t.node || hr, m = 0; m < 6; m++) u[c + m] = p[m]; for (var p = t.node || hr, m = 0; m < 6; m++) u[c + m] = p[m];
var g = e || $C_gLP(u); var g = e || $C_oHI(u);
return a === g ? a : g; return a === g ? a : g;
} }
function $C_gLP(t, e) { function $C_oHI(t, e) {
var n = e || 0; var n = e || 0;
return ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + "-" + ir[t[n++]] + ir[t[n++]] + "-" + ir[t[n++]] + ir[t[n++]] + "-" + ir[t[n++]] + ir[t[n++]] + "-" + ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + ir[t[n++]]; return ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + "-" + ir[t[n++]] + ir[t[n++]] + "-" + ir[t[n++]] + ir[t[n++]] + "-" + ir[t[n++]] + ir[t[n++]] + "-" + ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + ir[t[n++]] + ir[t[n++]];
} }
...@@ -1978,7 +1969,6 @@ try { ...@@ -1978,7 +1969,6 @@ try {
function Ka() { function Ka() {
var n = co; var n = co;
try { try {
console.log('px12573', Ma)
if (qa("q2u")) eo(function (f, n, t) { if (qa("q2u")) eo(function (f, n, t) {
return Math.floor(f / 18076) * n.charCodeAt(15); return Math.floor(f / 18076) * n.charCodeAt(15);
}["apply"](null, Ma)); }["apply"](null, Ma));
...@@ -2001,7 +1991,6 @@ try { ...@@ -2001,7 +1991,6 @@ try {
function eo(t) { function eo(t) {
var r = co; var r = co;
var a = i; var a = i;
console.log('PX12573', t, Oe("" + Math["floor"](t)))
!_a["PX12573"] && (_a["PX12573"] = Oe("" + Math["floor"](t))); !_a["PX12573"] && (_a["PX12573"] = Oe("" + Math["floor"](t)));
} }
function no() { function no() {
...@@ -2147,7 +2136,7 @@ try { ...@@ -2147,7 +2136,7 @@ try {
s.ts = new Date()[so(414)](); s.ts = new Date()[so(414)]();
var h = nf(); var h = nf();
s[f(so(468))] = h && parseInt(h); s[f(so(468))] = h && parseInt(h);
var v = Tr((ba(fa[Je]) || so(328))['split'](",")[so(242)](function (t) { var v = Tr((ba(fa[Je]) || so(328))[so(398)](",")[so(242)](function (t) {
return +t; return +t;
}), 2); }), 2);
ho = v[0], vo = v[1]; ho = v[0], vo = v[1];
...@@ -2335,10 +2324,10 @@ try { ...@@ -2335,10 +2324,10 @@ try {
function xo(t) { function xo(t) {
var Q = i; var Q = i;
try { try {
if (t['PX11701'] = yl, t['PX12420'] = jl, t['PX11701']) t['PX11701'] = t['PX11701']['substring'](0, 80), t[Me(t['PX12420'] || t['PX11701'], t['PX11431'] % 10 + 2)] = Me(t['PX12420'] || t['PX11701'], t['PX11431'] % 10 + 1); if (t[Q(so(519))] = yl, t[Q(so(570))] = jl, t[Q(so(519))]) t[Q(so(519))] = t[Q(so(519))][so(547)](0, 80), t[Me(t[Q(so(570))] || t[Q(so(519))], t[Q(so(468))] % 10 + 2)] = Me(t[Q(so(570))] || t[Q(so(519))], t[Q(so(468))] % 10 + 1);
t['PX12420'] && (t['PX12420'] = t['PX12420']['substring'](0, 80)), t['PX12454'] = bl, t['PX12454'] && (t['PX12454'] = parseInt(t['PX12454']) || 0); t[Q(so(570))] && (t[Q(so(570))] = t[Q(so(570))][so(547)](0, 80)), t[Q(so(431))] = bl, t[Q(so(431))] && (t[Q(so(431))] = parseInt(t[Q(so(431))]) || 0);
var N = Tr((ba(fa[Ue]) || "")['split'](","), 2); var N = Tr((ba(fa[Ue]) || "")[so(398)](","), 2);
N[0] && (t[Q(so(434))] = (N[1] || "")['substring'](0, 40)), t['PX12377'] = wl; N[0] && (t[Q(so(434))] = (N[1] || "")[so(547)](0, 40)), t[Q(so(452))] = wl;
} catch (t) {} } catch (t) {}
} }
function _o(t) { function _o(t) {
...@@ -2545,7 +2534,7 @@ try { ...@@ -2545,7 +2534,7 @@ try {
var o = Ve(de()); var o = Ve(de());
var c = o[o.length - 1] || {}; var c = o[o.length - 1] || {};
if (!n && -1 !== (c[0] || "").indexOf(Ml)) return; if (!n && -1 !== (c[0] || "").indexOf(Ml)) return;
li++, ai.push(Mt((u(a = {}, "PX12343", t), u(a, "PX12240", $C_pDI(ri, c[1] || "")), u(a, "PX11944", $C_pDI(ni, c[0] || "")), a), e)); li++, ai.push(Mt((u(a = {}, "PX12343", t), u(a, "PX12240", $C_dAY(ri, c[1] || "")), u(a, "PX11944", $C_dAY(ni, c[0] || "")), a), e));
} }
} }
function pi(t) { function pi(t) {
...@@ -2677,7 +2666,7 @@ try { ...@@ -2677,7 +2666,7 @@ try {
if (t) { if (t) {
var a = Ve(de()); var a = Ve(de());
var o = a[a.length - 1] || {}; var o = a[a.length - 1] || {};
r["PX12240"] = $C_pDI(ri, o[1]), r["PX11944"] = $C_pDI(ni, o[0]); r["PX12240"] = $C_dAY(ri, o[1]), r["PX11944"] = $C_dAY(ni, o[0]);
} }
af("PX11510", r); af("PX11510", r);
} }
...@@ -4060,7 +4049,6 @@ try { ...@@ -4060,7 +4049,6 @@ try {
return Vs[Tn][hs] || ""; return Vs[Tn][hs] || "";
} }
function Ds(t) { function Ds(t) {
console.log(t[0])
for (var m = i, g = Oc(), R = 0; R < t[kf(532)]; R++) { for (var m = i, g = Oc(), R = 0; R < t[kf(532)]; R++) {
var Q = t[R]; var Q = t[R];
Q.d[m(kf(500))] = Ct, g && (Q.d[m(kf(452))] = g), Q.d[m(kf(479))] = xl, vh && (Q.d[m(kf(447))] = vh); Q.d[m(kf(500))] = Ct, g && (Q.d[m(kf(452))] = g), Q.d[m(kf(479))] = xl, vh && (Q.d[m(kf(447))] = vh);
...@@ -4084,9 +4072,6 @@ try { ...@@ -4084,9 +4072,6 @@ try {
pc: j pc: j
}; };
var T = yf(t, S); var T = yf(t, S);
console.log([JSON.stringify(t)
, S, T])
var b = [Ff + T, Pf + Vs[Vn], Lf + Vs[An], Xf + pl, Yf + Vs[En], Wf + ss++, $f + as]; var b = [Ff + T, Pf + Vs[Vn], Lf + Vs[An], Xf + pl, Yf + Vs[En], Wf + ss++, $f + as];
var w = pf(); var w = pf();
w && b[kf(482)](Df + w), y && b[kf(482)](Gf + y), j && b[kf(482)](Uf + j); w && b[kf(482)](Df + w), y && b[kf(482)](Gf + y), j && b[kf(482)](Uf + j);
...@@ -4218,7 +4203,6 @@ try { ...@@ -4218,7 +4203,6 @@ try {
} }
}, },
o1oo1o: function (t, e, n) { o1oo1o: function (t, e, n) {
console.log(`vid = '${t}'`)
t && Vs[Vn] === p[ch(515)] && (e = e || 0, Fc(ch(503), e, t, n), ql(t), wt(t)); t && Vs[Vn] === p[ch(515)] && (e = e || 0, Fc(ch(503), e, t, n), ql(t), wt(t));
}, },
o1o1o1: function (t, e, n, r, a, o) { o1o1o1: function (t, e, n, r, a, o) {
...@@ -4284,7 +4268,6 @@ try { ...@@ -4284,7 +4268,6 @@ try {
} }
}, },
o11o1111: function (t, e) { o11o1111: function (t, e) {
console.log(`sid = '${t}'`)
if ("1" === t && e && (e = Number(e), !isNaN(e))) { if ("1" === t && e && (e = Number(e), !isNaN(e))) {
var a; var a;
if (uf() && 0 === e) { if (uf() && 0 === e) {
...@@ -4388,7 +4371,6 @@ try { ...@@ -4388,7 +4371,6 @@ try {
return !(!e || "object" !== l(e)) && (e.do || e.ob); return !(!e || "object" !== l(e)) && (e.do || e.ob);
} }
function Sh(t, e) { function Sh(t, e) {
console.log(t)
if (t) { if (t) {
for (var s, h = [], v = 0; v < t[ch(501)]; v++) { for (var s, h = [], v = 0; v < t[ch(501)]; v++) {
var d = t[v]; var d = t[v];
...@@ -4500,7 +4482,7 @@ try { ...@@ -4500,7 +4482,7 @@ try {
setTimeout(function () { setTimeout(function () {
var n = "no_fp"; var n = "no_fp";
try { try {
var r = $C_fCJ(860, 6); var r = $C_hJQ(860, 6);
if (r) { if (r) {
var a = Dh(r); var a = Dh(r);
if (n = "PX11982", a) { if (n = "PX11982", a) {
...@@ -4577,7 +4559,7 @@ try { ...@@ -4577,7 +4559,7 @@ try {
setTimeout(function () { setTimeout(function () {
var n = "no_fp"; var n = "no_fp";
try { try {
var r = $C_fCJ(650, 12); var r = $C_hJQ(650, 12);
if (r) { if (r) {
var a = Dh(r); var a = Dh(r);
if (n = "PX11982", a) { if (n = "PX11982", a) {
...@@ -4618,7 +4600,7 @@ try { ...@@ -4618,7 +4600,7 @@ try {
return u(t = {}, "PX11352", "no_fp"), u(t, "PX12292", "no_fp"), u(t, "PX11811", []), u(t, "PX11567", "no_fp"), u(t, "PX12032", "no_fp"), u(t, "PX11536", "no_fp"), u(t, "PX12149", ["no_fp"]), u(t, "PX12352", "no_fp"), u(t, "PX11455", "no_fp"), u(t, "PX11534", "no_fp"), t; return u(t = {}, "PX11352", "no_fp"), u(t, "PX12292", "no_fp"), u(t, "PX11811", []), u(t, "PX11567", "no_fp"), u(t, "PX12032", "no_fp"), u(t, "PX11536", "no_fp"), u(t, "PX12149", ["no_fp"]), u(t, "PX12352", "no_fp"), u(t, "PX11455", "no_fp"), u(t, "PX11534", "no_fp"), t;
}(); }();
try { try {
var a = $C_fCJ(); var a = $C_hJQ();
if (!a) return r["PX11811"].push("PX12423"), e(r); if (!a) return r["PX11811"].push("PX12423"), e(r);
var o = a.getContext("webgl") || a.getContext("experimental-webgl"); var o = a.getContext("webgl") || a.getContext("experimental-webgl");
if (!o) return r["PX11811"].push("PX11982"), e(r); if (!o) return r["PX11811"].push("PX11982"), e(r);
...@@ -4631,7 +4613,7 @@ try { ...@@ -4631,7 +4613,7 @@ try {
}, 1); }, 1);
}); });
} }
function $C_fCJ(t, e) { function $C_hJQ(t, e) {
var n = m.createElement("canvas"); var n = m.createElement("canvas");
return n.width = t || 2e3, n.height = e || 200, n.style.display = "inline", n; return n.width = t || 2e3, n.height = e || 200, n.style.display = "inline", n;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
const fs = require('fs');
const types = require("@babel/types");
const parser = require("@babel/parser");
const template = require("@babel/template").default;
const traverse = require("@babel/traverse").default;
const generator = require("@babel/generator").default;
//js混淆代码读取
process.argv.length > 2 ? encodeFile = process.argv[2] : encodeFile = "./main.js"; //默认的js文件
process.argv.length > 3 ? decodeFile = process.argv[3] : decodeFile = encodeFile.replace(".js", "") + "_ok.js";
//将源代码解析为AST
let sourceCode = fs.readFileSync(encodeFile, { encoding: "utf-8" });
let ast = parser.parse(sourceCode);
console.time("处理完毕,耗时");
const keyToLiteral = {
MemberExpression:
{
exit({ node }) {
const prop = node.property;
if (!node.computed && types.isIdentifier(prop)) {
node.property = types.StringLiteral(prop.name);
node.computed = true;
}
}
},
ObjectProperty:
{
exit({ node }) {
const key = node.key;
if (!node.computed && types.isIdentifier(key)) {
node.key = types.StringLiteral(key.name);
return;
}
if (node.computed && types.isStringLiteral(key)) {
node.computed = false;
}
}
},
}
traverse(ast, keyToLiteral);
const standardLoop =
{
"ForStatement|WhileStatement|ForInStatement|ForOfStatement"({ node }) {
if (!types.isBlockStatement(node.body)) {
node.body = types.BlockStatement([node.body]);
}
},
IfStatement(path) {
const consequent = path.get("consequent");
const alternate = path.get("alternate");
if (!consequent.isBlockStatement()) {
consequent.replaceWith(types.BlockStatement([consequent.node]));
}
if (alternate.node !== null && !alternate.isBlockStatement()) {
alternate.replaceWith(types.BlockStatement([alternate.node]));
}
},
}
traverse(ast, standardLoop);
const DeclaratorToDeclaration =
{
VariableDeclaration(path) {
let { parentPath, node } = path;
if (!parentPath.isBlock()) {
return;
}
let { declarations, kind } = node;
if (declarations.length == 1) {
return;
}
let newNodes = [];
for (const varNode of declarations) {
let newDeclartionNode = types.VariableDeclaration(kind, [varNode]);
newNodes.push(newDeclartionNode);
}
path.replaceWithMultiple(newNodes);
},
}
traverse(ast, DeclaratorToDeclaration);
function SequenceOfStatement(path) {
let { scope, parentPath, node } = path;
if (parentPath.parentPath.isLabeledStatement()) {//标签节点无法往前插入。
return;
}
let expressions = node.expressions;
if (parentPath.isReturnStatement({ "argument": node }) ||
parentPath.isThrowStatement({ "argument": node })) {
parentPath.node.argument = expressions.pop();
}
else if (parentPath.isIfStatement({ "test": node }) ||
parentPath.isWhileStatement({ "test": node })) {
parentPath.node.test = expressions.pop();
}
else if (parentPath.isForStatement({ "init": node })) {
parentPath.node.init = expressions.pop();
}
else if (parentPath.isForInStatement({ "right": node }) ||
parentPath.isForOfStatement({ "right": node })) {
parentPath.node.right = expressions.pop();
}
else if (parentPath.isSwitchStatement({ "discriminant": node })) {
parentPath.node.discriminant = expressions.pop();
}
else if (parentPath.isExpressionStatement({ "expression": node })) {
parentPath.node.expression = expressions.pop();
}
else {
return;
}
for (let expression of expressions) {
parentPath.insertBefore(types.ExpressionStatement(expression = expression));
}
}
function SequenceOfExpression(path) {
let { scope, parentPath, node, parent } = path;
let ancestorPath = parentPath.parentPath;
let expressions = node.expressions;
if (parentPath.isConditionalExpression({ "test": node }) &&
ancestorPath.isExpressionStatement({ "expression": parent })) {
parentPath.node.test = expressions.pop();
}
else if (parentPath.isVariableDeclarator({ "init": node }) &&
ancestorPath.parentPath.isBlock()) {
parentPath.node.init = expressions.pop();
}
else if (parentPath.isAssignmentExpression({ "right": node }) &&
ancestorPath.isExpressionStatement({ "expression": parent })) {
parentPath.node.right = expressions.pop();
}
else if ((parentPath.isCallExpression({ "callee": node }) ||
parentPath.isNewExpression({ "callee": node })) &&
ancestorPath.isExpressionStatement({ "expression": parent })) {
parentPath.node.callee = expressions.pop();
}
else {
return;
}
for (let expression of expressions) {
ancestorPath.insertBefore(types.ExpressionStatement(expression = expression));
}
}
const resolveSequence =
{
SequenceExpression:
{//对同一节点遍历多个方法
exit: [SequenceOfStatement, SequenceOfExpression]
}
}
traverse(ast, resolveSequence);
const removeDeadCode = {
"IfStatement|ConditionalExpression"(path) {
let { consequent, alternate } = path.node;
let testPath = path.get('test');
const evaluateTest = testPath.evaluateTruthy();
if (evaluateTest === true) {
if (types.isBlockStatement(consequent)) {
consequent = consequent.body;
}
path.replaceWithMultiple(consequent);
return;
}
if (evaluateTest === false) {
if (alternate != null) {
if (types.isBlockStatement(alternate)) {
alternate = alternate.body;
}
path.replaceWithMultiple(alternate);
}
else {
path.remove();
}
}
},
"LogicalExpression"(path) {
let { left, operator, right } = path.node;
let leftPath = path.get('left');
const evaluateLeft = leftPath.evaluateTruthy();
if ((operator == "||" && evaluateLeft == true) ||
(operator == "&&" && evaluateLeft == false)) {
path.replaceWith(left);
return;
}
if ((operator == "||" && evaluateLeft == false) ||
(operator == "&&" && evaluateLeft == true)) {
path.replaceWith(right);
}
},
"EmptyStatement|DebuggerStatement"(path) {
path.remove();
},
}
traverse(ast, removeDeadCode); //PS:因为有赋值语句和定义语句同时存在,因此该插件可能需要运行多次才能删除干净。
const simplifyLiteral = {
NumericLiteral({ node }) {
if (node.extra && /^0[obx]/i.test(node.extra.raw)) {
node.extra = undefined;
}
},
StringLiteral({ node }) {
if (node.extra && /\\[ux]/gi.test(node.extra.raw)) {
node.extra = undefined;
}
},
}
traverse(ast, simplifyLiteral);
function isNodePure(node, scope) {
if (types.isLiteral(node)) {
return true;
}
if (types.isUnaryExpression(node)) {
return isNodePure(node.argument, scope)
}
if (types.isIdentifier(node)) {//处理 var c = String;
if (scope && scope.isPure(node, true)) {
return true;
}
if (typeof this[node.name] != 'undefined') {
return true;
}
return false;
}
if (types.isMemberExpression(node)) {//处理 var d = String.fromCharCode;
let {object, property, computed} = node;
if (computed && !isNodePure(property, scope)) {
return false;
}
if (isNodePure(object, scope)) {
return true;
}
if (types.isIdentifier(object)) {
let name = object.name;
if (typeof this[name] != 'undefined' && name != 'window') {//注意object为window时,可能会还原出错
return true;
}
return false;
}
if (types.isMemberExpression(object)) {
return isNodePure(object, scope);
}
return false;
}
if (types.isBinary(node) && scope) {
return isNodePure(node.left, scope) && isNodePure(node.right, scope);
}
return false;
}
traverse(ast, {
VariableDeclaration(path) {
let {node} = path;
let {declarations} = node;
let res = [];
// console.log(path.parentPath.type)
if (types.isForStatement(path.parentPath)) return
if (!declarations || declarations.length == 1) return
for (let i = 0; i < declarations.length; i++) {
let declaration = declarations[i];
res.push(types.VariableDeclaration('var', [declaration]))
}
path.replaceWithMultiple(res)
path.skip()
}
})
const restoreVarDeclarator = {
VariableDeclarator(path) {
let scope = path.scope;
let {id, init} = path.node;
if (!init && (!types.isNumericLiteral(init) || !types.isStringLiteral(init))) return
if (id.name === 'c' && init.value === 0) return
if (!types.isIdentifier(id) || !isNodePure(init, scope)) {
return;
}
const binding = scope.getBinding(id.name);
try {
var {
constant, referencePaths, constantViolations
} = binding; //变量的定义一定会有binding.
} catch (e) {
return;
}
if (constantViolations.length > 1) {
return;
}
if (constant || constantViolations[0] == path) {
for (let referPath of referencePaths) {
// console.log(init.value)
// console.log(id.name, referPath.type, generator(referPath.container).code, generator(init).code)
referPath.replaceWith(init);
}
// console.log(path.toString())
path.remove();//没有被引用,或者替换完成,可直接删除
}
},
}
traverse(ast, restoreVarDeclarator)
//还原object
traverse(ast, {
VariableDeclaration(path) {
let {scope, node} = path;
let {declarations} = node;
if (!declarations) return
if (declarations.length !== 1) return;
let {id, init} = declarations[0]
if (!types.isObjectExpression(init)) return
let {properties} = init;
if (properties.length === 0) return;
for (let i = 0; i < properties.length; i++) {
let {key, value} = properties[i];
if (!types.isNumericLiteral(value)) return
}
let binding = scope.getBinding(id.name);
if (!binding) return
let {constant, referencePaths, constantViolations} = binding;
if (!constant) {//新版本的babel库,在循环里面的变量定义,默认非常量
if (constantViolations.length != 1 || constantViolations[0] != path) //旧版本屏蔽该行即可
{
return;
}
}
let newMap = new Map();
for (const property of properties) {
let {key, value} = property;
newMap.set(key.name, value);
}
let canBeRemoved = true;
for (const referPath of referencePaths) {
let {parentPath} = referPath;
if (!parentPath.isMemberExpression()) {
canBeRemoved = false;
return;
}
let AncestorPath = parentPath.parentPath;
if (AncestorPath.isAssignmentExpression({"left": parentPath.node})) {
canBeRemoved = false;
return;
}
if (AncestorPath.isUpdateExpression() && ['++', '--'].includes(AncestorPath.node.operator)) {
canBeRemoved = false;
return;
}
let curKey = parentPath.node.property.name;
if (!newMap.has(curKey)) {
canBeRemoved = false;
break;
}
parentPath.replaceWith(newMap.get(curKey));
}
canBeRemoved && path.remove();
newMap.clear();
}
})
console.timeEnd("处理完毕,耗时");
let { code } = generator(ast, opts = {
"compact": false, // 是否压缩代码
"comments": false, // 是否保留注释
"jsescOption": { "minimal": true }, //Unicode转义
});
fs.writeFile(decodeFile, code, (err) => { });
\ No newline at end of file
...@@ -76,20 +76,21 @@ class PxBypass(): ...@@ -76,20 +76,21 @@ class PxBypass():
self.seq = 0 self.seq = 0
self.rsc = 1 self.rsc = 1
self._step_1() self._step_1()
time.sleep(3) time.sleep(2)
self.inc() self.inc()
self.seq += 1 self.seq += 1
self._step_11() self._step_11()
self.inc() self.inc()
self._step_2(True) self._step_2(True)
time.sleep(3) time.sleep(2)
self._step_2(False) self._step_2(False)
time.sleep(4) time.sleep(2)
self.inc() self.inc()
if self.session.cookies.get_dict().get('_px2', None) == None:
self._step_3() self._step_3()
# time.sleep(3) # time.sleep(3)
self.inc() self.inc()
time.sleep(2)
self.__token() self.__token()
def _init(self): def _init(self):
......
...@@ -34,8 +34,7 @@ headers = { ...@@ -34,8 +34,7 @@ headers = {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
} }
# headers['cookie'] = '_gcl_au=1.1.2301953.1699261434; _pxvid=69227ff8-7c83-11ee-b901-6d18399e935f; pxcts=69228fdf-7c83-11ee-b901-9bd93d3fa2d4; _gid=GA1.2.1362314117.1699261446; _gat_UA-2678252-1=1; _ga_XXXX=GS1.1.1699261446.1.0.1699261446.0.0.0; _ga=GA1.1.701413066.1699261446; wisepops_visits=%5B%222023-11-06T09%3A03%3A53.587Z%22%5D; _uetsid=7073ea207c8311ee8ce8df31f5cea7b2; _uetvid=7073d2707c8311ee9a96cf34dd248886; _up=1.2.209110602.1699261446; _fbp=fb.1.1699261446991.905500895; _pin_unauth=dWlkPVpqVTVaV0UyT1RndE1HWXdNUzAwWkRaaUxXSXdZV0V0TkRFMllXSXlOelpsWW1Neg; _tt_enable_cookie=1; _ttp=zcp0bE93Om63tadHwNUajOAdZIL; wisepops=%7B%22csd%22%3A1%2C%22popups%22%3A%7B%22429858%22%3A%7B%22dc%22%3A1%2C%22d%22%3A1699261450572%7D%7D%2C%22sub%22%3A0%2C%22ucrn%22%3A76%2C%22cid%22%3A%2278471%22%2C%22v%22%3A4%2C%22bandit%22%3A%7B%22recos%22%3A%7B%7D%7D%7D; wisepops_session=%7B%22arrivalOnSite%22%3A%222023-11-06T09%3A03%3A53.587Z%22%2C%22mtime%22%3A1699261450572%2C%22pageviews%22%3A1%2C%22popups%22%3A%7B%22429858%22%3A0%7D%2C%22bars%22%3A%7B%7D%2C%22sticky%22%3A%7B%7D%2C%22countdowns%22%3A%7B%7D%2C%22src%22%3Anull%2C%22utm%22%3A%7B%7D%2C%22testIp%22%3Anull%7D; _ga_P2WLKWBNNW=GS1.1.1699261446.1.0.1699261476.30.0.0; _px2=eyJ1IjoiYjhhMzk2NzAtNzg2Ni0xMWVlLTk2NTUtNjNhNGYwNWNkNWQxIiwidiI6IjY5MjI3ZmY4LTdjODMtMTFlZS1iOTAxLTZkMTgzOTllOTM1ZiIsInQiOjE2OTkyNjE3ODgyMDEsImgiOiI4NzI2YTE4MmNjNTJlOTgxNGFiYTM4N2M5MjliOTk5MzkyODU0MjFhNWFmM2QxMWRlODIzYTA4ZTc2OGVmZjM3In0=' headers['cookie'] = '_gcl_au=1.1.2003685075.1699338031; pxcts=238eb403-7d36-11ee-a378-ab37025b0b7a; _pxvid=238ea67a-7d36-11ee-a378-9d364b2d49e5; _px2=eyJ1IjoiZjcxOTQwNzAtN2QzNS0xMWVlLTk0OWYtN2JhNmJmODcwZDllIiwidiI6IjIzOGVhNjdhLTdkMzYtMTFlZS1hMzc4LTlkMzY0YjJkNDllNSIsInQiOjYyMDIzMzg4MDAwNywiaCI6IjkzMTA1NTY3ZjdmNzdkNGIwNDBkY2U0NWFiYWVjMzFmNDIxNTJlYTRhNDU5NWU5YzExMmM4Y2M5NjZmZWRlMTQifQ==; _ga_XXXX=GS1.1.1699338199.1.0.1699338199.0.0.0; _uetsid=253ae0b07d3611ee9a7dbdbc64e1853a; _uetvid=253aff907d3611eebd7aebbb6d317592; _ga=GA1.2.1758561366.1699338200; _gid=GA1.2.1765445025.1699338200; _gat_UA-2678252-1=1; wisepops_visits=%5B%222023-11-07T06%3A23%3A17.104Z%22%5D; _fbp=fb.1.1699338201686.948301047; _pin_unauth=dWlkPU1EWXdPRGc0WVRFdE1HWTBNQzAwWTJOa0xUZzRORFV0TVRFM1pXSmlZalJtTUROag; _tt_enable_cookie=1; _ttp=cp0KTyDaHYsk4PR-QF-OiODmhPb; _up=1.2.1740726236.1699338204; wisepops=%7B%22csd%22%3A1%2C%22popups%22%3A%7B%22429858%22%3A%7B%22dc%22%3A1%2C%22d%22%3A1699338203960%7D%7D%2C%22sub%22%3A0%2C%22ucrn%22%3A56%2C%22cid%22%3A%2278471%22%2C%22v%22%3A4%2C%22bandit%22%3A%7B%22recos%22%3A%7B%7D%7D%7D; wisepops_session=%7B%22arrivalOnSite%22%3A%222023-11-07T06%3A23%3A17.104Z%22%2C%22mtime%22%3A1699338203961%2C%22pageviews%22%3A1%2C%22popups%22%3A%7B%22429858%22%3A0%7D%2C%22bars%22%3A%7B%7D%2C%22sticky%22%3A%7B%7D%2C%22countdowns%22%3A%7B%7D%2C%22src%22%3Anull%2C%22utm%22%3A%7B%7D%2C%22testIp%22%3Anull%7D; _ga_P2WLKWBNNW=GS1.1.1699338199.1.0.1699338205.54.0.0'
...@@ -60,13 +59,13 @@ params = { ...@@ -60,13 +59,13 @@ params = {
} }
# , cookies=cks # , cookies=cks
response = session.get(url, headers=headers, params=params response = session.get(url, headers=headers, params=params
,cookies= # ,cookies=
{ # {
'__RequestVerificationToken': '0SHGOe4f43b29zgZYnRxBA2lZFc3lpz5MX2SVH78MeDFef47qMH7AEW1h8voDC0XHPbFSESHfY5He-0rThkYeqR3roURvNYFmcvQQMHrUCu0rshn5lESDWj4SpbUHTY-GYMi-g2', # '__RequestVerificationToken': 'NSBimTJq2Tz3K7srdA06s9lx8FAyj-AaBR_mOIlyAFNsvRAlcJXNVR08UcrEteq0MIlB2uYSUu14781gmGWEwr_PBlkoM8-x0oEMAU7t2wJ5X4hJfiOXhNxRhJtoaSRj4wfTDw2',
'_pxhd': 'aaa1b3264fd4b5ab4a7c71f00a9600d67ec44b23d36363987e74803ee0761062:c788bec9-7c84-11ee-9b50-9c961d24240a', # '_pxhd': '0e5d5c0858a1eabddde069b91a9a519dd55a7ac230233b565bd124ab687e524f:ab75d635-7d31-11ee-bae4-3977f8e1984d',
'pxcts': 'c9c75df4-7c84-11ee-b6d3-f9c8cf98b5a0', # 'pxcts': 'adb0e6e6-7d31-11ee-a26c-f9b2b073737d',
'_pxvid': 'c788bec9-7c84-11ee-9b50-9c961d24240a', # '_pxvid': 'ab75d635-7d31-11ee-bae4-3977f8e1984d',
'_px2': 'eyJ1IjoiYzkxOTRkNzAtN2M4NC0xMWVlLWJlNTQtMDNiNTE4Y2Y5NGY1IiwidiI6ImM3ODhiZWM5LTdjODQtMTFlZS05YjUwLTljOTYxZDI0MjQwYSIsInQiOjYyMDIzMzg4MDAwNCwiaCI6IjFlNzYzMThjMGNlMDRjNjIyZTliNTUxMTdjNWFiN2M5MDU5YWQ3YTU1NmNkYjA2MTM3NjQyNjYxNDQ4Zjg4MzcifQ=='} # '_px2': 'eyJ1IjoiYWNmZmY4NzAtN2QzMS0xMWVlLWE1NDAtMTE1ZTY5YjY2MGM5IiwidiI6ImFiNzVkNjM1LTdkMzEtMTFlZS1iYWU0LTM5NzdmOGUxOTg0ZCIsInQiOjYyMDIzMzg4MDAwNCwiaCI6IjYxZGNlZGI2NDg3ZDFmNDQyZTdjNzdkMWVjMWYzNmJiNjM1YjRjMDkxODY4ZmFmNDdmNTRlY2JjYTE1N2Y2Y2IifQ=='}
, allow_redirects=False) , allow_redirects=False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment