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

@@ -75,10 +75,13 @@ rm chromedriver.zip
CHROMEDRIVER_DIR="chromedriver-$PLATFORM"
if [ -f "$CHROMEDRIVER_DIR/chromedriver" ]; then
# Create symlink in bin directory
# Create symlinks in bin directory
# Primary symlink: 'chromedriver' - works with g3 out of the box
ln -sf "$INSTALL_DIR/$CHROMEDRIVER_DIR/chromedriver" "$BIN_DIR/chromedriver"
# Secondary symlink: 'chromedriver-for-testing' - explicit name to avoid confusion
ln -sf "$INSTALL_DIR/$CHROMEDRIVER_DIR/chromedriver" "$BIN_DIR/chromedriver-for-testing"
chmod +x "$INSTALL_DIR/$CHROMEDRIVER_DIR/chromedriver"
echo "✅ ChromeDriver installed and linked to: $BIN_DIR/chromedriver-for-testing"
echo "✅ ChromeDriver installed and linked to: $BIN_DIR/chromedriver"
else
echo "❌ ChromeDriver extraction failed"
exit 1
@@ -107,7 +110,7 @@ echo " ChromeDriver: $VERSION"
echo ""
echo "Binaries:"
echo " Chrome: $BIN_DIR/chrome-for-testing"
echo " ChromeDriver: $BIN_DIR/chromedriver-for-testing"
echo " ChromeDriver: $BIN_DIR/chromedriver"
echo ""
echo "To use with g3, make sure $BIN_DIR is in your PATH:"
echo " export PATH=\"$BIN_DIR:\$PATH\""