Chrome 禁止调试

noDebugger.js

let onDebug = function () {
    document.write('检测到非法调试!请你停止调试后刷新本页面!');
};

setInterval(function () {
    let st, et;
    st = new Date().getTime();
    et = new Date().getTime();
    if ((et - st) > 1000) {
         onDebug();
    }
}, 1000);

document.onkeydown = document.onkeyup = document.onkeypress = function (event) {
    const e = event || window.event || arguments.callee.caller.arguments[0];

    if (e && e.keyCode == 123) {
         onDebug();
    }
};

let div = document.createElement('div');
Object.defineProperty(div, "id", {
    get: () => {
        clearInterval(loop);
        onDebug();
    }
});
let loop = setInterval(() => {
    console.log(div);
    console.clear();
});
(() => {
    function block() {
        setInterval(() => {
            debugger;
        }, 50);
    }
    try {
        block();
    } catch (err) {}
})();

禁止断点

添加条件断点 logpoint 为 false

添加忽略 add script ignore list 规则

(() => {
    function block() {
        setInterval(() => {debugger;}, 50);
    }
    try {
        block();
    } catch (err) {}
})();

<aside> 💡 将setInterval(() => {debugger;}, 50); 写在一行中,你即使通过添加logpoint 为 false ,也没有用了。

</aside>

(() => {
    function block() {
        setInterval(() => {
            Function("debugger")();
        }, 50);
    }
    try {
        block();
    } catch (err) {}
})();

<aside> 💡 Function("debugger")() Function 构造器生成的 debugger 会在每一次执行时开启一个临时 js 文件

</aside>

  • 混淆之后的代码
eval(function(c,g,a,b,d,e){d=String;if(!"".replace(/^/,String)){for(;a--;)e[a]=b[a]||a;b=[function(f){return e[f]}];d=function(){return"\\\\w+"};a=1}for(;a--;)b[a]&&(c=c.replace(new RegExp("\\\\b"+d(a)+"\\\\b","g"),b[a]));return c}('(()=>{1 0(){2(()=>{3("4")()},5)}6{0()}7(8){}})();',9,9,"block function setInterval Function debugger 50 try catch err".split(" "),0,{}));

  • Function("debugger").call() 改成 (function(){return false;})["constructor"]("debugger")["call"](); 更不难识别代码
(() => {
    function block() {
        if (
            window.outerHeight - window.innerHeight > 200 ||
            window.outerWidth - window.innerWidth > 200
        ) {
            document.body.innerHTML =
                "检测到非法调试,请关闭后刷新重试!";
        }
        setInterval(() => {
            (function () {
                return false;
            }
                ["constructor"]("debugger")
                ["call"]());
        }, 50);
    }
    try {
        block();
    } catch (err) {}
})();

Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.icon-default.png?t=M3K6https://serious-lose.notion.site/Chrome-noDebugger-js-17ff1e02847944ff9f852f8b4e12f495 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值