Anti Anti-debugger

Stops most anti debugging implementations by JavaScript obfuscaters, and stops the console logs from being automatically cleared.

目前为 2024-02-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Anti Anti-debugger
  3. // @namespace https://greasyfork.org/en/users/670188-hacker09?sort=daily_installs
  4. // @version 2
  5. // @description Stops most anti debugging implementations by JavaScript obfuscaters, and stops the console logs from being automatically cleared.
  6. // @author hacker09
  7. // @include *
  8. // @grant unsafeWindow
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. var interval = setInterval(function() { //Creates a new interval function
  14. unsafeWindow.console.clear = () => {}; //Stops the console logs from being cleared
  15. }, 0); //Finishes the set interval function
  16.  
  17. window.onload = function() //When the page finishes loading
  18. { //Starts the onload function
  19. clearInterval(interval); //Breaks the timer that stops the console log from being cleared every 0 secs
  20. }; //Finishes the onload function
  21.  
  22. if (location.href.match(/vidstream.pro|mcloud.to/) === null) //Check the iframe url
  23. { //Starts the if condition
  24. var _constructor = unsafeWindow.Function.prototype.constructor;
  25. unsafeWindow.Function.prototype.constructor = function() { //Hook Function.prototype.constructor
  26. var fnContent = arguments[0];
  27. if (fnContent) {
  28. if (fnContent.includes('debugger')) { //An anti-debugger is attempting to stop debugging
  29. var caller = Function.prototype.constructor.caller; // Non-standard hack to get the function caller
  30. var callerContent = caller.toString();
  31. if (callerContent.includes(/\bdebugger\b/gi)) { //Eliminate all debugger statements from the caller, if any
  32. callerContent = callerContent.replace(/\bdebugger\b/gi, ''); //Remove all debugger expressions
  33. eval('caller = ' + callerContent); //Replace the function
  34. }
  35. return (function() {});
  36. }
  37. }
  38. return _constructor.apply(this, arguments); //Execute the normal function constructor if nothing unusual is going on
  39. };
  40. } //Finishes the if condition
  41. })();