mahmud_bhai

VT reanalyzer

Mar 31st, 2026
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. // ==UserScript==
  2. // @name VT Reanalyze Auto Click Shadow + Blank + Close
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.3
  5. // @description Auto click VirusTotal Reanalyze, then blank page, then try to close tab
  6. // @match https://www.virustotal.com/*
  7. // @run-at document-idle
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. let clickedUrl = null;
  15. let closingStarted = false;
  16.  
  17. function findInShadow(root) {
  18. if (!root) return null;
  19.  
  20. if (root.querySelector) {
  21. const el = root.querySelector('a#reanalize');
  22. if (el) return el;
  23. }
  24.  
  25. const nodes = root.querySelectorAll ? root.querySelectorAll('*') : [];
  26. for (const node of nodes) {
  27. if (node.shadowRoot) {
  28. const found = findInShadow(node.shadowRoot);
  29. if (found) return found;
  30. }
  31. }
  32.  
  33. return null;
  34. }
  35.  
  36. function blankThenClose() {
  37. if (closingStarted) return;
  38. closingStarted = true;
  39.  
  40. console.log('[VT] waiting 5s before blanking tab');
  41.  
  42. setTimeout(() => {
  43. console.log('[VT] going to about:blank');
  44. location.replace('about:blank');
  45.  
  46. setTimeout(() => {
  47. console.log('[VT] trying to close blank tab');
  48. window.open('', '_self');
  49. window.close();
  50. }, 300);
  51. }, 10000);
  52. }
  53.  
  54. function clickReanalyze() {
  55. if (clickedUrl === location.href) return;
  56.  
  57. const btn = findInShadow(document);
  58.  
  59. if (!btn) {
  60. console.log('[VT] button not found');
  61. return;
  62. }
  63.  
  64. try {
  65. btn.scrollIntoView({ block: 'center' });
  66. } catch {}
  67.  
  68. ['pointerdown', 'mousedown', 'pointerup', 'mouseup', 'click'].forEach(type => {
  69. btn.dispatchEvent(new MouseEvent(type, {
  70. bubbles: true,
  71. cancelable: true,
  72. composed: true,
  73. view: window
  74. }));
  75. });
  76.  
  77. btn.click();
  78.  
  79. clickedUrl = location.href;
  80. console.log('[VT] clicked');
  81.  
  82. blankThenClose();
  83. }
  84.  
  85. setInterval(clickReanalyze, 1000);
  86. })();
Advertisement
Add Comment
Please, Sign In to add comment