接下来,我们可以在控制台中记录下相干参数和信息:
- VM64:3 Intercepted a call to createElement with args: div
我们可以应用这些信息并经由过程拦截某些特定函数来底时菌码,然则本文的重要目标是为了介绍反调试技巧,那么我们若何检测“对方”是否应用了代劳对象呢?其拭魅这就是一场“猫抓老鼠”的游戏,比如说,我们可以应用雷同的代码段,然后测验测验调用toString办法并捕获异常:
- //Call a "virgin" createElement:
- try {
- document.createElement.toString();
- }catch(e){
- console.log("I saw your proxy!");
- }
五、隐式流完全性控制
信息如下:
- "function createElement() { [native code] }"
然则当我们应用了代劳之后:
- //Then apply the hook
- consthandler = {
- apply: function (target, thisArg, args){
- console.log("Intercepted a call tocreateElement with args: " + args);
- return target.apply(thisArg, args)
- }
- }
- document.createElement= new Proxy(document.createElement, handler);
- //Callour not-so-virgin-after-that-party createElement
- try {
- document.createElement.toString();
- }catch(e) {
- console.log("I saw your proxy!");
- }
没错,我们确切可以检测到代劳:
4. 流完全性控制;
我们还可以添加toString办法:
- const handler = {
- apply: function (target, thisArg, args){
- console.log("Intercepted a call tocreateElement with args: " + args);
- return target.apply(thisArg, args)
推荐阅读
沙龙晃荡 | 3月31日 京东、微博拭魅战专家与你合营商量容器技巧实践! 有那么一群人他们生活在那山的那边海的那边,他们活泼又聪慧~他们油滑又聪颖~他们自由安闲的生活在那彩色的代率攀里~>>>详细阅读
本文标题:带你了解JavaScript反调试技巧
地址:http://www.17bianji.com/lsqh/40591.html
1/2 1