V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zzm88104
V2EX  ›  程序员

如何调试反 debug 的网页?

  •  
  •   zzm88104 · 33 天前 · 999 次点击
    这是一个创建于 33 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://ftty.ydmap.cn/booking/schedule/101332?salesItemId=100341

    他通过这段代码不停生成 debugger 的代码 有什么办法可以阻止他,然后调试我自己打的断点

        29556: ()=>{
            (()=>{
                if ("undefined" !== typeof window && !window.location.port)
                    try {
                        t()
                    } catch (n) {}
                function e(e, t) {
                    return Math.floor(Math.random() * (t - e)) + e
                }
                function t() {
                    setInterval((()=>{
                        const t = e(0, 100);
                        (function() {
                            return !1
                        }
                        )["constructor"](`\n          // 🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫 禁止调试 🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫\n          ${Array.from({
                            length: t
                        }).fill("\n          ").join("")}\n          debugger\n        `)["call"]()
                    }
                    ), 50)
                }
            }
            )()
        }
        
    
    15 条回复    2024-08-19 19:07:38 +08:00
    Meursau1T
        1
    Meursau1T  
       33 天前
    有个想法,没试过,是不是可以先抓包得到这个 js 文件,然后改写接口返回值,把这行代码干掉
    icedx
        2
    icedx  
       33 天前
    看起来是在 console 洗屏的?
    happyeveryday
        3
    happyeveryday  
       33 天前
    先拉下来,chrome devtools network 覆盖此文件
    LuckyLauncher
        4
    LuckyLauncher  
       33 天前
    1. 访问网站,打开 console ,进入 debugger
    2. 通过 debugger 右侧面板找到调用栈的上一层,进入
    3. 右键代码面板,选择 override content ,选中 setInterval 那段函数,注释掉并保存
    4. 刷新页面,进行调试
    jpyl0423
        5
    jpyl0423  
       33 天前

    LuckyLauncher
        6
    LuckyLauncher  
       33 天前
    所以我说,搞这种东西就自己玩玩,实际上没啥用
    xiangyuecn
        7
    xiangyuecn  
       33 天前
    Function.prototype.call=()=>{ console.log("call")}
    500
        8
    500  
       33 天前
    控制台执行:

    var handler = window.setInterval(() => {}, 1000);
    for(let i = 1; i <= handler; i++)
    {
    clearInterval(i);
    }
    weixiangzhe
        9
    weixiangzhe  
       33 天前
    开个代理工具替换这个 js
    hafuhafu
        10
    hafuhafu  
       33 天前
    直接 F12 停用断点就行了..
    catamaran
        11
    catamaran  
       32 天前
    catamaran
        12
    catamaran  
       32 天前
    @catamaran 抱歉,楼主还要 debug 自己的断点,可我不知道怎么删除自己的回复
    lisongeee
        13
    lisongeee  
       32 天前
    这有一个方案,通过重新编译浏览器,将 debug 更换为其他的 关键字 来禁用目标网页的 反调试 同时不影响自己的调试

    https://github.com/Sec-ant/a2d2-firefox
    CC11001100
        14
    CC11001100  
       29 天前
    mzl980425
        15
    mzl980425  
       28 天前
    装个油猴插件,把 setInterval 函数给重写掉
    ```javascript
    // ==UserScript==
    // @name New script ydmap.cn
    // @namespace Violentmonkey Scripts
    // @match https://ftty.ydmap.cn/booking/schedule/101332*
    // @grant none
    // @version 1.0
    // @author -
    // @description 2024/8/19 19:05:07
    // ==/UserScript==

    window._setInterval = window.setInterval;
    window.setInterval = (fn, delay) => {
    if (fn.toString().includes('debugger')) {
    return;
    }
    else {
    return window._setInterval(fn, delay);
    }
    }
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   945 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 19:34 · PVG 03:34 · LAX 12:34 · JFK 15:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.