Bypass CDP Detection

2025/3/23 14:17:37

当前为 2025-03-23 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bypass CDP Detection
  3. // @namespace http://fulicat.com
  4. // @author Jack.Chan (971546@qq.com)
  5. // @version 1.0.0
  6. // @run-at document-start
  7. // @match *://*/*
  8. // @match file:///*
  9. // @grant none
  10. // @description 2025/3/23 14:17:37
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14.  
  15.  
  16. ;(function() {
  17. var originalError = Error;
  18.  
  19. // Lock down the stack property on Error.prototype to prevent modification
  20. Object.defineProperty(Error.prototype, 'stack', {
  21. configurable: false,
  22. enumerable: true,
  23. writable: false,
  24. value: (function() {
  25. try {
  26. throw new originalError();
  27. } catch (e) {
  28. return e.stack;
  29. }
  30. })()
  31. });
  32.  
  33. // Proxy the Error constructor to prevent any instance-specific stack modifications
  34. window.Error = new Proxy(originalError, {
  35. construct(target, args) {
  36. var instance = new target(...args);
  37.  
  38. // Freeze the instance to prevent any modifications
  39. return Object.freeze(instance);
  40. }
  41.  
  42. });
  43.  
  44. // alert('bypass_CDP_detection injected');
  45. })();