Skip to main content

Make Selenium undetectable with stealth evasions and Tor integration.

Project description

Sneaky Selenium Python Versions

Sneaky Selenium is a Python package designed to prevent Selenium from being detected. Its primary goal is to enhance Selenium's stealth capabilities ensuring smooth automation while bypassing detection systems. Currently supports Chrome and Remote WebDriver.

Project Lineage

This project has evolved through several maintainers:

  1. puppeteer-extra-plugin-stealth by berstend (2019) - The original JavaScript stealth plugin for Puppeteer
  2. selenium-stealth by diprajpatra (2020) - Python port for Selenium, now unmaintained
  3. stealthenium by markmelnic (2024) - Updated fork with fixes
  4. sneaky-selenium (2026) - Current version with modern evasions, Tor integration, and Python 3.13+ support

Features

  • Passes public bot detection tests.
  • Bypasses Cloudflare and other bot detection systems.
  • Maintains a reasonable reCAPTCHA v3 score.
  • Tor integration for anonymous browsing.
  • Updated for 2026 with modern evasion techniques.

Installation

Available on PyPI:

pip install sneaky-selenium

For Tor support (optional):

pip install sneaky-selenium[tor]

Usage

from selenium import webdriver
from sneaky_selenium import stealth
import time

options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)

driver = webdriver.Chrome(options=options)

stealth(driver,
        languages=["en-US", "en"],
        vendor="Google Inc.",
        platform="Win32",
        webgl_vendor="Intel Inc.",
        renderer="Intel Iris OpenGL Engine",
        fix_hairline=True,
        )

driver.get("https://bot.sannysoft.com/")
time.sleep(5)
driver.quit()

Tor Integration

Sneaky Selenium supports routing traffic through the Tor network for anonymous browsing.

Prerequisites

  1. Install Tor: sudo pacman -S tor (Arch) / sudo apt install tor (Debian) / brew install tor (macOS)
  2. Start Tor: sudo systemctl start tor
  3. Install with Tor support: pip install sneaky-selenium[tor]

Quick Start with Tor

from sneaky_selenium import stealth_with_tor

# One-liner to create a stealthed browser routing through Tor
driver = stealth_with_tor()
driver.get("https://check.torproject.org")
driver.quit()

Custom Tor Configuration

from sneaky_selenium import stealth_with_tor, TorDriverConfig

config = TorDriverConfig(
    socks_host="127.0.0.1",
    socks_port=9050,      # Default Tor port (9150 for Tor Browser Bundle)
    headless=True,
    additional_options=["--window-size=1920,1080"],
)

driver = stealth_with_tor(
    config=config,
    languages=["en-US", "en"],
    platform="Win32",
)

driver.get("https://bot.sannysoft.com/")
driver.quit()

Utility Functions

from sneaky_selenium import (
    is_tor_available,
    check_tor_connection,
    get_tor_exit_ip,
    verify_tor_connection_via_driver,
)

# Check if Tor is running
if is_tor_available():
    print("Tor is available!")

# Get connection info (requires requests[socks])
info = check_tor_connection()
print(f"Connected: {info['connected']}, IP: {info['ip']}, Is Tor: {info['is_tor']}")

# Verify via browser
result = verify_tor_connection_via_driver(driver)
print(result["message"])

API Reference

stealth(
    driver: Driver,
    user_agent: str | None = None,
    languages: list[str] | None = ["en-US", "en"],
    vendor: str = "Google Inc.",
    platform: str | None = "Win32",
    webgl_vendor: str = "Intel Inc.",
    renderer: str = "Intel Iris OpenGL Engine",
    fix_hairline: bool = False,
    run_on_insecure_origins: bool = False,
    device_memory: int = 8,
    hardware_concurrency: int = 8,
)

License

This project is licensed under the MIT License. See the LICENSE file for details.

© 2019 berstend, 2020 diprajpatra, 2024 markmelnic, 2026 KaiErikNiermann

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sneaky_selenium-2.0.0.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sneaky_selenium-2.0.0-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file sneaky_selenium-2.0.0.tar.gz.

File metadata

  • Download URL: sneaky_selenium-2.0.0.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sneaky_selenium-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e7b95ed48334e22237cc2ba8db6ba1873d15ff3bb438afe3b4438c4b6f781992
MD5 02db66381fed617f042e324529376146
BLAKE2b-256 df00f728ff78cfdb58b3e657c0330732d48b7ceaba1e6c3a00b45ea61cd1e3f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for sneaky_selenium-2.0.0.tar.gz:

Publisher: publish.yaml on KaiErikNiermann/sneaky-selenium

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sneaky_selenium-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sneaky_selenium-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 069b15276d78f83ad96c1eb3ddb2c43baf8dabfe47019cf62e5a457e19382b80
MD5 b388b779118acc0d694a762ad843f6cf
BLAKE2b-256 b78d996c138278b652cb17feef26677ab015ae6c73fbd0019dc6b6beca0dced1

See more details on using hashes here.

Provenance

The following attestation bundles were made for sneaky_selenium-2.0.0-py3-none-any.whl:

Publisher: publish.yaml on KaiErikNiermann/sneaky-selenium

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page