# stealthenium ![Python Versions](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)
A python package to prevent selenium detection. This programme is trying to make python selenium more stealthy. As of now August 2024 stealthenium **only** supports Chrome and Remote WebDriver.
This is a fork of [selenium-stealth ](https://github.com/diprajpatra/selenium-stealth) developed by [@diprajpatra](https://github.com/diprajpatra) and has came to be because it is no longer maintained (last commit November 5 2020 as of August 23 2024). It can be seen as a re-implementation of JavaScript [puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth) developed by [@berstend](https://github.com/berstend).
## Features
- **passes all public bot tests.**
- **bypass Cloudflare and other bot detection systems.**
- **maintains reasonable reCAPTCHA v3 score**
## Install
stealthenium is available on PyPI you can install with pip.
```
$ pip install stealthenium
```
## Usage
```python
from selenium import webdriver
from stealthenium import stealth
import time
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
# options.add_argument("--headless")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(
options=options,
service=webdriver.ChromeService(r"\chromedriver.exe")
)
stealth(driver,
languages=["en-US", "en"],
vendor="Google Inc.",
platform="Win32",
webgl_vendor="Intel Inc.",
renderer="Intel Iris OpenGL Engine",
fix_hairline=True,
)
url = "https://bot.sannysoft.com/"
driver.get(url)
time.sleep(5)
driver.quit()
```
## Args
```python
stealth(
driver: Driver,
user_agent: str = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36',
languages: [str] = ["en-US", "en"],
vendor: str = "Google Inc.",
platform: str = "Win32",
webgl_vendor: str = "Intel Inc.",
renderer: str = "Intel Iris OpenGL Engine",
fix_hairline: bool = False,
run_on_insecure_origins: bool = False,
)
```
## Test results (red - bad)
Without <strong>stealthenium</strong>
<table class="image">
<tr>
<td><figure class="image"><a href="https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headless_without_stealth.png"><img src="https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headless_without_stealth.png"></a><figcaption>headless</figcaption></figure></td>
<td><figure class="image"><a href="https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headful_without_stealth.png"><img src="https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headful_without_stealth.png"></a><figcaption>headful</figcaption></figure></td>
</tr>
</table>
With <strong>stealthenium</strong>
<table class="image">
<tr>
<td><figure class="image"><a href="https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headless_with_stealth.png"><img src="https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headless_with_stealth.png"></a><figcaption>headless</figcaption></figure></td>
<td><figure class="image"><a href="https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headful_with_stealth.png"><img src="https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headful_with_stealth.png"></a><figcaption>headful</figcaption></figure></td>
</tr>
</table>
## License
Copyright © 2024, [markmelnic](https://github.com/markmelnic/stealthenium). Released under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/markmelnic/stealthenium",
"name": "stealthenium",
"maintainer": null,
"docs_url": null,
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=3",
"maintainer_email": null,
"keywords": null,
"author": "Mark Melnic",
"author_email": "markmelnic@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0a/ff/0e592fcbc6943eea19dbad4729d370744c18f33d3ee9cdab6616340f15fb/stealthenium-1.1.0.tar.gz",
"platform": null,
"description": "# stealthenium ![Python Versions](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)\r\n\r\nA python package to prevent selenium detection. This programme is trying to make python selenium more stealthy. As of now August 2024 stealthenium **only** supports Chrome and Remote WebDriver.\r\n\r\nThis is a fork of [selenium-stealth ](https://github.com/diprajpatra/selenium-stealth) developed by [@diprajpatra](https://github.com/diprajpatra) and has came to be because it is no longer maintained (last commit November 5 2020 as of August 23 2024). It can be seen as a re-implementation of JavaScript [puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth) developed by [@berstend](https://github.com/berstend).\r\n\r\n## Features\r\n\r\n- **passes all public bot tests.**\r\n\r\n- **bypass Cloudflare and other bot detection systems.**\r\n\r\n- **maintains reasonable reCAPTCHA v3 score**\r\n\r\n## Install\r\n\r\nstealthenium is available on PyPI you can install with pip.\r\n\r\n```\r\n$ pip install stealthenium\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom selenium import webdriver\r\nfrom stealthenium import stealth\r\nimport time\r\n\r\noptions = webdriver.ChromeOptions()\r\noptions.add_argument(\"start-maximized\")\r\n\r\n# options.add_argument(\"--headless\")\r\n\r\noptions.add_experimental_option(\"excludeSwitches\", [\"enable-automation\"])\r\noptions.add_experimental_option('useAutomationExtension', False)\r\n\r\ndriver = webdriver.Chrome(\r\n options=options,\r\n service=webdriver.ChromeService(r\"\\chromedriver.exe\")\r\n)\r\n\r\nstealth(driver,\r\n languages=[\"en-US\", \"en\"],\r\n vendor=\"Google Inc.\",\r\n platform=\"Win32\",\r\n webgl_vendor=\"Intel Inc.\",\r\n renderer=\"Intel Iris OpenGL Engine\",\r\n fix_hairline=True,\r\n )\r\n\r\nurl = \"https://bot.sannysoft.com/\"\r\ndriver.get(url)\r\ntime.sleep(5)\r\ndriver.quit()\r\n```\r\n\r\n## Args\r\n\r\n```python\r\nstealth(\r\n driver: Driver,\r\n user_agent: str = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36',\r\n languages: [str] = [\"en-US\", \"en\"],\r\n vendor: str = \"Google Inc.\",\r\n platform: str = \"Win32\",\r\n webgl_vendor: str = \"Intel Inc.\",\r\n renderer: str = \"Intel Iris OpenGL Engine\",\r\n fix_hairline: bool = False,\r\n run_on_insecure_origins: bool = False,\r\n)\r\n```\r\n\r\n## Test results (red - bad)\r\n\r\nWithout <strong>stealthenium</strong>\r\n\r\n<table class=\"image\">\r\n<tr>\r\n <td><figure class=\"image\"><a href=\"https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headless_without_stealth.png\"><img src=\"https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headless_without_stealth.png\"></a><figcaption>headless</figcaption></figure></td>\r\n <td><figure class=\"image\"><a href=\"https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headful_without_stealth.png\"><img src=\"https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headful_without_stealth.png\"></a><figcaption>headful</figcaption></figure></td>\r\n</tr>\r\n</table>\r\n\r\nWith <strong>stealthenium</strong>\r\n\r\n<table class=\"image\">\r\n<tr>\r\n <td><figure class=\"image\"><a href=\"https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headless_with_stealth.png\"><img src=\"https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headless_with_stealth.png\"></a><figcaption>headless</figcaption></figure></td>\r\n <td><figure class=\"image\"><a href=\"https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headful_with_stealth.png\"><img src=\"https://raw.githubusercontent.com/markmelnic/stealthenium/main/stealthtests/selenium_chrome_headful_with_stealth.png\"></a><figcaption>headful</figcaption></figure></td>\r\n</tr>\r\n</table>\r\n\r\n## License\r\n\r\nCopyright \u00a9 2024, [markmelnic](https://github.com/markmelnic/stealthenium). Released under the MIT License.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A wrapper to make python selenium stealthy.",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/markmelnic/stealthenium"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "94e1b6d2d3fefc44a40922c325a0df5720f0fb82d0e3be91c144596ddac53b11",
"md5": "650b7bd5785f6becbd766ead13ba2eef",
"sha256": "092613a0d512c91dd8d3692f8b2d4f43eea3d8a27bc226ef39c4a6cd2403600b"
},
"downloads": -1,
"filename": "stealthenium-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "650b7bd5785f6becbd766ead13ba2eef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=3",
"size": 32146,
"upload_time": "2024-08-23T10:25:50",
"upload_time_iso_8601": "2024-08-23T10:25:50.177187Z",
"url": "https://files.pythonhosted.org/packages/94/e1/b6d2d3fefc44a40922c325a0df5720f0fb82d0e3be91c144596ddac53b11/stealthenium-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0aff0e592fcbc6943eea19dbad4729d370744c18f33d3ee9cdab6616340f15fb",
"md5": "a32383454ddc5778adf46ee49fe37e28",
"sha256": "04b098b7c1549202c9d14cf11be378e9461be2b36f7f1f75b3b021cf14be4035"
},
"downloads": -1,
"filename": "stealthenium-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a32383454ddc5778adf46ee49fe37e28",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=3",
"size": 22452,
"upload_time": "2024-08-23T10:25:52",
"upload_time_iso_8601": "2024-08-23T10:25:52.348106Z",
"url": "https://files.pythonhosted.org/packages/0a/ff/0e592fcbc6943eea19dbad4729d370744c18f33d3ee9cdab6616340f15fb/stealthenium-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-23 10:25:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "markmelnic",
"github_project": "stealthenium",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"tox": true,
"lcname": "stealthenium"
}