Skip to content

无限debugger

网站备注
破解方法

逐步抽丝剥茧

js
setInterval(() => {
    (function (a) {
        return (function (a) {
            return (Function('Function(arguments[0]+"' + a + '")()'))
        })(a)
    })('bugger')('de', 0, 0, (0, 0))
}, 1000);
js
setInterval(() => {
        return (function (a) {
            return (Function('Function(arguments[0]+"' + a + '")()'))
        })('bugger')('de', 0, 0, (0, 0))
}, 1000);
js
setInterval(() => {
    return (Function('Function(arguments[0]+"' + 'bugger' + '")()'))('de', 0, 0, (0, 0))
}, 1000);
js
setInterval(() => {
    return (Function('Function(arguments[0]+"debugger")()'))('')
}, 1000);
js
setInterval(() => {
    return (Function('Function("debugger")()'))()
}, 1000);
js
setInterval(() => {
    eval('Function("debugger")()')
}, 1000);
js
setInterval(() => {
    Function("debugger")()
}, 1000);
js
setInterval(() => {
    Function('debugger')
}, 1000);

warning

错误原因: 在JavaScript中,Function是一个构造函数,用于创建新的函数对象。当你尝试使用Function构造函数时,你需要传递一个字符串作为参数,该字符串定义了函数的代码。然而,在你的代码中,你传递了一个变量debugger,这是一个关键字,而不是一个字符串,因此导致了错误。

修复建议: 如果你想创建一个函数,该函数在调用时执行debugger语句,你应该将debugger放在一个字符串中,然后传递给Function构造函数。以下是修复后的代码:

html
<script>
    setInterval(() => {
        Function('debugger')();
    }, 1000);
</script>

代码位置:index.html

最后总结就是Function后边括号内为函数体,如:

js
Function(console.log(1111))()