javascript - 启动一个外部 JS 引擎,从浏览器转发数据
问题描述
我想分析一个大而混乱的 JS 代码。代码被严重混淆,甚至像JStillery这样的工具也无法使用它。
我想以某种方式构建一个开放的 JS 解释器,在浏览器外部运行它并以更传统的方式进行调试,如有必要,在解释器内部应用补丁。
不幸的是,代码使用 DOM,没有浏览器就无法执行。
问题是:是否有任何已知技术可以采用任何外部引擎(例如 V7、V8、DukTape、JerryScript、MuJS、quad-wheel、QuickJS、tiny-js ......)并在其中运行包含调用的代码DOM 和其他浏览器部分?
解决方案
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...
推荐阅读
- javascript - window.onscroll css transformY 过渡闪烁
- android - onClick RecyclerView.ViewHolder 不起作用
- reactjs - react-simple-maps 显示较小且未居中的地图
- r - R中样本数据外的均方预测误差(MSPE)
- swift - URLRequest.addValue() 导致 SwiftUI 日历恢复日期
- java - 在edittext中检测语言
- javascript - 使用纯Javascript根据列类名对表行进行排序
- javascript - 如何在 Node.js 中的 MongoDB 数据库上实现类似 git 的“分支”
- php - 如何使用 Mollie API 检索 Bancontact 的 QR 码?
- api - 从 Blazor WASM 获取到 dotnet franework Web API 的请求没有响应