mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-08-02 16:10:41 +08:00
add
This commit is contained in:
parent
e82aec626c
commit
1a6c7fb0cb
@ -32855,9 +32855,10 @@ function pas_ob_encfunc(ast){
|
|||||||
traverse(ast, {FunctionDeclaration: findobsortlist})
|
traverse(ast, {FunctionDeclaration: findobsortlist})
|
||||||
traverse(ast, {FunctionDeclaration: findobfunc})
|
traverse(ast, {FunctionDeclaration: findobfunc})
|
||||||
eval(obfuncstr.join(';'))
|
eval(obfuncstr.join(';'))
|
||||||
|
|
||||||
// 收集必要的函数进行批量还原
|
// 收集必要的函数进行批量还原
|
||||||
var collects = []
|
var collects = []
|
||||||
var collect_names = []
|
var collect_names = [obdecname]
|
||||||
var collect_removes = []
|
var collect_removes = []
|
||||||
function judge(path){
|
function judge(path){
|
||||||
return path.node.body.body.length == 1
|
return path.node.body.body.length == 1
|
||||||
@ -32876,7 +32877,20 @@ function pas_ob_encfunc(ast){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var collect_removes_var = []
|
||||||
|
function collect_alldecvars(path){
|
||||||
|
var left = path.node.id
|
||||||
|
var right = path.node.init
|
||||||
|
if (right && right.type == 'Identifier' && collect_names.indexOf(right.name) != -1){
|
||||||
|
var t = 'var ' + generator(path.node, {minified:true}).code
|
||||||
|
if (collects.indexOf(t) == -1){
|
||||||
|
collects.push(t)
|
||||||
|
collect_names.push(left.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
traverse(ast, {FunctionDeclaration: collect_alldecfunc})
|
traverse(ast, {FunctionDeclaration: collect_alldecfunc})
|
||||||
|
traverse(ast, {VariableDeclarator: collect_alldecvars})
|
||||||
eval(collects.join(';'))
|
eval(collects.join(';'))
|
||||||
function parse_values(path){
|
function parse_values(path){
|
||||||
var name = path.node.callee.name
|
var name = path.node.callee.name
|
||||||
@ -32889,12 +32903,19 @@ function pas_ob_encfunc(ast){
|
|||||||
}
|
}
|
||||||
traverse(ast, {CallExpression: parse_values})
|
traverse(ast, {CallExpression: parse_values})
|
||||||
function collect_removefunc(path){
|
function collect_removefunc(path){
|
||||||
if (judge(path) && collect_removes.indexOf(path.node.id.name) != -1
|
if (judge(path) && collect_removes.indexOf(path.node.id.name) != -1){
|
||||||
){
|
path.remove()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function collect_removevars(path){
|
||||||
|
var left = path.node.id
|
||||||
|
var right = path.node.init
|
||||||
|
if (right && right.type == 'Identifier' && collect_names.indexOf(right.name) != -1){
|
||||||
path.remove()
|
path.remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
traverse(ast, {FunctionDeclaration: collect_removefunc})
|
traverse(ast, {FunctionDeclaration: collect_removefunc})
|
||||||
|
traverse(ast, {VariableDeclarator: collect_removevars})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -32910,6 +32931,14 @@ function pas_ob_encfunc(ast){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -32948,6 +32977,7 @@ function muti_process_sojsondefusion(jscode){
|
|||||||
traverse(ast, {VariableDeclarator: {exit: MergeObj},}); // 可能出问题(不可通用)
|
traverse(ast, {VariableDeclarator: {exit: MergeObj},}); // 可能出问题(不可通用)
|
||||||
traverse(ast, {BinaryExpression: {exit: calcBinary}})
|
traverse(ast, {BinaryExpression: {exit: calcBinary}})
|
||||||
traverse(ast, {VariableDeclarator: {exit: CallToStr},}); // 可能出问题(不可通用)
|
traverse(ast, {VariableDeclarator: {exit: CallToStr},}); // 可能出问题(不可通用)
|
||||||
|
traverse(ast, {IfStatement: ClearDeadCode}); // 清理死代码,这里不清理可能会导致错误
|
||||||
traverse(ast, {WhileStatement: {exit: [ReplaceWhile]},}); // 反控制流平坦化
|
traverse(ast, {WhileStatement: {exit: [ReplaceWhile]},}); // 反控制流平坦化
|
||||||
|
|
||||||
// 通用解混淆部分
|
// 通用解混淆部分
|
||||||
@ -32975,6 +33005,7 @@ function muti_process_obdefusion(jscode){
|
|||||||
traverse(ast, {VariableDeclarator: {exit: MergeObj},}); // 可能出问题(不可通用)
|
traverse(ast, {VariableDeclarator: {exit: MergeObj},}); // 可能出问题(不可通用)
|
||||||
traverse(ast, {BinaryExpression: {exit: calcBinary}})
|
traverse(ast, {BinaryExpression: {exit: calcBinary}})
|
||||||
traverse(ast, {VariableDeclarator: {exit: CallToStr},}); // 可能出问题(不可通用)
|
traverse(ast, {VariableDeclarator: {exit: CallToStr},}); // 可能出问题(不可通用)
|
||||||
|
traverse(ast, {IfStatement: ClearDeadCode}); // 清理死代码,这里不清理可能会导致错误
|
||||||
traverse(ast, {WhileStatement: {exit: [ReplaceWhile]},}); // 反控制流平坦化
|
traverse(ast, {WhileStatement: {exit: [ReplaceWhile]},}); // 反控制流平坦化
|
||||||
|
|
||||||
// 通用解混淆部分
|
// 通用解混淆部分
|
||||||
|
Loading…
x
Reference in New Issue
Block a user