traverse(ast, {VariableDeclarator: {exit: [merge_obj]},});
还原前:
var _0xb28de8 = {};
_0xb28de8["abcd"] = function(_0x22293f, _0x5a165e) {
return _0x22293f == _0x5a165e;
};
_0xb28de8.dbca = function(_0xfbac1e, _0x23462f, _0x556555) {
return _0xfbac1e(_0x23462f, _0x556555);
};
_0xb28de8.aaa = function(_0x57e640) {
return _0x57e640();
};
_0xb28de8["bbb"] = "eee";
var _0x15e145 = _0xb28de8;
还原后:
var _0xb28de8 = {
"abcd": function(_0x22293f, _0x5a165e) {
return _0x22293f == _0x5a165e;
},
"dbca": function(_0xfbac1e, _0x23462f, _0x556555) {
return _0xfbac1e(_0x23462f, _0x556555);
},
"aaa": function(_0x57e640) {
return _0x57e640();
},
"bbb": "eee"
};
traverse(ast, {VariableDeclarator: {exit: [callToStr]},});
还原前:
var _0xb28de8 = {
"abcd": function(_0x22293f, _0x5a165e) {
return _0x22293f == _0x5a165e;
},
"dbca": function(_0xfbac1e, _0x23462f, _0x556555) {
return _0xfbac1e(_0x23462f, _0x556555);
},
"aaa": function(_0x57e640) {
return _0x57e640();
},
"bbb": "eee"
};
var aa = _0xb28de8("abcd")(123, 456);
var bb = _0xb28de8("dbca")(bcd, 11, 22);
var cc = _0xb28de8("aaa")(dcb);
var dd = _0xb28de8("bbb");
还原后:
var aa = 123 == 456;
var bb = bcd(11, 22);
var cc = dcb();
var dd = "eee";
traverse(ast, {ExpressionStatement: convParam,});
还原前:
(function(_0xb28de8) {
_0xb28de8.bbb = ccc;
}(window))
还原后:
(function() {
window.bbb = ccc;
}())
traverse(ast, {WhileStatement: {exit: [replaceWhile]},});
还原前:
var _0xb28de8 = "3|1|2".spilt("|"),
_0x8de8b2 = 0;
while(true) {
switch(_0xb28de8[_0x8de8b2++]) {
case '1':
var a = 1;
continue;
case '2':
var b = 3;
continue;
case '3':
var c = 0;
continue;
}
break;
}
还原后:
var c = 0;
var a = 1;
var b = 3;
traverse(ast, {ConditionalExpression: trans_condition,});
还原前:
a = m ? 11 : 22;
还原后:
m ? a = 11 : a = 22;
traverse(ast, {ExpressionStatement: remove_comma,});
还原前:
a = 1, b = ddd(), c = null;
还原后:
a = 1;
b = ddd();
c = null;
traverse(ast, {ExpressionStatement: ConditionToIf,});
还原前:
m ? a = 11 : a = 22;
还原后:
if (m) {
a = 11;
} else {
a = 22;
}
traverse(ast, {VariableDeclaration: remove_var_comma,});
还原前:
var a = 1, b = ddd(), c = null;
还原后:
var a = 1;
var b = ddd();
var c = null;
对于var a,b,c,d,e,f,g...
这种代码,还原后可能就比较丑...变成如下:
var a;
var b;
var c;
var d;
var e;
var f;
var g;
······
这一项必须配合【8】去除var定义的逗号表达式使用
traverse(ast, {VariableDeclarator: conditionVarToIf,});
还原前:
var a = m ? 11 : 22;
还原后:
if (m) {
var a = 11;
} else {
var a = 22;
}
慎用!可能涉及作用域的问题,或其它逻辑错误。
traverse(ast, {
"UnaryExpression|BinaryExpression|ConditionalExpression|CallExpression": eval_constant,
});
还原前:
var a = !![];
var b = "abc" == "bcd";
var c = 1 << 3 | 2;
var d = parseInt("5" + "0")
还原后:
var a = true;
var b = false;
var c = 10;
var d = 50;
慎用!aa[']']['v']()转成aa.].v()后代码会出错。
traverse(ast, {MemberExpression: formatMember,});
还原前:
var a = aa['bb']['v']();
还原后:
var a = aa.bb.v();
慎用!可能涉及到作用域的问题。
traverse(ast, {ExpressionStatement: delConvParam,});
还原前:
(function() {
b = 123;
c = 456;
}())
还原后:
b = 123;
c = 456;