Universal AdBlock Bypass (Beta) (Optimized)

Advanced bypass for ad-blocker detection with filter list optimization

  1. // ==UserScript==
  2. // @name Universal AdBlock Bypass (Beta) (Optimized)
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.0
  5. // @description Advanced bypass for ad-blocker detection with filter list optimization
  6. // @author Snow2122
  7. // @license MIT
  8. // @match *://*/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Counter common ad-blocker detection variables
  16. const spoofedVars = {
  17. 'ai_adb_active': true,
  18. 'ai_adb_action': 0,
  19. 'adblock': false,
  20. 'adsBlocked': false,
  21. 'canRunAds': true,
  22. 'showAds': true
  23. };
  24.  
  25. Object.keys(spoofedVars).forEach(key => {
  26. Object.defineProperty(window, key, {
  27. value: spoofedVars[key],
  28. writable: false,
  29. configurable: false
  30. });
  31. });
  32.  
  33. // Mock ad-blocker detection functions
  34. window.ai_adb_undetected = function() {
  35. document.body?.setAttribute('data-data-mask', 'clear');
  36. if (typeof window.ai_adb_undetected_actions === 'function') {
  37. window.ai_adb_undetected_actions(0);
  38. }
  39. };
  40.  
  41. // Spoof bait content visibility
  42. function spoofBaitElements() {
  43. const baitSelectors = [
  44. '.ads-ad', '.ad-banner', '.ad-block', '[class*="ad-"]', '[id*="ad-"]',
  45. '.banner-ad', '.adsbygoogle', '.detectadblock', '[class*="banner"]',
  46. // From Fanboy Annoyance and Social lists
  47. '.cookie-notice', '.gdpr-consent', '.social-share', '[class*="cookie-"]',
  48. '[id*="social-"]', '.popup-overlay', '.newsletter-popup'
  49. ];
  50. baitSelectors.forEach(selector => {
  51. document.querySelectorAll(selector).forEach(el => {
  52. el.style.display = 'block';
  53. el.style.visibility = 'visible';
  54. el.style.height = 'auto';
  55. el.style.width = 'auto';
  56. el.style.opacity = '1';
  57. el.removeAttribute('hidden');
  58. });
  59. });
  60. }
  61.  
  62. // Intercept and spoof fetch requests for ad-related resources
  63. const adDomains = [
  64. 'pagead', 'ads.', 'doubleclick', 'adsbygoogle', 'ad-', 'banner',
  65. // From EasyList
  66. 'googlesyndication', 'adnxs', 'pubmatic', 'openx', 'rubiconproject',
  67. 'criteo', 'adform', 'yieldmanager', 'smartadserver', 'adtech'
  68. ];
  69. const adDomainRegex = new RegExp(`(${adDomains.join('|')})`, 'i');
  70.  
  71. const originalFetch = window.fetch;
  72. window.fetch = function(url, options) {
  73. if (adDomainRegex.test(url)) {
  74. return Promise.resolve(new Response('OK', { status: 200, statusText: 'OK' }));
  75. }
  76. return originalFetch.apply(this, arguments);
  77. };
  78.  
  79. // Intercept XMLHttpRequest for ad-related resources
  80. const originalOpen = XMLHttpRequest.prototype.open;
  81. XMLHttpRequest.prototype.open = function(method, url) {
  82. if (adDomainRegex.test(url)) {
  83. this._isAdRequest = true;
  84. return;
  85. }
  86. return originalOpen.apply(this, arguments);
  87. };
  88.  
  89. const originalSend = XMLHttpRequest.prototype.send;
  90. XMLHttpRequest.prototype.send = function() {
  91. if (this._isAdRequest) {
  92. this.dispatchEvent(new Event('load'));
  93. return;
  94. }
  95. return originalSend.apply(this, arguments);
  96. };
  97.  
  98. // Remove ad-blocker overlays and messages
  99. function removeAdBlockElements() {
  100. const selectors = [
  101. 'ins > div', '.ad-block-message', '#adblock-overlay', '.ai-adb-overlay',
  102. '.adblock-notice', '.ai-adb-message-window', '[class*="adblock-"]',
  103. '[id*="adblock-"]', '.ads-blocker-warning', '.disable-adblock',
  104. // From EasyList and Fanboy Annoyance
  105. '.popup-ad', '.interstitial-ad', '.video-ad', '[class*="sponsored-"]',
  106. '.cookie-consent', '.privacy-notice', '[id*="gdpr-"]', '.social-widget'
  107. ].join(', ');
  108. document.querySelectorAll(selectors).forEach(el => el.remove());
  109. }
  110.  
  111. // Clear ad-blocker and tracking-related cookies
  112. function clearCookies() {
  113. const cookies = [
  114. 'aiADB', 'aiADB_PV', 'aiADB_PR', 'adblock_detected',
  115. 'adblock', 'ads_blocked', 'adb_detected',
  116. // From Fanboy CookieMonster and EasyPrivacy
  117. '__utma', '__utmb', '__utmz', '_ga', '_gid', '_gat',
  118. 'CONSENT', 'cookie_notice_accepted', 'eu_cookie'
  119. ];
  120. cookies.forEach(cookie => {
  121. document.cookie = `${cookie}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
  122. });
  123. }
  124.  
  125. // Restore hidden content and counter anti-adblock classes
  126. function restoreContent() {
  127. const hiddenSelectors = [
  128. '.ai-adb-hide', '.adblock-hidden', '[class*="hidden-by-adblock"]',
  129. // From EasyList
  130. '[class*="blocked-ad"]', '[style*="display: none"]'
  131. ];
  132. const showSelectors = [
  133. '.ai-adb-show', '.adblock-show', '[class*="show-if-adblock"]',
  134. // From Fanboy Annoyance
  135. '[class*="consent-"]', '[class*="popup-"]'
  136. ];
  137.  
  138. hiddenSelectors.forEach(selector => {
  139. document.querySelectorAll(selector).forEach(el => {
  140. el.style.display = 'block';
  141. el.style.visibility = 'visible';
  142. el.style.opacity = '1';
  143. el.classList.remove(...el.classList.values());
  144. });
  145. });
  146.  
  147. showSelectors.forEach(selector => {
  148. document.querySelectorAll(selector).forEach(el => {
  149. el.style.display = 'none';
  150. el.classList.remove(...el.classList.values());
  151. });
  152. });
  153. }
  154.  
  155. // Neutralize IAB detection scripts
  156. function neutralizeIABDetection() {
  157. const iabBait = document.querySelectorAll('[id*="iab-"], [class*="iab-"]');
  158. iabBait.forEach(el => {
  159. el.style.display = 'block';
  160. el.style.visibility = 'visible';
  161. el.style.height = 'auto';
  162. el.style.width = 'auto';
  163. });
  164. }
  165.  
  166. // Initialize bypass
  167. function init() {
  168. clearCookies();
  169. removeAdBlockElements();
  170. restoreContent();
  171. spoofBaitElements();
  172. neutralizeIABDetection();
  173. if (typeof window.ai_adb_undetected === 'function') {
  174. window.ai_adb_undetected(0);
  175. }
  176. }
  177.  
  178. // Run when DOM is loaded
  179. if (document.readyState === 'loading') {
  180. document.addEventListener('DOMContentLoaded', init);
  181. } else {
  182. init();
  183. }
  184.  
  185. // Observe for dynamically added elements
  186. const observer = new MutationObserver(() => {
  187. removeAdBlockElements();
  188. restoreContent();
  189. spoofBaitElements();
  190. neutralizeIABDetection();
  191. });
  192.  
  193. observer.observe(document.body, { childList: true, subtree: true });
  194.  
  195. // Periodically check for new bait elements
  196. setInterval(() => {
  197. spoofBaitElements();
  198. neutralizeIABDetection();
  199. }, 1000);
  200. })();