Window Name Eraser

Preventing data leakage through window.name

当前为 2023-03-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Window Name Eraser
  3. // @namespace https://tampermonkey.net/
  4. // @version 1.3
  5. // @description Preventing data leakage through window.name
  6. // @author Streampunk
  7. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAIVBMVEVImONImeP///9Hlt5Hlt87kd0vjt2ox+2AsebU4vVcn+Fv9GsLAAAAAnRSTlPx8MaJ79gAAAE6SURBVFiF7ZfrjsQgCIW9AIrv/8CrTicbRWstO8ls0vPTgW8OirQ11hqNcjZo5K2x4BUC8wAewApAmGJWQroDQIrsDnEk3AVQdI3i2MUUQMF1CkPCBABHfoiACEcpgUaREwepVo5H4QQVka47IG48w2uBB0VMAEmEV8LAwhiAoY+GygzyLCcAln6LBb4KKMH9vxVXg034EAD/xAFhI7oOyK1XTjF0KueYG3MNkLfg7EZIAJ7mi72RADrPd44WAFwBVg6+DcAR8Xc07gO4zFIkvg1AD4O164B36zYWdgDvpmmaaw9Qf4PbgNx1UEeq4hTEFuz2Ab7Gy21ACZcrOwDSAlBc8H0HOkDKUgGkPg7Qz0TtVF7V0D1ZJAA88DydwcMCULahvl6OlMTD8dvflR/A/wHoPr6LA2NV+gHVqi9JB+PEwAAAAABJRU5ErkJggg==
  8. // @match http://*/*
  9. // @match https://*/*
  10. // @exclude https://www.google.com/recaptcha/api2/*
  11. // @exclude https://google.com/recaptcha/api2/*
  12. // @exclude https://www.google.com/recaptcha/enterprise/*
  13. // @exclude https://google.com/recaptcha/enterprise/*
  14. // @exclude https://www.recaptcha.net/recaptcha/api2/*
  15. // @exclude https://recaptcha.net/recaptcha/api2/*
  16. // @exclude https://www.recaptcha.net/recaptcha/enterprise/*
  17. // @exclude https://recaptcha.net/recaptcha/enterprise/*
  18. // @exclude https://mail.proton.me/*
  19. // @exclude https://webmail.vivaldi.net/*
  20. // @grant none
  21. // @license MIT
  22. // ==/UserScript==
  23.  
  24. 'use strict';
  25.  
  26. //Prevent the website from starting
  27. var a = window.onload;
  28. window.onload = "";
  29.  
  30. //Remove property
  31. var old = window.name;
  32. window.name = "";
  33.  
  34. if (old != "" ) {
  35. console.log("Evaluating results");
  36. Firefox.extension.sendMessage({url: document.domain, caption: old}, function(response)
  37. {
  38. switch (response.radio) {
  39. case "fallback":
  40. //White listed: bring back the property
  41. window.name = old;
  42. console.log("Window Name Eraser: Whitelisted domain");
  43. break;
  44. default:
  45. console.log("Window Name Eraser: Blocked domain");
  46. break;
  47. }
  48. //Let the website start
  49. var getType = {};
  50. if (a && getType.toString.call(a) == '[object Function]') {
  51. window.onload = function () { a(); }
  52. }
  53. });
  54. }
  55. else {
  56. //Let the website start
  57. var getType = {};
  58. if (a && getType.toString.call(a) == '[object Function]') {
  59. window.onload = function () { a(); }
  60. }
  61. console.log("Window Name Eraser: Nothing to block here");
  62. }