js反混淆
var esprima = require('esprima')
var escodegen = require('escodegen')
content = "function _0x355d23(_0x450614) {\
if (('' + _0x450614 / _0x450614)[_0x55f3('0x1c', '\x56\x32\x4b\x45')] !== 0x1 || _0x450614 % 0x14 === 0x0) {\
(function() {}\
[_0x55f3('0x1d', '\x43\x4e\x55\x59')]((undefined + '')[0x2] + (!![] + '')[0x3] + ([][_0x55f3('0x1e', '\x77\x38\x50\x52')]() + '')[0x2] + (undefined + '')[0x0] + (![] + [0x0] + String)[0x14] + (![] + [0x0] + String)[0x14] + (!![] + '')[0x3] + (!![] + '')[0x1])());\
} else {\
(function() {}\
['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']((undefined + '')[0x2] + (!![] + '')[0x3] + ([][_0x55f3('0x1f', '\x4c\x24\x28\x44')]() + '')[0x2] + (undefined + '')[0x0] + (![] + [0x0] + String)[0x14] + (![] + [0x0] + String)[0x14] + (!![] + '')[0x3] + (!![] + '')[0x1])());\
}\
_0x355d23(++_0x450614);\
}"
function formatJS(){ //context是要格式的js
var ast=esprima.parseScript(content.toString());
var ast_to_json=JSON.stringify(ast);
console.log(ast_to_json);
var ast1=JSON.parse(ast_to_json);
var code=escodegen.generate(ast1);
console.log(code);
return code;
}
formatJS()
在线生成AST语法树
http://esprima.org/demo/parse.html