作家
登录

带你了解JavaScript反调试技巧

作者: 来源: 2018-03-12 10:55:06 阅读 我要评论

 
  •     }  
  •  
  • document.createElement= new Proxy(document.createElement, handler) // Create our proxy object withour hook ready to intercept  
  • document.createElement('div'); 
  • 接下来,我们可以在控制台中记录下相干参数和信息:

    1. VM64:3 Intercepted a call to createElement with args: div 

    我们可以应用这些信息并经由过程拦截某些特定函数来底时菌码,然则本文的重要目标是为了介绍反调试技巧,那么我们若何检测“对方”是否应用了代劳对象呢?其拭魅这就是一场“猫抓老鼠”的游戏,比如说,我们可以应用雷同的代码段,然后测验测验调用toString办法并捕获异常:

    1. //Call a "virgin" createElement:  
    2. try {  
    3.     document.createElement.toString();  
    4. }catch(e){  
    5.     console.log("I saw your proxy!");  

    五、隐式流完全性控制

    信息如下:

    1. "function createElement() { [native code] }" 

    然则当我们应用了代劳之后:

    1. //Then apply the hook  
    2. consthandler = {  
    3.     apply: function (target, thisArg, args){  
    4.         console.log("Intercepted a call tocreateElement with args: " + args);  
    5.         return target.apply(thisArg, args)  
    6.     }  
    7.  
    8. document.createElement= new Proxy(document.createElement, handler);  
    9. //Callour not-so-virgin-after-that-party createElement  
    10. try {  
    11.     document.createElement.toString();  
    12. }catch(e) {  
    13.     console.log("I saw your proxy!"); 

    没错,我们确切可以检测到代劳:

    4. 流完全性控制;

    我们还可以添加toString办法:

    1. const handler = {  
    2.     apply: function (target, thisArg, args){  
    3.         console.log("Intercepted a call tocreateElement with args: " + args);  
    4.         return target.apply(thisArg, args) 

        推荐阅读

        令程序员们夜不能寐的“噩梦”除了改需求,还有这些…...

      沙龙晃荡 | 3月31日 京东、微博拭魅战专家与你合营商量容器技巧实践! 有那么一群人他们生活在那山的那边海的那边,他们活泼又聪慧~他们油滑又聪颖~他们自由安闲的生活在那彩色的代率攀里~>>>详细阅读


      本文标题:带你了解JavaScript反调试技巧

      地址:http://www.17bianji.com/lsqh/40591.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)