Skip to content

Latest commit

Β 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘» GhostBlock β€” Invisible Ad Shield

GhostBlock Icon

Silent ad blocker that stays invisible to detection scripts.
Blocks ads at the network & DOM level β€” without being detected as an adblocker.

Manifest V3 Chrome 120+ MIT License No Tracking


✨ Features

Feature Description
🌐 Network-Level Blocking Uses Declarative Net Request (DNR) to block 50+ ad networks at the network layer
🧹 DOM Cleanup Removes ad containers, iframes, and banners from the page
πŸ›‘οΈ Stealth Mode Patches detection APIs β€” sites can't tell you're using an adblocker
🎭 Fake Ad APIs Provides dummy googletag, adsbygoogle so anti-adblock scripts pass
πŸ“Š Block Stats Track how many ads blocked today and total (with batching)
⚑ Lightweight Zero external dependencies, pure vanilla JavaScript
πŸ”‡ Silent Operation No notifications, no popups β€” just blocks silently
🎯 Site-Specific Bypasses Custom anti-detection for YouTube, Facebook, and more

πŸ›‘οΈ Anti-Detection Techniques

GhostBlock is specifically designed to bypass common adblocker detection methods:

Technique How It Works
Fake googletag API Provides a complete dummy window.googletag object so detector scripts don't flag the page
Fake adsbygoogle array Sites checking for window.adsbygoogle will find it exists as expected
Patched MutationObserver Filters out mutations caused by our ad removal β€” detector observers won't see anything suspicious
Delayed DOM Removal Ad elements are removed after 100ms instead of instantly, avoiding race-condition detectors
Stealth CSS injection Ad containers are hidden at document_start β€” no flash of ad content
XHR/fetch interception Ad requests are blocked in the page context, not via detectable extension APIs
Patched getComputedStyle Prevents detectors from spotting hidden ad elements via style inspection
Type-safe URL checking Handles Request, URL, Blob, and string inputs without crashing

πŸ“¦ Installation

From Source (Developer Mode)

  1. Clone this repository:

    git clone https://github.com/Irnhakim/ghost-block.git
  2. Open Chrome and navigate to:

    chrome://extensions/
    
  3. Enable Developer mode (top-right toggle)

  4. Click Load unpacked and select the ghost-block/ folder

  5. πŸŽ‰ Done! GhostBlock is now active (πŸ‘» icon in toolbar)

From Chrome Web Store

Coming soon

πŸš€ Usage

Action How
Toggle on/off Click the πŸ‘» icon β†’ toggle the switch
View stats See blocked ads today & total in the popup
Default mode Protection is ON by default after installation

πŸ—οΈ Architecture

ghost-block/
β”œβ”€β”€ manifest.json              # Manifest V3 configuration
β”œβ”€β”€ background.js              # Service worker β€” DNR rules & messaging
β”œβ”€β”€ content.js                 # MAIN world β€” DOM cleanup + network intercept + site bypasses
β”œβ”€β”€ bridge.js                  # ISOLATED world β€” cross-context communication (MAIN β†’ background)
β”œβ”€β”€ popup.html                 # Extension popup UI
β”œβ”€β”€ popup.js                   # Popup logic
β”‚
β”œβ”€β”€ css/
β”‚   └── stealth.css            # Pre-render ad hiding (100+ selectors)
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ filter-rules.js        # Blocklists: hosts, selectors, keywords
β”‚   β”œβ”€β”€ dnr-rules.json         # Declarative Net Request static rules (40+ rules)
β”‚   └── inject-stealth.js      # Stealth API patches (googletag, MutationObserver, K3)
β”‚
└── icons/
    β”œβ”€β”€ icon16.png
    β”œβ”€β”€ icon48.png
    └── icon128.png

How the Layers Work

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    BROWSER LAYER                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  DNR Static Rules (dnr-rules.json)             β”‚  β”‚
β”‚  β”‚  β†’ Blocks 50+ known ad domains                 β”‚  β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
β”‚  β”‚  Dynamic Rules (background.js)                 β”‚  β”‚
β”‚  β”‚  β†’ User-added custom domains                   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              PAGE LAYER (MAIN world)                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Stealth CSS (stealth.css)                     β”‚  β”‚
β”‚  β”‚  β†’ Hides ad containers before render           β”‚  β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
β”‚  β”‚  DOM Cleanup (content.js)                      β”‚  β”‚
β”‚  β”‚  β†’ Removes ad nodes, iframes, banners          β”‚  β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
β”‚  β”‚  Network Intercept (content.js)                β”‚  β”‚
β”‚  β”‚  β†’ Patches fetch/XHR to block ad URLs          β”‚  β”‚
β”‚  β”‚  β†’ YouTube exempt (stealth strategy)           β”‚  β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
β”‚  β”‚  API Spoofing (inject-stealth.js)              β”‚  β”‚
β”‚  β”‚  β†’ Fakes googletag, adsbygoogle, K3, etc.      β”‚  β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
β”‚  β”‚  Site-Specific Bypasses (content.js)           β”‚  β”‚
β”‚  β”‚  β†’ YouTube, Facebook, online-fix, otakudesu    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              BRIDGE (ISOLATED world)                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  cross-context messaging (postMessage)         β”‚  β”‚
β”‚  β”‚  β†’ MAIN world β†’ bridge.js β†’ background.js      β”‚  β”‚
β”‚  β”‚  β†’ Batched AD_BLOCKED messages (200ms)         β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Message Flow (Stats Counter)

content.js (MAIN world)
  β†’ markAndRemove() every 5 ad removals
  β†’ window.postMessage("__GB_ADBLOCKED__")

bridge.js (ISOLATED world)
  β†’ listen postMessage
  β†’ batch 200ms
  β†’ chrome.runtime.sendMessage("AD_BLOCKED", count)

background.js (service worker)
  β†’ blockedStats.total += count
  β†’ blockedStats.today += count
  β†’ chrome.storage.local.set({ blockedStats })

popup.js
  β†’ GET_STATUS β†’ render(today, total)

🌐 Blocked Ad Networks

Click to see full list (50+ networks)

Google Ads

  • pagead2.googlesyndication.com
  • adservice.google.com
  • googleads.g.doubleclick.net
  • tpc.googlesyndication.com
  • www.googleadservices.com

Ad Networks

  • adnxs.com β€” Xandr/AppNexus
  • adsrvr.org β€” The Trade Desk
  • amazon-adsystem.com β€” Amazon Advertising
  • bidswitch.net β€” IPONWEB
  • casalemedia.com β€” Index Exchange
  • criteo.com / criteo.net β€” Criteo
  • doubleclick.net β€” Google DoubleClick
  • indexww.com β€” Index Exchange
  • media.net β€” Media.net
  • openx.net β€” OpenX
  • pubmatic.com β€” PubMatic
  • rlcdn.com β€” Rocket Fuel
  • rubiconproject.com β€” Magnite
  • sharethrough.com β€” Sharethrough
  • taboola.com β€” Taboola
  • teads.tv β€” Teads
  • turn.com β€” Amobee

Analytics & Tracking

  • hotjar.com β€” Hotjar
  • moatads.com β€” Oracle Moat
  • scorecardresearch.com β€” comScore

Crypto Miners

  • coinhive.com β€” CoinHive
  • coin-hive.com β€” Coin-Hive

Popups & Malvertising

  • popads.net β€” PopAds
  • popcash.net β€” PopCash
  • propellerads.com β€” PropellerAds
  • exoclick.com β€” ExoClick
  • adskeeper.com β€” AdsKeeper

TheMoneyTizer & Mediapays

  • ads.themoneytizer.com β€” TheMoneyTizer
  • tds.mediapays.info β€” Mediapays TDS

LootLabs & ADCash

  • d2ng6x3yyemlxz.cloudfront.net β€” LootLabs
  • d2dxy39sqorbhv.cloudfront.net β€” LootLabs
  • acscdn.com β€” ADCash

Galaksion & AdManager

  • bowersorgamy.com β€” Galaksion
  • lekachmididae.com β€” Galaksion
  • barkersceleb.com β€” Galaksion
  • wpadmngr.com β€” AdManager

Site-Specific

  • botradar.tech β€” Bot detection (anti-adblock)
  • ads.desustream.com β€” OtakuDesu ads
  • rebrand.ly β€” Affiliate redirect (betting)
  • web.tolstoycomments.com β€” Comment widget ad vector
  • pixel.facebook.com β€” Facebook tracking
  • analytics.facebook.com β€” Facebook analytics

βš™οΈ Permissions

Permission Why It's Needed
storage Save toggle state, custom rules, and block statistics
activeTab Interact with the current tab for future features
scripting Inject scripts when needed
webNavigation Monitor page navigation for rule application
declarativeNetRequest Block ad network requests at the browser level
declarativeNetRequestWithHostAccess Block requests across all sites
host_permissions: <all_urls> Required to intercept and block ad network requests across all sites

Note: GhostBlock does NOT collect, transmit, or store any browsing data. All processing happens locally.

πŸ› οΈ Development

Prerequisites

  • Google Chrome 120+ (or Chromium-based browser)
  • Basic text editor

Setup

git clone https://github.com/Irnhakim/ghost-block.git
cd ghost-block
# No build step needed β€” load directly in Chrome

Testing

  1. Load the extension in developer mode
  2. Visit a site with ads (e.g., news sites, YouTube, Facebook)
  3. Open DevTools β†’ Console to verify no errors
  4. Check the popup for block statistics

Adding New Ad Networks

  1. Edit lib/dnr-rules.json β€” add a new rule object with unique ID
  2. Edit lib/filter-rules.js β€” add hostname to adHosts and patterns to adScriptPatterns
  3. Edit background.js β€” add to DEFAULT_AD_HOSTS array
  4. Edit css/stealth.css β€” add iframe/DOM selectors if needed

Adding Site-Specific Bypasses

  1. Edit content.js β†’ patchAntiAdblock() function
  2. Add hostname check: if (hostname.includes("example.com")) { ... }
  3. Add CSS selectors to stealth.css
  4. Add hostnames to filter-rules.js β†’ adHosts
  5. Add hostnames to background.js β†’ DEFAULT_AD_HOSTS
  6. Add DNR rules to lib/dnr-rules.json

πŸ”’ Privacy

GhostBlock is designed with privacy as a priority:

  • βœ… No data collection β€” zero telemetry
  • βœ… No remote connections β€” everything runs locally
  • βœ… No analytics β€” we don't track your usage
  • βœ… Open source β€” full code transparency
  • βœ… Minimal permissions β€” only what's needed to function

πŸ“„ License

MIT License β€” see LICENSE for details.

πŸ‘€ Author

Irnhakim β€” @Irnhakim

β˜• Support

If GhostBlock saved you from ads, consider supporting:

Platform Link
Saweria saweria.co/irnhakim
Buy Me a Coffee buymeacoffee.com/irnhakim

πŸ‘» GhostBlock β€” Silent. Invisible. Undetectable.
Made with β˜• by @Irnhakim

About

Silent, invisible, and undetectable Ad Blocker Chrome Extension. Blocks 3,500+ ad networks at DNR & DOM level, bypasses anti-adblock scripts with API spoofing, and features a clean monospace developer UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages