如何调试反 debug 的网页?

35 天前
 zzm88104

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)
            }
        }
        )()
    }
    
1000 次点击
所在节点    程序员
15 条回复
Meursau1T
35 天前
有个想法,没试过,是不是可以先抓包得到这个 js 文件,然后改写接口返回值,把这行代码干掉
icedx
35 天前
看起来是在 console 洗屏的?
happyeveryday
35 天前
先拉下来,chrome devtools network 覆盖此文件
LuckyLauncher
35 天前
1. 访问网站,打开 console ,进入 debugger
2. 通过 debugger 右侧面板找到调用栈的上一层,进入
3. 右键代码面板,选择 override content ,选中 setInterval 那段函数,注释掉并保存
4. 刷新页面,进行调试
jpyl0423
35 天前

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

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

https://github.com/Sec-ant/a2d2-firefox
CC11001100
31 天前
mzl980425
30 天前
装个油猴插件,把 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);
}
}
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1064944

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX