🪩

代码工具箱

Created
Mar 18, 2024 07:57 AM
Tags
notion image
 

数据库封装库

 

Hook代码库

去除无限debugger
let _constructor = constructor; Function.prototype.constructor = function(s) { if (s == "debugger") { console.log(s); return null; } return _constructor(s); } //去除无限debugger Function.prototype.__constructor_back = Function.prototype.constructor ; Function.prototype.constructor = function() { if(arguments && typeof arguments[0]==='string'){ //alert("new function: "+ arguments[0]); if( "debugger" === arguments[0]){ // arguments[0]="consoLe.Log(\"anti debugger\");"; //arguments[0]=";"; return } } return Function.prototype.__constructor_back.apply(this,arguments); }; let _Function = Function; Function = function(s) { if (s == "debugger") { console.log(s); return null; } return _Function(s); }
 
// hook Function 原型构造函数, 修改debugger (转自csdn-步客) Function.prototype.temp_constructor= Function.prototype.constructor; Function.prototype.constructor=function(){ if (arguments && typeof arguments[0]==="string"){ if (arguments[0]==="debugger") return "" } return Function.prototype.temp_constructor.apply(this, arguments); }; // hook setInterval 定时器函数 替换debugger _setInterval = setInterval setInterval = function setInterval(code, time){ console.log(code, time) code = code.toString().replace(/debugger/, "").replace(/function ()/, "function xxx") return _setInterval(new Function(code) , time) } _setTimeout = setTimeout setTimeout = function setTimeout(code, time){ console.log(code, time) code = code.toString().replace(/debugger/, "").replace(/function ()/, "function xxx") return _setTimeout(new Function(code), time) }