简体   繁体   English

包装JavaScript文件以拦截传出的请求

[英]Wrap JavaScript file in order to intercept outgoing requests

I have got a JavaScript file (extremely obfuscated) on my site that handles videos. 我的网站上有一个处理视频的JavaScript文件 (极其混淆)。

And this JavaScript file requests another JavaScript file and that JavaScript file calls another and so on.... 并且此JavaScript文件请求另一个JavaScript文件,并且该JavaScript文件调用另一个,依此类推。

Can I wrap the first JavaScript file (maybe sandbox it) so any request for external resource will be redirect through my proxy? 我可以包装第一个JavaScript文件(也许是沙箱),以便对外部资源的任何请求都可以通过代理重定向吗?

I mean if the JavaScript file call: 我的意思是,如果JavaScript文件调用:

http://example.com/another.js http://example.com/another.js

After I will intercept the call it will be: 在我拦截呼叫之后,它将是:

http://myproxy.com/?url=http://example.com/another.js . http://myproxy.com/?url=http://example.com/another.js

这取决于js文件如何调用下一个文件,方法是使用xhr请求或将脚本标签添加到dom ...?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM