今天又看到一前端禁止調試的手段,分享下

上篇回顧:簡單兩步 ~ 繞過 "Paused in debugger" javascript

點評:此次屏蔽和上次不太同樣,是經過正常函數來實現的html

PS:這個網站的屏蔽方式在360瀏覽器下生效,谷歌瀏覽器並無生效(me:版本 70.0.3538.110)
java

先演示下效果:
chrome

貼下提煉出來的demo:瀏覽器

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        // 反調試函數,參數:開關,執行代碼
        function endebug(off, code) {
            if (!off) {
                !function (e) {
                    function n(e) {
                        function n() {
                            return u
                        }
                        function o() {
                            window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized ? t("on") : (a = "off", console.log(d), console.clear(), t(a))
                        }
                        function t(e) {
                            u !== e && (u = e, "function" == typeof c.onchange && c.onchange(e))
                        }
                        function r() {
                            l || (l = !0, window.removeEventListener("resize", o), clearInterval(f))
                        }
                        "function" == typeof e && (e = {
                            onchange: e
                        });
                        var i = (e = e || {}).delay || 500,
                            c = {};
                        c.onchange = e.onchange;
                        var a, d = new Image;
                        d.__defineGetter__("id", function () {
                            a = "on"
                        });
                        var u = "unknown";
                        c.getStatus = n;
                        var f = setInterval(o, i);
                        window.addEventListener("resize", o);
                        var l;
                        return c.free = r, c
                    }
                    var o = o || {};
                    o.create = n, "function" == typeof define ? (define.amd || define.cmd) && define(function () {
                        return o
                    }) : "undefined" != typeof module && module.exports ? module.exports = o : window.jdetects = o
                }(), jdetects.create(function (e) {
                    var a = 0;
                    var n = setInterval(function () {
                        if ("on" == e) {
                            setTimeout(function () {
                                if (a == 0) {
                                    a = 1;
                                    setTimeout(code);
                                }
                            }, 200)
                        }
                    }, 100)
                })
            }
        }
    </script>
</head>
<body>
    <h1>你能夠看見嗎?</h1>
    <script type="text/javascript">
        endebug(false, function () {
            // 非法調試執行的代碼(不要使用控制檯輸出的提醒)
            document.write("檢測到非法調試,請關閉後刷新重試!");
        });
    </script>
</body>
</html>

PS:快速定位可使用監聽功能:(解決:屏蔽JS)
函數

相關文章
相關標籤/搜索