首页 > 解决方案 > 启动一个外部 JS 引擎,从浏览器转发数据

问题描述

我想分析一个大而混乱的 JS 代码。代码被严重混淆,甚至像JStillery这样的工具也无法使用它。

我想以某种方式构建一个开放的 JS 解释器,在浏览器外部运行它并以更传统的方式进行调试,如有必要,在解释器内部应用补丁。

不幸的是,代码使用 DOM,没有浏览器就无法执行。

问题是:是否有任何已知技术可以采用任何外部引擎(例如 V7、V8、DukTape、JerryScript、MuJS、quad-wheel、QuickJS、tiny-js ......)并在其中运行包含调用的代码DOM 和其他浏览器部分?

标签: javascriptreverse-engineeringv8deobfuscationmalware-detection

解决方案


There are pure-JavaScript implementations of the DOM, such as https://github.com/jsdom/jsdom. Not sure how useful that is for your use case, but it does address your primary question: it allows you to run JavaScript that assumes a browser environment outside the browser environment.

I believe jsdom is fairly accurate in its implementation; there are other implementations out there that are more mock-like. Either way, there are probably some remaining differences, so heavily obfuscated code may well include mechanisms to detect emulated environments...


推荐阅读