Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Anti Anti-debugger
  3. // @namespace    http://tampermonkey.net/
  4. // @version      1
  5. // @description  Stops most anti debugging implementations by JavaScript obfuscaters
  6. // @author       ww
  7. // @match        http://www.infernoplus.com/royale/
  8. // @grant        unsafeWindow
  9. // @run-at       document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13.     var _constructor = unsafeWindow.Function.prototype.constructor;
  14.     // Hook Function.prototype.constructor
  15.     unsafeWindow.Function.prototype.constructor = function() {
  16.         var fnContent = arguments[0];
  17.         if (fnContent) {
  18.             if (fnContent.includes('debugger')) { // An anti-debugger is attempting to stop debugging
  19.                 var caller = Function.prototype.constructor.caller; // Non-standard hack to get the function caller
  20.                 var callerContent = caller.toString();
  21.                 if (callerContent.includes(/\bdebugger\b/gi)) { // Eliminate all debugger statements from the caller, if any
  22.                     callerContent = callerContent.replace(/\bdebugger\b/gi, ''); // Remove all debugger expressions
  23.                     eval('caller = ' + callerContent); // Replace the function
  24.                 }
  25.                 return (function () {});
  26.             }
  27.         }
  28.         // Execute the normal function constructor if nothing unusual is going on
  29.         return _constructor.apply(this, arguments);
  30.     };
  31. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement