WebRTC Blocker

Blocks WebRTC protocol on non-whitelisted websites.

  1. // ==UserScript==
  2. // @name WebRTC Blocker
  3. // @version 1.0
  4. // @description Blocks WebRTC protocol on non-whitelisted websites.
  5. // @match *://*/*
  6. // @grant none
  7. // @license MIT
  8. // @namespace https://gf.qytechs.cn/users/1066079
  9. // ==/UserScript==
  10.  
  11. // Add your whitelist URLs here
  12. const whitelist = [
  13. "https://example.com",
  14. "https://example.net"
  15. ];
  16.  
  17. // Check if the current URL is in the whitelist
  18. function isWhitelisted(url) {
  19. return whitelist.some((whitelistedUrl) => url.startsWith(whitelistedUrl));
  20. }
  21.  
  22. // Block WebRTC on non-whitelisted pages
  23. if (!isWhitelisted(window.location.href)) {
  24. const killWebRTC = () => {
  25. // Remove WebRTC API from the window object
  26. delete window.RTCPeerConnection;
  27. delete window.webkitRTCPeerConnection;
  28. delete window.mozRTCPeerConnection;
  29. };
  30.  
  31. killWebRTC();
  32. console.log("Accelerator killed WebRTC.");
  33. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址