Add stealth mode for Chrome headless to evade bot detection

Implements comprehensive anti-detection measures:
- Override navigator.webdriver to return undefined
- Inject fake chrome.runtime, chrome.loadTimes, chrome.csi objects
- Add realistic plugins and mimeTypes arrays
- Patch permissions API to hide automation
- Set realistic navigator properties (languages, hardwareConcurrency, deviceMemory)
- Remove ChromeDriver-specific window properties (cdc_*)
- Patch Function.prototype.toString to hide modifications
- Add Chrome flags: --disable-blink-features=AutomationControlled
- Set realistic user-agent without HeadlessChrome identifier
- Exclude 'enable-automation' switch

Tested against bot detection sites:
- bot.sannysoft.com: All major tests pass
- Search engines: Works with DuckDuckGo, Yahoo, Brave, Startpage
- Still detected by: Google reCAPTCHA, Cloudflare Turnstile, Bing
This commit is contained in:
Dhanji R. Prasanna
2026-01-10 20:34:14 +11:00
parent 7da21d7e81
commit 60aeb67c56
5 changed files with 183 additions and 5 deletions

View File

@@ -116,6 +116,10 @@ browser = "safari"
# Run: ./scripts/setup-chrome-for-testing.sh to install matching versions
# chrome_binary = "/Users/yourname/.chrome-for-testing/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"
# chrome_binary = "/Users/yourname/.chrome-for-testing/chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"
# Optional: Path to ChromeDriver binary
# If not set, looks for 'chromedriver' in PATH
# The setup script creates a symlink at ~/.local/bin/chromedriver
# chromedriver_binary = "/Users/yourname/.local/bin/chromedriver"
[macax]
enabled = false