browser-stealth 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- browser_stealth-0.1.0/PKG-INFO +151 -0
- browser_stealth-0.1.0/README.md +125 -0
- browser_stealth-0.1.0/pyproject.toml +97 -0
- browser_stealth-0.1.0/pyproject.toml.orig +104 -0
- browser_stealth-0.1.0/src/browser_stealth/__init__.py +127 -0
- browser_stealth-0.1.0/src/browser_stealth/antidetect/__init__.py +43 -0
- browser_stealth-0.1.0/src/browser_stealth/antidetect/_mobile_scripts.py +3 -0
- browser_stealth-0.1.0/src/browser_stealth/antidetect/antidetect.py +3 -0
- browser_stealth-0.1.0/src/browser_stealth/antidetect/antidetect_scripts.py +3 -0
- browser_stealth-0.1.0/src/browser_stealth/antidetect/config.py +495 -0
- browser_stealth-0.1.0/src/browser_stealth/antidetect/core.py +527 -0
- browser_stealth-0.1.0/src/browser_stealth/antidetect/mobile.py +177 -0
- browser_stealth-0.1.0/src/browser_stealth/antidetect/scripts.py +594 -0
- browser_stealth-0.1.0/src/browser_stealth/bidi/__init__.py +25 -0
- browser_stealth-0.1.0/src/browser_stealth/bidi/antidetect.py +78 -0
- browser_stealth-0.1.0/src/browser_stealth/bidi/client.py +481 -0
- browser_stealth-0.1.0/src/browser_stealth/bidi/exceptions.py +43 -0
- browser_stealth-0.1.0/src/browser_stealth/bidi/session.py +304 -0
- browser_stealth-0.1.0/src/browser_stealth/concurrency/__init__.py +29 -0
- browser_stealth-0.1.0/src/browser_stealth/concurrency/base.py +63 -0
- browser_stealth-0.1.0/src/browser_stealth/concurrency/limiter.py +118 -0
- browser_stealth-0.1.0/src/browser_stealth/concurrency/metrics.py +67 -0
- browser_stealth-0.1.0/src/browser_stealth/concurrency/models.py +41 -0
- browser_stealth-0.1.0/src/browser_stealth/concurrency/pool.py +142 -0
- browser_stealth-0.1.0/src/browser_stealth/concurrency/queues.py +422 -0
- browser_stealth-0.1.0/src/browser_stealth/concurrency/reaper.py +395 -0
- browser_stealth-0.1.0/src/browser_stealth/crypto.py +64 -0
- browser_stealth-0.1.0/src/browser_stealth/exceptions.py +41 -0
- browser_stealth-0.1.0/src/browser_stealth/fingerprint/__init__.py +23 -0
- browser_stealth-0.1.0/src/browser_stealth/fingerprint/database.py +155 -0
- browser_stealth-0.1.0/src/browser_stealth/fingerprint/external.py +131 -0
- browser_stealth-0.1.0/src/browser_stealth/fingerprint/models.py +226 -0
- browser_stealth-0.1.0/src/browser_stealth/fingerprint/procedural.py +190 -0
- browser_stealth-0.1.0/src/browser_stealth/fingerprint/synthesizer.py +145 -0
- browser_stealth-0.1.0/src/browser_stealth/fs.py +91 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/__init__.py +81 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/_actions_helpers.py +625 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/_mobile_scripts.py +177 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/actions.py +550 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/antidetect.py +20 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/antidetect_scripts.py +18 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/behavior.py +300 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/config.py +6 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/consent.py +97 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/math_utils.py +685 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/search.py +176 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/touch.py +336 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/turnstile.py +411 -0
- browser_stealth-0.1.0/src/browser_stealth/humanize/warmer.py +606 -0
- browser_stealth-0.1.0/src/browser_stealth/launchers/__init__.py +7 -0
- browser_stealth-0.1.0/src/browser_stealth/launchers/camoufox.py +61 -0
- browser_stealth-0.1.0/src/browser_stealth/launchers/nodriver.py +259 -0
- browser_stealth-0.1.0/src/browser_stealth/lifecycle.py +66 -0
- browser_stealth-0.1.0/src/browser_stealth/logging.py +23 -0
- browser_stealth-0.1.0/src/browser_stealth/plugin.py +69 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/__init__.py +31 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/adapters/__init__.py +23 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/adapters/nodriver.py +150 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/adapters/playwright.py +105 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/adapters/selenium.py +86 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/hygiene.py +254 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/manager.py +233 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/models.py +46 -0
- browser_stealth-0.1.0/src/browser_stealth/profiles/storage.py +83 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/__init__.py +79 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/adapters.py +116 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/cache.py +172 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/extension.py +212 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/models.py +108 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/parser.py +130 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/pool.py +287 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/resolver.py +606 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/storage.py +249 -0
- browser_stealth-0.1.0/src/browser_stealth/proxy/tunnel.py +383 -0
- browser_stealth-0.1.0/src/browser_stealth/py.typed +0 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/__init__.py +198 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/assertions.py +178 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/dom_models.py +162 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/dom_scripts.py +929 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/fixtures.py +126 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/mocks/__init__.py +26 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/mocks/dom.py +245 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/mocks/nodriver.py +154 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/mocks/playwright.py +197 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/mocks/selenium.py +199 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/recorder.py +443 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/server.py +318 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/session.py +201 -0
- browser_stealth-0.1.0/src/browser_stealth/testing/snapshot.py +281 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: browser-stealth
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Next-generation browser antidetect, human-like behavior emulation (WindMouse), and profile warmer for Playwright, nodriver, and Selenium.
|
|
5
|
+
Keywords: playwright-stealth,nodriver,antidetect,web-scraping,windmouse,turnstile-solver,browser-automation
|
|
6
|
+
Author: Chu4hel
|
|
7
|
+
Author-email: Chu4hel <106600877+Chu4hel@users.noreply.github.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Requires-Dist: pydantic>=2.10.0
|
|
10
|
+
Requires-Dist: browser-stealth[playwright,nodriver,selenium,camoufox,bidi,crypto] ; extra == 'all'
|
|
11
|
+
Requires-Dist: websockets>=14.0.0 ; extra == 'bidi'
|
|
12
|
+
Requires-Dist: camoufox>=0.4.0 ; extra == 'camoufox'
|
|
13
|
+
Requires-Dist: cryptography>=41.0.0 ; extra == 'crypto'
|
|
14
|
+
Requires-Dist: nodriver>=0.38 ; extra == 'nodriver'
|
|
15
|
+
Requires-Dist: playwright>=1.40.0 ; extra == 'playwright'
|
|
16
|
+
Requires-Dist: selenium>=4.15.0 ; extra == 'selenium'
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Provides-Extra: all
|
|
19
|
+
Provides-Extra: bidi
|
|
20
|
+
Provides-Extra: camoufox
|
|
21
|
+
Provides-Extra: crypto
|
|
22
|
+
Provides-Extra: nodriver
|
|
23
|
+
Provides-Extra: playwright
|
|
24
|
+
Provides-Extra: selenium
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# browser-stealth 🥷
|
|
28
|
+
|
|
29
|
+
> Библиотека браузерного антидетекта нового поколения, биомеханической эмуляции поведения человека (**WindMouse**) и прогрева профилей для **nodriver**, **Playwright**, **Selenium** и **WebDriver BiDi**.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Ключевые возможности
|
|
34
|
+
|
|
35
|
+
* **Кросс-движковый антидетект**:
|
|
36
|
+
* Скрытие признаков автоматизации (`navigator.webdriver`, флаги automation CDP).
|
|
37
|
+
* Полифилы и согласованный спуфинг WebGL (`UNMASKED_VENDOR_WEBGL`, `UNMASKED_RENDERER_WEBGL`), Canvas (субпиксельный детерминированный шум), AudioContext и WebRTC.
|
|
38
|
+
* Защита от детекта через Web Workers и чистые трассировки стека V8 без утечек patched evaluation.
|
|
39
|
+
* Поддержка Client Hints (`navigator.userAgentData`), сенсорных событий Touch API и гироскопа.
|
|
40
|
+
* **Биомеханика движений человека (Humanize)**:
|
|
41
|
+
* Алгоритм движения мыши **WindMouse** с физической моделью гравитации, инерции и кривых Безье.
|
|
42
|
+
* Имитация опечаток на клавиатуре и вариативной скорости набора текста.
|
|
43
|
+
* Реалистичные сенсорные жесты: тапы, свайпы и пинч-зум.
|
|
44
|
+
* Марковские цепи для эмуляции случайного блуждания и серфинга по сайтам.
|
|
45
|
+
* **Прогрев сессий и решение проверок (Warmers & Solvers)**:
|
|
46
|
+
* `ProfileWarmer` — автоматический органический прогрев браузерных сессий через поисковые системы (Google, Yandex, Bing).
|
|
47
|
+
* Автоматический обход модальных окон согласия Google Consent / GDPR.
|
|
48
|
+
* Встроенный инспектор и интеграционный мост для токенов Cloudflare Turnstile.
|
|
49
|
+
* **Синтез и управление профилями**:
|
|
50
|
+
* Синтез консистентных цифровых личностей по seed-ключу (`FingerprintSynthesizer`).
|
|
51
|
+
* Защищенный экспорт/импорт профилей (`.chprofile`) с опциональным AES/Fernet-шифрованием.
|
|
52
|
+
* Автоматическая гигиена и санитизация профилей (сброс флагов сбоя `exit_type`, очистка временного мусора Chromium).
|
|
53
|
+
* **Сетевая инфраструктура**:
|
|
54
|
+
* Пул прокси с скорингом задержки, ротацией и health-check.
|
|
55
|
+
* Динамическая генерация Chrome Extension для базовой аутентификации прокси.
|
|
56
|
+
* Локальный TCP/SOCKS авторизационный туннель.
|
|
57
|
+
* **Протокол WebDriver BiDi**:
|
|
58
|
+
* Кроссбраузерное внедрение антидетект скриптов через `script.addPreloadScript` поверх WebSocket-соединения.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Установка
|
|
63
|
+
|
|
64
|
+
Установка ядра с нулевыми тяжелыми зависимостями:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv add browser-stealth
|
|
68
|
+
# или
|
|
69
|
+
pip install browser-stealth
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Установка с поддержкой конкретных браузерных движков:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uv add "browser-stealth[playwright]" # Для Playwright
|
|
76
|
+
uv add "browser-stealth[nodriver]" # Для nodriver
|
|
77
|
+
uv add "browser-stealth[selenium]" # Для Selenium
|
|
78
|
+
uv add "browser-stealth[bidi]" # Для протокола WebDriver BiDi
|
|
79
|
+
uv add "browser-stealth[all]" # Все компоненты
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Быстрый старт
|
|
85
|
+
|
|
86
|
+
### 1. Декларативная маскировка nodriver (Zero-Footprint)
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import asyncio
|
|
90
|
+
from browser_stealth import AntidetectConfig, launch_nodriver
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
async def main():
|
|
94
|
+
config = AntidetectConfig.preset_stealth_nodriver(
|
|
95
|
+
session_seed="user_account_42",
|
|
96
|
+
)
|
|
97
|
+
browser = await launch_nodriver(antidetect_config=config, headless=False)
|
|
98
|
+
page = await browser.get("https://bot.sannysoft.com")
|
|
99
|
+
await asyncio.sleep(5)
|
|
100
|
+
await browser.stop()
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
if __name__ == "__main__":
|
|
104
|
+
asyncio.run(main())
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 2. Человекоподобные движения мыши (WindMouse)
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import asyncio
|
|
111
|
+
from browser_stealth.humanize import async_move_mouse, async_type_text
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
async def interact(tab):
|
|
115
|
+
# Плавное биомеханическое перемещение мыши в координаты кнопки
|
|
116
|
+
await async_move_mouse(tab, target_x=450, target_y=320)
|
|
117
|
+
# Ввод текста с естественными задержками и опечатками
|
|
118
|
+
await async_type_text(tab, "#search-input", "browser antidetect python")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 3. Интеграция с Playwright
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
import asyncio
|
|
125
|
+
from playwright.async_api import async_playwright
|
|
126
|
+
from browser_stealth import AntidetectConfig, apply_antidetect_playwright
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
async def main():
|
|
130
|
+
config = AntidetectConfig.preset_aggressive(
|
|
131
|
+
webgl_vendor="Google Inc. (NVIDIA)",
|
|
132
|
+
webgl_renderer="ANGLE (NVIDIA, GeForce RTX 4080 Direct3D11)",
|
|
133
|
+
)
|
|
134
|
+
async with async_playwright() as p:
|
|
135
|
+
browser = await p.chromium.launch(headless=True)
|
|
136
|
+
context = await browser.new_context()
|
|
137
|
+
await apply_antidetect_playwright(context, config=config)
|
|
138
|
+
page = await context.new_page()
|
|
139
|
+
await page.goto("https://nowecure.com")
|
|
140
|
+
await browser.close()
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
if __name__ == "__main__":
|
|
144
|
+
asyncio.run(main())
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Лицензия
|
|
150
|
+
|
|
151
|
+
Распространяется под лицензией MIT.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# browser-stealth 🥷
|
|
2
|
+
|
|
3
|
+
> Библиотека браузерного антидетекта нового поколения, биомеханической эмуляции поведения человека (**WindMouse**) и прогрева профилей для **nodriver**, **Playwright**, **Selenium** и **WebDriver BiDi**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Ключевые возможности
|
|
8
|
+
|
|
9
|
+
* **Кросс-движковый антидетект**:
|
|
10
|
+
* Скрытие признаков автоматизации (`navigator.webdriver`, флаги automation CDP).
|
|
11
|
+
* Полифилы и согласованный спуфинг WebGL (`UNMASKED_VENDOR_WEBGL`, `UNMASKED_RENDERER_WEBGL`), Canvas (субпиксельный детерминированный шум), AudioContext и WebRTC.
|
|
12
|
+
* Защита от детекта через Web Workers и чистые трассировки стека V8 без утечек patched evaluation.
|
|
13
|
+
* Поддержка Client Hints (`navigator.userAgentData`), сенсорных событий Touch API и гироскопа.
|
|
14
|
+
* **Биомеханика движений человека (Humanize)**:
|
|
15
|
+
* Алгоритм движения мыши **WindMouse** с физической моделью гравитации, инерции и кривых Безье.
|
|
16
|
+
* Имитация опечаток на клавиатуре и вариативной скорости набора текста.
|
|
17
|
+
* Реалистичные сенсорные жесты: тапы, свайпы и пинч-зум.
|
|
18
|
+
* Марковские цепи для эмуляции случайного блуждания и серфинга по сайтам.
|
|
19
|
+
* **Прогрев сессий и решение проверок (Warmers & Solvers)**:
|
|
20
|
+
* `ProfileWarmer` — автоматический органический прогрев браузерных сессий через поисковые системы (Google, Yandex, Bing).
|
|
21
|
+
* Автоматический обход модальных окон согласия Google Consent / GDPR.
|
|
22
|
+
* Встроенный инспектор и интеграционный мост для токенов Cloudflare Turnstile.
|
|
23
|
+
* **Синтез и управление профилями**:
|
|
24
|
+
* Синтез консистентных цифровых личностей по seed-ключу (`FingerprintSynthesizer`).
|
|
25
|
+
* Защищенный экспорт/импорт профилей (`.chprofile`) с опциональным AES/Fernet-шифрованием.
|
|
26
|
+
* Автоматическая гигиена и санитизация профилей (сброс флагов сбоя `exit_type`, очистка временного мусора Chromium).
|
|
27
|
+
* **Сетевая инфраструктура**:
|
|
28
|
+
* Пул прокси с скорингом задержки, ротацией и health-check.
|
|
29
|
+
* Динамическая генерация Chrome Extension для базовой аутентификации прокси.
|
|
30
|
+
* Локальный TCP/SOCKS авторизационный туннель.
|
|
31
|
+
* **Протокол WebDriver BiDi**:
|
|
32
|
+
* Кроссбраузерное внедрение антидетект скриптов через `script.addPreloadScript` поверх WebSocket-соединения.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Установка
|
|
37
|
+
|
|
38
|
+
Установка ядра с нулевыми тяжелыми зависимостями:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv add browser-stealth
|
|
42
|
+
# или
|
|
43
|
+
pip install browser-stealth
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Установка с поддержкой конкретных браузерных движков:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uv add "browser-stealth[playwright]" # Для Playwright
|
|
50
|
+
uv add "browser-stealth[nodriver]" # Для nodriver
|
|
51
|
+
uv add "browser-stealth[selenium]" # Для Selenium
|
|
52
|
+
uv add "browser-stealth[bidi]" # Для протокола WebDriver BiDi
|
|
53
|
+
uv add "browser-stealth[all]" # Все компоненты
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Быстрый старт
|
|
59
|
+
|
|
60
|
+
### 1. Декларативная маскировка nodriver (Zero-Footprint)
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import asyncio
|
|
64
|
+
from browser_stealth import AntidetectConfig, launch_nodriver
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
async def main():
|
|
68
|
+
config = AntidetectConfig.preset_stealth_nodriver(
|
|
69
|
+
session_seed="user_account_42",
|
|
70
|
+
)
|
|
71
|
+
browser = await launch_nodriver(antidetect_config=config, headless=False)
|
|
72
|
+
page = await browser.get("https://bot.sannysoft.com")
|
|
73
|
+
await asyncio.sleep(5)
|
|
74
|
+
await browser.stop()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if __name__ == "__main__":
|
|
78
|
+
asyncio.run(main())
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Человекоподобные движения мыши (WindMouse)
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import asyncio
|
|
85
|
+
from browser_stealth.humanize import async_move_mouse, async_type_text
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
async def interact(tab):
|
|
89
|
+
# Плавное биомеханическое перемещение мыши в координаты кнопки
|
|
90
|
+
await async_move_mouse(tab, target_x=450, target_y=320)
|
|
91
|
+
# Ввод текста с естественными задержками и опечатками
|
|
92
|
+
await async_type_text(tab, "#search-input", "browser antidetect python")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 3. Интеграция с Playwright
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
import asyncio
|
|
99
|
+
from playwright.async_api import async_playwright
|
|
100
|
+
from browser_stealth import AntidetectConfig, apply_antidetect_playwright
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
async def main():
|
|
104
|
+
config = AntidetectConfig.preset_aggressive(
|
|
105
|
+
webgl_vendor="Google Inc. (NVIDIA)",
|
|
106
|
+
webgl_renderer="ANGLE (NVIDIA, GeForce RTX 4080 Direct3D11)",
|
|
107
|
+
)
|
|
108
|
+
async with async_playwright() as p:
|
|
109
|
+
browser = await p.chromium.launch(headless=True)
|
|
110
|
+
context = await browser.new_context()
|
|
111
|
+
await apply_antidetect_playwright(context, config=config)
|
|
112
|
+
page = await context.new_page()
|
|
113
|
+
await page.goto("https://nowecure.com")
|
|
114
|
+
await browser.close()
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
if __name__ == "__main__":
|
|
118
|
+
asyncio.run(main())
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Лицензия
|
|
124
|
+
|
|
125
|
+
Распространяется под лицензией MIT.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "browser-stealth"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Next-generation browser antidetect, human-like behavior emulation (WindMouse), and profile warmer for Playwright, nodriver, and Selenium."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
keywords = [
|
|
9
|
+
"playwright-stealth",
|
|
10
|
+
"nodriver",
|
|
11
|
+
"antidetect",
|
|
12
|
+
"web-scraping",
|
|
13
|
+
"windmouse",
|
|
14
|
+
"turnstile-solver",
|
|
15
|
+
"browser-automation",
|
|
16
|
+
]
|
|
17
|
+
dependencies = ["pydantic>=2.10.0"]
|
|
18
|
+
|
|
19
|
+
[[project.authors]]
|
|
20
|
+
name = "Chu4hel"
|
|
21
|
+
email = "106600877+Chu4hel@users.noreply.github.com"
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
playwright = ["playwright>=1.40.0"]
|
|
25
|
+
nodriver = ["nodriver>=0.38"]
|
|
26
|
+
selenium = ["selenium>=4.15.0"]
|
|
27
|
+
camoufox = ["camoufox>=0.4.0"]
|
|
28
|
+
bidi = ["websockets>=14.0.0"]
|
|
29
|
+
crypto = ["cryptography>=41.0.0"]
|
|
30
|
+
all = ["browser-stealth[playwright,nodriver,selenium,camoufox,bidi,crypto]"]
|
|
31
|
+
|
|
32
|
+
[project.entry-points."chutils.plugins.stealth"]
|
|
33
|
+
browser_stealth = "browser_stealth.plugin:BrowserStealthPluginImpl"
|
|
34
|
+
|
|
35
|
+
[build-system]
|
|
36
|
+
requires = ["uv_build>=0.11.28,<0.13.0"]
|
|
37
|
+
build-backend = "uv_build"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"chutils",
|
|
42
|
+
"cryptography>=50.0.2",
|
|
43
|
+
"httpx>=0.28.1",
|
|
44
|
+
"mypy>=2.3.1",
|
|
45
|
+
"playwright>=1.62.0",
|
|
46
|
+
"pytest>=9.1.1",
|
|
47
|
+
"pytest-asyncio>=1.4.0",
|
|
48
|
+
"pytest-mock>=3.16.0",
|
|
49
|
+
"ruff>=0.16.9",
|
|
50
|
+
"selenium>=4.50.0",
|
|
51
|
+
"websockets>=17.1",
|
|
52
|
+
]
|
|
53
|
+
docs = ["mkdocs-material>=9.5.0"]
|
|
54
|
+
|
|
55
|
+
[tool.uv.sources.chutils]
|
|
56
|
+
path = "../chutils"
|
|
57
|
+
editable = true
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
pythonpath = ["src"]
|
|
61
|
+
testpaths = ["tests"]
|
|
62
|
+
python_files = ["test_*.py"]
|
|
63
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
64
|
+
markers = ["e2e: End-to-end integration and antidetect tests"]
|
|
65
|
+
|
|
66
|
+
[tool.ruff]
|
|
67
|
+
target-version = "py311"
|
|
68
|
+
line-length = 100
|
|
69
|
+
|
|
70
|
+
[tool.ruff.lint]
|
|
71
|
+
ignore = [
|
|
72
|
+
"B009",
|
|
73
|
+
"B010",
|
|
74
|
+
"BLE001",
|
|
75
|
+
"S110",
|
|
76
|
+
"S101",
|
|
77
|
+
"PIE810",
|
|
78
|
+
"SIM103",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[tool.ruff.lint.per-file-ignores]
|
|
82
|
+
"tests/*" = [
|
|
83
|
+
"B008",
|
|
84
|
+
"B017",
|
|
85
|
+
"SIM117",
|
|
86
|
+
"RUF059",
|
|
87
|
+
"S101",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[tool.mypy]
|
|
91
|
+
python_version = "3.11"
|
|
92
|
+
strict = true
|
|
93
|
+
ignore_missing_imports = true
|
|
94
|
+
warn_unused_ignores = true
|
|
95
|
+
warn_redundant_casts = true
|
|
96
|
+
check_untyped_defs = true
|
|
97
|
+
disallow_untyped_defs = true
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "browser-stealth"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Next-generation browser antidetect, human-like behavior emulation (WindMouse), and profile warmer for Playwright, nodriver, and Selenium."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Chu4hel", email = "106600877+Chu4hel@users.noreply.github.com" }
|
|
8
|
+
]
|
|
9
|
+
license = "MIT"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
keywords = [
|
|
12
|
+
"playwright-stealth",
|
|
13
|
+
"nodriver",
|
|
14
|
+
"antidetect",
|
|
15
|
+
"web-scraping",
|
|
16
|
+
"windmouse",
|
|
17
|
+
"turnstile-solver",
|
|
18
|
+
"browser-automation",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"pydantic>=2.10.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
playwright = ["playwright>=1.40.0"]
|
|
26
|
+
nodriver = ["nodriver>=0.38"]
|
|
27
|
+
selenium = ["selenium>=4.15.0"]
|
|
28
|
+
camoufox = ["camoufox>=0.4.0"]
|
|
29
|
+
bidi = ["websockets>=14.0.0"]
|
|
30
|
+
crypto = ["cryptography>=41.0.0"]
|
|
31
|
+
all = [
|
|
32
|
+
"browser-stealth[playwright,nodriver,selenium,camoufox,bidi,crypto]",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.entry-points."chutils.plugins.stealth"]
|
|
36
|
+
browser_stealth = "browser_stealth.plugin:BrowserStealthPluginImpl"
|
|
37
|
+
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["uv_build>=0.11.28,<0.13.0"]
|
|
40
|
+
build-backend = "uv_build"
|
|
41
|
+
|
|
42
|
+
[dependency-groups]
|
|
43
|
+
dev = [
|
|
44
|
+
"chutils",
|
|
45
|
+
"cryptography>=50.0.2",
|
|
46
|
+
"httpx>=0.28.1",
|
|
47
|
+
"mypy>=2.3.1",
|
|
48
|
+
"playwright>=1.62.0",
|
|
49
|
+
"pytest>=9.1.1",
|
|
50
|
+
"pytest-asyncio>=1.4.0",
|
|
51
|
+
"pytest-mock>=3.16.0",
|
|
52
|
+
"ruff>=0.16.9",
|
|
53
|
+
"selenium>=4.50.0",
|
|
54
|
+
"websockets>=17.1",
|
|
55
|
+
]
|
|
56
|
+
docs = [
|
|
57
|
+
"mkdocs-material>=9.5.0",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[tool.uv.sources]
|
|
61
|
+
chutils = { path = "../chutils", editable = true }
|
|
62
|
+
|
|
63
|
+
[tool.pytest.ini_options]
|
|
64
|
+
pythonpath = ["src"]
|
|
65
|
+
testpaths = ["tests"]
|
|
66
|
+
python_files = ["test_*.py"]
|
|
67
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
68
|
+
markers = [
|
|
69
|
+
"e2e: End-to-end integration and antidetect tests",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[tool.ruff]
|
|
73
|
+
target-version = "py311"
|
|
74
|
+
line-length = 100
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint]
|
|
77
|
+
ignore = [
|
|
78
|
+
"B009", # Do not call getattr with a constant attribute name
|
|
79
|
+
"B010", # Do not call setattr with a constant attribute name
|
|
80
|
+
"BLE001", # Do not catch blind exception
|
|
81
|
+
"S110", # try-except-pass
|
|
82
|
+
"S101", # Use of assert
|
|
83
|
+
"PIE810", # startswith tuple
|
|
84
|
+
"SIM103", # return condition directly
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
[tool.ruff.lint.per-file-ignores]
|
|
88
|
+
"tests/*" = [
|
|
89
|
+
"B008",
|
|
90
|
+
"B017",
|
|
91
|
+
"SIM117",
|
|
92
|
+
"RUF059",
|
|
93
|
+
"S101",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[tool.mypy]
|
|
97
|
+
python_version = "3.11"
|
|
98
|
+
strict = true
|
|
99
|
+
ignore_missing_imports = true
|
|
100
|
+
warn_unused_ignores = true
|
|
101
|
+
warn_redundant_casts = true
|
|
102
|
+
check_untyped_defs = true
|
|
103
|
+
disallow_untyped_defs = true
|
|
104
|
+
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Next-generation browser antidetect, human-like behavior emulation, and profile warmer.
|
|
2
|
+
|
|
3
|
+
Библиотека глубокой маскировки и эмуляции поведения человека для nodriver, Playwright, Selenium и WebDriver BiDi.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from . import (
|
|
9
|
+
antidetect,
|
|
10
|
+
bidi,
|
|
11
|
+
concurrency,
|
|
12
|
+
fingerprint,
|
|
13
|
+
humanize,
|
|
14
|
+
launchers,
|
|
15
|
+
profiles,
|
|
16
|
+
proxy,
|
|
17
|
+
testing,
|
|
18
|
+
)
|
|
19
|
+
from .antidetect.config import AntidetectConfig
|
|
20
|
+
from .antidetect.core import (
|
|
21
|
+
ANTIDETECT_JS_SCRIPT,
|
|
22
|
+
apply_antidetect_nodriver,
|
|
23
|
+
apply_antidetect_playwright,
|
|
24
|
+
apply_antidetect_selenium,
|
|
25
|
+
get_browser_launch_args,
|
|
26
|
+
get_client_hints,
|
|
27
|
+
)
|
|
28
|
+
from .bidi.client import BiDiClient
|
|
29
|
+
from .bidi.session import BiDiSession, bidi_session
|
|
30
|
+
from .exceptions import BrowserStealthError, OptionalDependencyError
|
|
31
|
+
from .humanize.actions import (
|
|
32
|
+
TouchGestureGenerator,
|
|
33
|
+
TouchPoint,
|
|
34
|
+
async_click,
|
|
35
|
+
async_human_sleep,
|
|
36
|
+
async_move_mouse,
|
|
37
|
+
async_scroll_to,
|
|
38
|
+
async_touch_swipe,
|
|
39
|
+
async_touch_tap,
|
|
40
|
+
async_type_text,
|
|
41
|
+
click,
|
|
42
|
+
human_sleep,
|
|
43
|
+
move_mouse,
|
|
44
|
+
scroll_to,
|
|
45
|
+
type_text,
|
|
46
|
+
)
|
|
47
|
+
from .humanize.behavior import BehavioralProfile
|
|
48
|
+
from .humanize.math_utils import (
|
|
49
|
+
BezierCurveGenerator,
|
|
50
|
+
JitterDelayGenerator,
|
|
51
|
+
KeyboardTypoGenerator,
|
|
52
|
+
WindMouseGenerator,
|
|
53
|
+
)
|
|
54
|
+
from .humanize.turnstile import (
|
|
55
|
+
detect_cf_turnstile,
|
|
56
|
+
is_cf_turnstile_solved,
|
|
57
|
+
solve_cf_turnstile,
|
|
58
|
+
)
|
|
59
|
+
from .humanize.warmer import ProfileWarmer, SyncProfileWarmer
|
|
60
|
+
from .launchers import camoufox, nodriver
|
|
61
|
+
from .launchers.nodriver import close_tab, launch_nodriver, nodriver_session
|
|
62
|
+
from .profiles.manager import ProfileManager
|
|
63
|
+
from .profiles.models import BrowserProfile
|
|
64
|
+
from .proxy.models import ProxyConfig, ProxyHealthResult
|
|
65
|
+
from .proxy.parser import parse_proxy
|
|
66
|
+
from .proxy.pool import ProxyPool
|
|
67
|
+
|
|
68
|
+
__version__ = "0.1.0"
|
|
69
|
+
|
|
70
|
+
__all__ = [
|
|
71
|
+
"ANTIDETECT_JS_SCRIPT",
|
|
72
|
+
"AntidetectConfig",
|
|
73
|
+
"BehavioralProfile",
|
|
74
|
+
"BezierCurveGenerator",
|
|
75
|
+
"BiDiClient",
|
|
76
|
+
"BiDiSession",
|
|
77
|
+
"BrowserProfile",
|
|
78
|
+
"BrowserStealthError",
|
|
79
|
+
"JitterDelayGenerator",
|
|
80
|
+
"KeyboardTypoGenerator",
|
|
81
|
+
"OptionalDependencyError",
|
|
82
|
+
"ProfileManager",
|
|
83
|
+
"ProfileWarmer",
|
|
84
|
+
"ProxyConfig",
|
|
85
|
+
"ProxyHealthResult",
|
|
86
|
+
"ProxyPool",
|
|
87
|
+
"SyncProfileWarmer",
|
|
88
|
+
"TouchGestureGenerator",
|
|
89
|
+
"TouchPoint",
|
|
90
|
+
"WindMouseGenerator",
|
|
91
|
+
"antidetect",
|
|
92
|
+
"apply_antidetect_nodriver",
|
|
93
|
+
"apply_antidetect_playwright",
|
|
94
|
+
"apply_antidetect_selenium",
|
|
95
|
+
"async_click",
|
|
96
|
+
"async_human_sleep",
|
|
97
|
+
"async_move_mouse",
|
|
98
|
+
"async_scroll_to",
|
|
99
|
+
"async_touch_swipe",
|
|
100
|
+
"async_touch_tap",
|
|
101
|
+
"async_type_text",
|
|
102
|
+
"bidi",
|
|
103
|
+
"bidi_session",
|
|
104
|
+
"camoufox",
|
|
105
|
+
"click",
|
|
106
|
+
"close_tab",
|
|
107
|
+
"concurrency",
|
|
108
|
+
"detect_cf_turnstile",
|
|
109
|
+
"fingerprint",
|
|
110
|
+
"get_browser_launch_args",
|
|
111
|
+
"get_client_hints",
|
|
112
|
+
"human_sleep",
|
|
113
|
+
"humanize",
|
|
114
|
+
"is_cf_turnstile_solved",
|
|
115
|
+
"launch_nodriver",
|
|
116
|
+
"launchers",
|
|
117
|
+
"move_mouse",
|
|
118
|
+
"nodriver",
|
|
119
|
+
"nodriver_session",
|
|
120
|
+
"parse_proxy",
|
|
121
|
+
"profiles",
|
|
122
|
+
"proxy",
|
|
123
|
+
"scroll_to",
|
|
124
|
+
"solve_cf_turnstile",
|
|
125
|
+
"testing",
|
|
126
|
+
"type_text",
|
|
127
|
+
]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Подсистема антидетекта и маскировки браузерных сред."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .config import AntidetectConfig
|
|
6
|
+
from .core import (
|
|
7
|
+
ANTIDETECT_JS_SCRIPT,
|
|
8
|
+
_ensure_nodriver,
|
|
9
|
+
_ensure_playwright,
|
|
10
|
+
_ensure_selenium,
|
|
11
|
+
apply_antidetect_nodriver,
|
|
12
|
+
apply_antidetect_playwright,
|
|
13
|
+
apply_antidetect_selenium,
|
|
14
|
+
extract_clearance_cookies,
|
|
15
|
+
get_browser_launch_args,
|
|
16
|
+
get_client_hints,
|
|
17
|
+
)
|
|
18
|
+
from .scripts import (
|
|
19
|
+
DEFAULT_DEVICE_MEMORY,
|
|
20
|
+
DEFAULT_HARDWARE_CONCURRENCY,
|
|
21
|
+
DEFAULT_WEBGL_RENDERER,
|
|
22
|
+
DEFAULT_WEBGL_VENDOR,
|
|
23
|
+
_get_antidetect_js,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"ANTIDETECT_JS_SCRIPT",
|
|
28
|
+
"DEFAULT_DEVICE_MEMORY",
|
|
29
|
+
"DEFAULT_HARDWARE_CONCURRENCY",
|
|
30
|
+
"DEFAULT_WEBGL_RENDERER",
|
|
31
|
+
"DEFAULT_WEBGL_VENDOR",
|
|
32
|
+
"AntidetectConfig",
|
|
33
|
+
"_ensure_nodriver",
|
|
34
|
+
"_ensure_playwright",
|
|
35
|
+
"_ensure_selenium",
|
|
36
|
+
"_get_antidetect_js",
|
|
37
|
+
"apply_antidetect_nodriver",
|
|
38
|
+
"apply_antidetect_playwright",
|
|
39
|
+
"apply_antidetect_selenium",
|
|
40
|
+
"extract_clearance_cookies",
|
|
41
|
+
"get_browser_launch_args",
|
|
42
|
+
"get_client_hints",
|
|
43
|
+
]
|