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. // @url https://greasyfork.org/zh-CN/scripts/530590-bypass-cdp-detection
  10. // @grant none
  11. // @description 2025/3/23 14:17:37
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15.  
  16.  
  17. ;(function() {
  18. var originalError = Error;
  19.  
  20. // Lock down the stack property on Error.prototype to prevent modification
  21. Object.defineProperty(Error.prototype, 'stack', {
  22. configurable: false,
  23. enumerable: true,
  24. writable: false,
  25. value: (function() {
  26. try {
  27. throw new originalError();
  28. } catch (e) {
  29. return e.stack;
  30. }
  31. })()
  32. });
  33.  
  34. // Proxy the Error constructor to prevent any instance-specific stack modifications
  35. window.Error = new Proxy(originalError, {
  36. construct(target, args) {
  37. var instance = new target(...args);
  38.  
  39. // Freeze the instance to prevent any modifications
  40. return Object.freeze(instance);
  41. }
  42.  
  43. });
  44.  
  45. // alert('bypass_CDP_detection injected');
  46. })();