stealthmaven 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.
- stealthmaven-0.1.0/LICENSE +21 -0
- stealthmaven-0.1.0/PKG-INFO +229 -0
- stealthmaven-0.1.0/README.md +197 -0
- stealthmaven-0.1.0/pyproject.toml +77 -0
- stealthmaven-0.1.0/setup.cfg +4 -0
- stealthmaven-0.1.0/src/stealthmaven/__init__.py +16 -0
- stealthmaven-0.1.0/src/stealthmaven/__main__.py +5 -0
- stealthmaven-0.1.0/src/stealthmaven/assets/nodemaven-mark.svg +19 -0
- stealthmaven-0.1.0/src/stealthmaven/brand.py +95 -0
- stealthmaven-0.1.0/src/stealthmaven/browser.py +462 -0
- stealthmaven-0.1.0/src/stealthmaven/check.py +465 -0
- stealthmaven-0.1.0/src/stealthmaven/cli.py +284 -0
- stealthmaven-0.1.0/src/stealthmaven/geo.py +110 -0
- stealthmaven-0.1.0/src/stealthmaven/identity.py +109 -0
- stealthmaven-0.1.0/src/stealthmaven/mcp.py +391 -0
- stealthmaven-0.1.0/src/stealthmaven/mcp_http.py +227 -0
- stealthmaven-0.1.0/src/stealthmaven/profiles.py +107 -0
- stealthmaven-0.1.0/src/stealthmaven/proxy.py +153 -0
- stealthmaven-0.1.0/src/stealthmaven/relay.py +393 -0
- stealthmaven-0.1.0/src/stealthmaven/screen.py +108 -0
- stealthmaven-0.1.0/src/stealthmaven/useragent.py +182 -0
- stealthmaven-0.1.0/src/stealthmaven.egg-info/PKG-INFO +229 -0
- stealthmaven-0.1.0/src/stealthmaven.egg-info/SOURCES.txt +37 -0
- stealthmaven-0.1.0/src/stealthmaven.egg-info/dependency_links.txt +1 -0
- stealthmaven-0.1.0/src/stealthmaven.egg-info/entry_points.txt +2 -0
- stealthmaven-0.1.0/src/stealthmaven.egg-info/requires.txt +9 -0
- stealthmaven-0.1.0/src/stealthmaven.egg-info/top_level.txt +1 -0
- stealthmaven-0.1.0/tests/test_brand.py +26 -0
- stealthmaven-0.1.0/tests/test_browser_local.py +158 -0
- stealthmaven-0.1.0/tests/test_check.py +184 -0
- stealthmaven-0.1.0/tests/test_engines.py +152 -0
- stealthmaven-0.1.0/tests/test_identity.py +148 -0
- stealthmaven-0.1.0/tests/test_mcp.py +182 -0
- stealthmaven-0.1.0/tests/test_mcp_http.py +196 -0
- stealthmaven-0.1.0/tests/test_profiles.py +29 -0
- stealthmaven-0.1.0/tests/test_proxy.py +139 -0
- stealthmaven-0.1.0/tests/test_relay.py +345 -0
- stealthmaven-0.1.0/tests/test_screen.py +92 -0
- stealthmaven-0.1.0/tests/test_useragent.py +174 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NodeMaven
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stealthmaven
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Stealth Chromium for scraping and AI agents: a real browser whose timezone, language and WebRTC match its proxy exit. Python API, CDP and MCP.
|
|
5
|
+
Author: NodeMaven
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://nodemaven.com/?utm_source=pypi&utm_medium=project&utm_campaign=stealthmaven
|
|
8
|
+
Project-URL: Documentation, https://github.com/nodemaven/stealthmaven#readme
|
|
9
|
+
Project-URL: Source, https://github.com/nodemaven/stealthmaven
|
|
10
|
+
Project-URL: Issues, https://github.com/nodemaven/stealthmaven/issues
|
|
11
|
+
Keywords: antidetect-browser,stealth-browser,playwright,patchright,chromium,web-scraping,proxy,residential-proxy,mcp,ai-agents
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
|
|
20
|
+
Classifier: Topic :: Software Development :: Testing
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: patchright==1.64.3
|
|
25
|
+
Requires-Dist: nodemaven>=0.1.7
|
|
26
|
+
Provides-Extra: camoufox
|
|
27
|
+
Requires-Dist: camoufox>=0.5.9; extra == "camoufox"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
<div align="center">
|
|
34
|
+
|
|
35
|
+
<h1><img src="https://raw.githubusercontent.com/nodemaven/stealthmaven/main/src/stealthmaven/assets/nodemaven-mark.svg" alt="" height="44" align="absmiddle"> stealthmaven</h1>
|
|
36
|
+
|
|
37
|
+
<p><b>A real Chromium for scraping and AI agents whose timezone, languages and WebRTC match its proxy exit.</b><br>
|
|
38
|
+
by <a href="https://nodemaven.com/?utm_source=github&utm_medium=readme&utm_campaign=stealthmaven&utm_content=header">NodeMaven</a></p>
|
|
39
|
+
|
|
40
|
+
[](https://www.python.org/)
|
|
41
|
+
[](https://github.com/nodemaven/stealthmaven/blob/main/LICENSE)
|
|
42
|
+
[](https://dashboard.nodemaven.com/accounts/signup/?utm_source=github&utm_medium=readme&utm_campaign=stealthmaven&utm_content=badge)
|
|
43
|
+
|
|
44
|
+
[Use](#use) · [Command line](#command-line) · [AI agents (MCP)](#ai-agents-mcp) · [CDP](#other-tools-over-cdp)
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
Built on [patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright-python);
|
|
49
|
+
you get an ordinary Playwright `BrowserContext` back. Works with any proxy that
|
|
50
|
+
takes a session id in its username, and with NodeMaven's gateway out of the box.
|
|
51
|
+
|
|
52
|
+
> Early release: the API may still change between minor versions.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install stealthmaven
|
|
58
|
+
python -m patchright install chromium
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Use
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from stealthmaven import launch
|
|
65
|
+
|
|
66
|
+
# NodeMaven: NODEMAVEN_LOGIN and NODEMAVEN_PASSWORD in the environment
|
|
67
|
+
with launch(country="de") as browser:
|
|
68
|
+
page = browser.new_page()
|
|
69
|
+
page.goto("https://example.com")
|
|
70
|
+
print(browser.identity.timezone, browser.identity.languages)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Any other provider takes a proxy URL with `{session}` where its session id goes,
|
|
74
|
+
as `proxy=` or in `STEALTHMAVEN_PROXY`:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
launch(proxy="http://user-session-{session}:pass@gate.example.com:7000")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Characters such as `#`, `/`, `?` or `@` in the password must be percent-encoded.
|
|
81
|
+
With no proxy configured at all, the browser uses this machine's own address and
|
|
82
|
+
`launch()` says so with a `NoProxyWarning`.
|
|
83
|
+
NodeMaven session ids start with `stealthmaven`, so the traffic can be told
|
|
84
|
+
apart on the account.
|
|
85
|
+
|
|
86
|
+
Before the browser starts, stealthmaven asks the exit where it is (ipinfo.io,
|
|
87
|
+
through the proxy; `IPINFO_TOKEN` is sent if set), then sets:
|
|
88
|
+
|
|
89
|
+
- the timezone to the exit's;
|
|
90
|
+
- the languages to the country's usual one, then English
|
|
91
|
+
(`de-DE, de, en-US, en`), in `navigator.languages` and `Accept-Language`;
|
|
92
|
+
- WebRTC to proxied traffic only, so pages never see the machine's address;
|
|
93
|
+
- the geolocation the browser reports, if a page is given permission.
|
|
94
|
+
|
|
95
|
+
`timezone=` and `locale=` override the exit. `profile="name"` keeps the browser
|
|
96
|
+
profile and its exit's session between runs.
|
|
97
|
+
|
|
98
|
+
On a machine without a desktop - a server, a Windows service, or
|
|
99
|
+
`headless=True` - Chrome would see a screen with no taskbar (or 800x600 when
|
|
100
|
+
headless). There stealthmaven runs Chrome's own headless mode with a 1920x1080
|
|
101
|
+
screen, a taskbar-sized work area and a window that fills it. "Headless" is taken
|
|
102
|
+
out of the User-Agent everywhere - pages, workers and service workers - while the
|
|
103
|
+
client hints stay the browser's own. On a desktop the real screen is left alone.
|
|
104
|
+
`screen=(1600, 900)` gives that screen on any machine - and with it the
|
|
105
|
+
headless mode, so no window - and `screen=None` turns this off.
|
|
106
|
+
|
|
107
|
+
`engine="camoufox"` (Firefox, `pip install "stealthmaven[camoufox]"` and
|
|
108
|
+
`python -m camoufox fetch`) uses the same proxy, lookup, timezone and languages;
|
|
109
|
+
Camoufox builds the rest of its fingerprint itself; its WebRTC candidates carry
|
|
110
|
+
the exit's address. It gets past more commercial anti-bot services than Chromium
|
|
111
|
+
on patchright - Kasada among them - so use it where the default engine is
|
|
112
|
+
refused.
|
|
113
|
+
|
|
114
|
+
The proxy is reached through a local relay that counts traffic
|
|
115
|
+
(`browser.traffic()`) and refuses Chrome's own background downloads, which
|
|
116
|
+
would otherwise be billed as proxy traffic. The relay, like the CDP port below,
|
|
117
|
+
listens on 127.0.0.1 without a password: other programs on this machine can use
|
|
118
|
+
it while the browser runs. A lookup needs an `http://` proxy; with `https://` or
|
|
119
|
+
`socks5://` pass `lookup=False` with `timezone=` and `locale=`.
|
|
120
|
+
|
|
121
|
+
## Command line
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
stealthmaven open https://example.com --country us
|
|
125
|
+
stealthmaven check --country us # what public bot detectors say
|
|
126
|
+
stealthmaven serve --country us # a browser other tools connect to over CDP
|
|
127
|
+
stealthmaven exit --country us # where the exit is, no browser
|
|
128
|
+
stealthmaven profiles
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`open` without a URL shows a start page with the identity the browser was given
|
|
132
|
+
and links to the bot detectors; it is local and makes no requests.
|
|
133
|
+
|
|
134
|
+
`--proxy` puts the URL, password included, in the process list and the shell
|
|
135
|
+
history; `STEALTHMAVEN_PROXY` keeps it out of both.
|
|
136
|
+
|
|
137
|
+
`check` opens a browser with the identity. On a page it serves itself from
|
|
138
|
+
127.0.0.1 it reads the User-Agent in a page, a worker and a service worker, the
|
|
139
|
+
client hints, the `Accept-Language` header against `navigator.languages`, and
|
|
140
|
+
whether WebRTC offers any candidate outside the proxy. Then it compares the
|
|
141
|
+
timezone, languages, screen and WebRTC candidates with the exit and reads
|
|
142
|
+
deviceandbrowserinfo.com, BrowserScan, CreepJS and bot.sannysoft.com. It prints
|
|
143
|
+
one line per check, never an address, and exits with 1 if any check failed
|
|
144
|
+
(`--json` for scripts):
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
workers ok no Headless in page, worker or service worker
|
|
148
|
+
client hints ok platformVersion 10.0.0, 2 brands
|
|
149
|
+
accept-language ok header matches navigator.languages
|
|
150
|
+
webrtc policy ok no candidate outside the proxy
|
|
151
|
+
timezone ok Europe/Berlin, exit Europe/Berlin
|
|
152
|
+
languages ok de-DE,de,en-US,en
|
|
153
|
+
webrtc ok no other address
|
|
154
|
+
screen ok 1920x1080, work area 1920x1040
|
|
155
|
+
user agent ok no Headless
|
|
156
|
+
deviceandbrowserinfo ok human
|
|
157
|
+
browserscan ok normal
|
|
158
|
+
creepjs headless ok 0%
|
|
159
|
+
creepjs like-headless info 25% (a desktop Chrome reads 19-25%)
|
|
160
|
+
sannysoft ok 58 rows, none failed
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## AI agents (MCP)
|
|
164
|
+
|
|
165
|
+
`stealthmaven mcp` is a Model Context Protocol server that drives one browser
|
|
166
|
+
with the identity: `open_page`, `snapshot` (the page's accessibility tree with
|
|
167
|
+
element refs), `click`, `type`, `press`, `scroll`, `back`, `extract_text`,
|
|
168
|
+
`screenshot`, `identity` and `new_identity`.
|
|
169
|
+
|
|
170
|
+
Over stdio, for Claude Code, Claude Desktop, Cursor and other local clients:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{"command": "stealthmaven", "args": ["mcp", "--country", "us"],
|
|
174
|
+
"env": {"NODEMAVEN_LOGIN": "...", "NODEMAVEN_PASSWORD": "..."}}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
claude mcp add stealthmaven -- stealthmaven mcp --country us
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Over Streamable HTTP, for clients that connect to a URL:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
stealthmaven mcp --http --country us # http://127.0.0.1:8931/mcp
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
It listens on 127.0.0.1 only and refuses requests whose `Host` or `Origin` is
|
|
188
|
+
not this machine, so a web page cannot reach it through your browser. To expose
|
|
189
|
+
it through a tunnel, set a token and name the tunnel's host; clients then send
|
|
190
|
+
`Authorization: Bearer <token>`:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
export STEALTHMAVEN_MCP_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
|
|
194
|
+
stealthmaven mcp --http --allow-host your-tunnel.example.com
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Without the token anyone who finds the URL drives the browser through your
|
|
198
|
+
proxy, so `--allow-host` refuses to start without one. On 127.0.0.1 alone the
|
|
199
|
+
token is optional, and without it any program on this machine can connect; the
|
|
200
|
+
server keeps one session, and a new `initialize` replaces it. Set the token to
|
|
201
|
+
keep the browser to your client.
|
|
202
|
+
|
|
203
|
+
## Other tools over CDP
|
|
204
|
+
|
|
205
|
+
`stealthmaven serve` (or `launch(cdp_port=0)`) starts the browser with the
|
|
206
|
+
identity and prints a Chrome DevTools endpoint on 127.0.0.1:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
stealthmaven serve --country us
|
|
210
|
+
# http://127.0.0.1:54321
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
from patchright.sync_api import sync_playwright
|
|
215
|
+
|
|
216
|
+
with sync_playwright() as p:
|
|
217
|
+
browser = p.chromium.connect_over_cdp("http://127.0.0.1:54321")
|
|
218
|
+
page = browser.contexts[0].new_page()
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The client that connects decides how visible the automation is: patchright's
|
|
222
|
+
`connect_over_cdp` keeps it hidden, while stock Playwright and Puppeteer
|
|
223
|
+
announce themselves over CDP in ways detectors such as deviceandbrowserinfo.com
|
|
224
|
+
read. Tools built on them can still drive the browser.
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT. stealthmaven is made by [NodeMaven](https://nodemaven.com/?utm_source=github&utm_medium=readme&utm_campaign=stealthmaven&utm_content=footer),
|
|
229
|
+
which sells residential and mobile proxies; it works with any provider.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<h1><img src="https://raw.githubusercontent.com/nodemaven/stealthmaven/main/src/stealthmaven/assets/nodemaven-mark.svg" alt="" height="44" align="absmiddle"> stealthmaven</h1>
|
|
4
|
+
|
|
5
|
+
<p><b>A real Chromium for scraping and AI agents whose timezone, languages and WebRTC match its proxy exit.</b><br>
|
|
6
|
+
by <a href="https://nodemaven.com/?utm_source=github&utm_medium=readme&utm_campaign=stealthmaven&utm_content=header">NodeMaven</a></p>
|
|
7
|
+
|
|
8
|
+
[](https://www.python.org/)
|
|
9
|
+
[](https://github.com/nodemaven/stealthmaven/blob/main/LICENSE)
|
|
10
|
+
[](https://dashboard.nodemaven.com/accounts/signup/?utm_source=github&utm_medium=readme&utm_campaign=stealthmaven&utm_content=badge)
|
|
11
|
+
|
|
12
|
+
[Use](#use) · [Command line](#command-line) · [AI agents (MCP)](#ai-agents-mcp) · [CDP](#other-tools-over-cdp)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
Built on [patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright-python);
|
|
17
|
+
you get an ordinary Playwright `BrowserContext` back. Works with any proxy that
|
|
18
|
+
takes a session id in its username, and with NodeMaven's gateway out of the box.
|
|
19
|
+
|
|
20
|
+
> Early release: the API may still change between minor versions.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install stealthmaven
|
|
26
|
+
python -m patchright install chromium
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Use
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from stealthmaven import launch
|
|
33
|
+
|
|
34
|
+
# NodeMaven: NODEMAVEN_LOGIN and NODEMAVEN_PASSWORD in the environment
|
|
35
|
+
with launch(country="de") as browser:
|
|
36
|
+
page = browser.new_page()
|
|
37
|
+
page.goto("https://example.com")
|
|
38
|
+
print(browser.identity.timezone, browser.identity.languages)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Any other provider takes a proxy URL with `{session}` where its session id goes,
|
|
42
|
+
as `proxy=` or in `STEALTHMAVEN_PROXY`:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
launch(proxy="http://user-session-{session}:pass@gate.example.com:7000")
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Characters such as `#`, `/`, `?` or `@` in the password must be percent-encoded.
|
|
49
|
+
With no proxy configured at all, the browser uses this machine's own address and
|
|
50
|
+
`launch()` says so with a `NoProxyWarning`.
|
|
51
|
+
NodeMaven session ids start with `stealthmaven`, so the traffic can be told
|
|
52
|
+
apart on the account.
|
|
53
|
+
|
|
54
|
+
Before the browser starts, stealthmaven asks the exit where it is (ipinfo.io,
|
|
55
|
+
through the proxy; `IPINFO_TOKEN` is sent if set), then sets:
|
|
56
|
+
|
|
57
|
+
- the timezone to the exit's;
|
|
58
|
+
- the languages to the country's usual one, then English
|
|
59
|
+
(`de-DE, de, en-US, en`), in `navigator.languages` and `Accept-Language`;
|
|
60
|
+
- WebRTC to proxied traffic only, so pages never see the machine's address;
|
|
61
|
+
- the geolocation the browser reports, if a page is given permission.
|
|
62
|
+
|
|
63
|
+
`timezone=` and `locale=` override the exit. `profile="name"` keeps the browser
|
|
64
|
+
profile and its exit's session between runs.
|
|
65
|
+
|
|
66
|
+
On a machine without a desktop - a server, a Windows service, or
|
|
67
|
+
`headless=True` - Chrome would see a screen with no taskbar (or 800x600 when
|
|
68
|
+
headless). There stealthmaven runs Chrome's own headless mode with a 1920x1080
|
|
69
|
+
screen, a taskbar-sized work area and a window that fills it. "Headless" is taken
|
|
70
|
+
out of the User-Agent everywhere - pages, workers and service workers - while the
|
|
71
|
+
client hints stay the browser's own. On a desktop the real screen is left alone.
|
|
72
|
+
`screen=(1600, 900)` gives that screen on any machine - and with it the
|
|
73
|
+
headless mode, so no window - and `screen=None` turns this off.
|
|
74
|
+
|
|
75
|
+
`engine="camoufox"` (Firefox, `pip install "stealthmaven[camoufox]"` and
|
|
76
|
+
`python -m camoufox fetch`) uses the same proxy, lookup, timezone and languages;
|
|
77
|
+
Camoufox builds the rest of its fingerprint itself; its WebRTC candidates carry
|
|
78
|
+
the exit's address. It gets past more commercial anti-bot services than Chromium
|
|
79
|
+
on patchright - Kasada among them - so use it where the default engine is
|
|
80
|
+
refused.
|
|
81
|
+
|
|
82
|
+
The proxy is reached through a local relay that counts traffic
|
|
83
|
+
(`browser.traffic()`) and refuses Chrome's own background downloads, which
|
|
84
|
+
would otherwise be billed as proxy traffic. The relay, like the CDP port below,
|
|
85
|
+
listens on 127.0.0.1 without a password: other programs on this machine can use
|
|
86
|
+
it while the browser runs. A lookup needs an `http://` proxy; with `https://` or
|
|
87
|
+
`socks5://` pass `lookup=False` with `timezone=` and `locale=`.
|
|
88
|
+
|
|
89
|
+
## Command line
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
stealthmaven open https://example.com --country us
|
|
93
|
+
stealthmaven check --country us # what public bot detectors say
|
|
94
|
+
stealthmaven serve --country us # a browser other tools connect to over CDP
|
|
95
|
+
stealthmaven exit --country us # where the exit is, no browser
|
|
96
|
+
stealthmaven profiles
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`open` without a URL shows a start page with the identity the browser was given
|
|
100
|
+
and links to the bot detectors; it is local and makes no requests.
|
|
101
|
+
|
|
102
|
+
`--proxy` puts the URL, password included, in the process list and the shell
|
|
103
|
+
history; `STEALTHMAVEN_PROXY` keeps it out of both.
|
|
104
|
+
|
|
105
|
+
`check` opens a browser with the identity. On a page it serves itself from
|
|
106
|
+
127.0.0.1 it reads the User-Agent in a page, a worker and a service worker, the
|
|
107
|
+
client hints, the `Accept-Language` header against `navigator.languages`, and
|
|
108
|
+
whether WebRTC offers any candidate outside the proxy. Then it compares the
|
|
109
|
+
timezone, languages, screen and WebRTC candidates with the exit and reads
|
|
110
|
+
deviceandbrowserinfo.com, BrowserScan, CreepJS and bot.sannysoft.com. It prints
|
|
111
|
+
one line per check, never an address, and exits with 1 if any check failed
|
|
112
|
+
(`--json` for scripts):
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
workers ok no Headless in page, worker or service worker
|
|
116
|
+
client hints ok platformVersion 10.0.0, 2 brands
|
|
117
|
+
accept-language ok header matches navigator.languages
|
|
118
|
+
webrtc policy ok no candidate outside the proxy
|
|
119
|
+
timezone ok Europe/Berlin, exit Europe/Berlin
|
|
120
|
+
languages ok de-DE,de,en-US,en
|
|
121
|
+
webrtc ok no other address
|
|
122
|
+
screen ok 1920x1080, work area 1920x1040
|
|
123
|
+
user agent ok no Headless
|
|
124
|
+
deviceandbrowserinfo ok human
|
|
125
|
+
browserscan ok normal
|
|
126
|
+
creepjs headless ok 0%
|
|
127
|
+
creepjs like-headless info 25% (a desktop Chrome reads 19-25%)
|
|
128
|
+
sannysoft ok 58 rows, none failed
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## AI agents (MCP)
|
|
132
|
+
|
|
133
|
+
`stealthmaven mcp` is a Model Context Protocol server that drives one browser
|
|
134
|
+
with the identity: `open_page`, `snapshot` (the page's accessibility tree with
|
|
135
|
+
element refs), `click`, `type`, `press`, `scroll`, `back`, `extract_text`,
|
|
136
|
+
`screenshot`, `identity` and `new_identity`.
|
|
137
|
+
|
|
138
|
+
Over stdio, for Claude Code, Claude Desktop, Cursor and other local clients:
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{"command": "stealthmaven", "args": ["mcp", "--country", "us"],
|
|
142
|
+
"env": {"NODEMAVEN_LOGIN": "...", "NODEMAVEN_PASSWORD": "..."}}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
claude mcp add stealthmaven -- stealthmaven mcp --country us
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Over Streamable HTTP, for clients that connect to a URL:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
stealthmaven mcp --http --country us # http://127.0.0.1:8931/mcp
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
It listens on 127.0.0.1 only and refuses requests whose `Host` or `Origin` is
|
|
156
|
+
not this machine, so a web page cannot reach it through your browser. To expose
|
|
157
|
+
it through a tunnel, set a token and name the tunnel's host; clients then send
|
|
158
|
+
`Authorization: Bearer <token>`:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
export STEALTHMAVEN_MCP_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
|
|
162
|
+
stealthmaven mcp --http --allow-host your-tunnel.example.com
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Without the token anyone who finds the URL drives the browser through your
|
|
166
|
+
proxy, so `--allow-host` refuses to start without one. On 127.0.0.1 alone the
|
|
167
|
+
token is optional, and without it any program on this machine can connect; the
|
|
168
|
+
server keeps one session, and a new `initialize` replaces it. Set the token to
|
|
169
|
+
keep the browser to your client.
|
|
170
|
+
|
|
171
|
+
## Other tools over CDP
|
|
172
|
+
|
|
173
|
+
`stealthmaven serve` (or `launch(cdp_port=0)`) starts the browser with the
|
|
174
|
+
identity and prints a Chrome DevTools endpoint on 127.0.0.1:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
stealthmaven serve --country us
|
|
178
|
+
# http://127.0.0.1:54321
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
from patchright.sync_api import sync_playwright
|
|
183
|
+
|
|
184
|
+
with sync_playwright() as p:
|
|
185
|
+
browser = p.chromium.connect_over_cdp("http://127.0.0.1:54321")
|
|
186
|
+
page = browser.contexts[0].new_page()
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The client that connects decides how visible the automation is: patchright's
|
|
190
|
+
`connect_over_cdp` keeps it hidden, while stock Playwright and Puppeteer
|
|
191
|
+
announce themselves over CDP in ways detectors such as deviceandbrowserinfo.com
|
|
192
|
+
read. Tools built on them can still drive the browser.
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT. stealthmaven is made by [NodeMaven](https://nodemaven.com/?utm_source=github&utm_medium=readme&utm_campaign=stealthmaven&utm_content=footer),
|
|
197
|
+
which sells residential and mobile proxies; it works with any provider.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"] # PEP 639 license fields
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stealthmaven"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Stealth Chromium for scraping and AI agents: a real browser whose timezone, language and WebRTC match its proxy exit. Python API, CDP and MCP."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
authors = [{ name = "NodeMaven" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"antidetect-browser",
|
|
16
|
+
"stealth-browser",
|
|
17
|
+
"playwright",
|
|
18
|
+
"patchright",
|
|
19
|
+
"chromium",
|
|
20
|
+
"web-scraping",
|
|
21
|
+
"proxy",
|
|
22
|
+
"residential-proxy",
|
|
23
|
+
"mcp",
|
|
24
|
+
"ai-agents",
|
|
25
|
+
]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 3 - Alpha",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"Operating System :: Microsoft :: Windows",
|
|
30
|
+
"Operating System :: POSIX :: Linux",
|
|
31
|
+
"Operating System :: MacOS",
|
|
32
|
+
"Programming Language :: Python :: 3",
|
|
33
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
34
|
+
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
|
35
|
+
"Topic :: Software Development :: Testing",
|
|
36
|
+
]
|
|
37
|
+
dependencies = [
|
|
38
|
+
# Pinned: each patchright release ships a different Chromium, and the
|
|
39
|
+
# browser build is part of what a site sees.
|
|
40
|
+
"patchright==1.64.3",
|
|
41
|
+
# Builds sticky-session usernames for NodeMaven's gateway; stdlib-only.
|
|
42
|
+
"nodemaven>=0.1.7",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.optional-dependencies]
|
|
46
|
+
# Firefox with its own fingerprint, as a second engine (`engine="camoufox"`).
|
|
47
|
+
camoufox = ["camoufox>=0.5.9"]
|
|
48
|
+
dev = ["pytest>=8", "ruff>=0.6"]
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
stealthmaven = "stealthmaven.cli:main"
|
|
52
|
+
|
|
53
|
+
[project.urls]
|
|
54
|
+
Homepage = "https://nodemaven.com/?utm_source=pypi&utm_medium=project&utm_campaign=stealthmaven"
|
|
55
|
+
Documentation = "https://github.com/nodemaven/stealthmaven#readme"
|
|
56
|
+
Source = "https://github.com/nodemaven/stealthmaven"
|
|
57
|
+
Issues = "https://github.com/nodemaven/stealthmaven/issues"
|
|
58
|
+
|
|
59
|
+
[tool.setuptools.packages.find]
|
|
60
|
+
where = ["src"]
|
|
61
|
+
|
|
62
|
+
[tool.setuptools.package-data]
|
|
63
|
+
stealthmaven = ["assets/*.svg"]
|
|
64
|
+
|
|
65
|
+
[tool.pytest.ini_options]
|
|
66
|
+
testpaths = ["tests"]
|
|
67
|
+
pythonpath = ["src"]
|
|
68
|
+
|
|
69
|
+
[tool.ruff]
|
|
70
|
+
line-length = 100
|
|
71
|
+
target-version = "py310"
|
|
72
|
+
|
|
73
|
+
[tool.ruff.lint]
|
|
74
|
+
select = ["E", "F", "W", "I", "B", "UP", "C901"]
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint.mccabe]
|
|
77
|
+
max-complexity = 10
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""stealthmaven: a real Chromium whose timezone, languages and WebRTC match its proxy exit."""
|
|
2
|
+
|
|
3
|
+
from .browser import Browser, NoProxyWarning, launch
|
|
4
|
+
from .geo import Exit, LookupFailed
|
|
5
|
+
from .identity import Identity
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
__all__ = [
|
|
9
|
+
"Browser",
|
|
10
|
+
"Exit",
|
|
11
|
+
"Identity",
|
|
12
|
+
"LookupFailed",
|
|
13
|
+
"NoProxyWarning",
|
|
14
|
+
"launch",
|
|
15
|
+
"__version__",
|
|
16
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<svg viewBox="0 0 133 160" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M45.0258 90.8567V144.727L0 118.193V42.6147L65.1265 4.8252L70.7549 16.0816L45.8298 30.5542L87.6394 69.9519V16.0816L132.665 42.6147V118.193L68.3427 155.179L61.9104 144.727L86.0314 130.254L45.0258 90.8567ZM12.8645 110.957V49.8511L34.5733 36.9864L106.936 105.329V88.4445L99.6997 81.2081V37.7904L119.8 49.8511V110.957L97.2876 123.822L25.729 55.479V73.168L32.9653 79.6V123.018L12.8645 110.957Z" fill="url(#nm0)"/>
|
|
3
|
+
<path d="M77.9895 11.2564C77.9895 17.4732 72.9498 22.5129 66.7332 22.5129C60.5166 22.5129 55.4766 17.4732 55.4766 11.2564C55.4766 5.03967 60.5166 0 66.7332 0C72.9498 0 77.9895 5.03967 77.9895 11.2564Z" fill="url(#nm1)"/>
|
|
4
|
+
<path d="M77.9895 148.744C77.9895 154.96 72.9498 160 66.7332 160C60.5166 160 55.4766 154.96 55.4766 148.744C55.4766 142.527 60.5166 137.487 66.7332 137.487C72.9498 137.487 77.9895 142.527 77.9895 148.744Z" fill="url(#nm2)"/>
|
|
5
|
+
<defs>
|
|
6
|
+
<linearGradient id="nm0" x1="66.3324" y1="0.00100541" x2="66.3324" y2="160.003" gradientUnits="userSpaceOnUse">
|
|
7
|
+
<stop stop-color="#4783F2"/>
|
|
8
|
+
<stop offset="1" stop-color="#23E6A8"/>
|
|
9
|
+
</linearGradient>
|
|
10
|
+
<linearGradient id="nm1" x1="66.331" y1="0" x2="66.331" y2="160.002" gradientUnits="userSpaceOnUse">
|
|
11
|
+
<stop stop-color="#4783F2"/>
|
|
12
|
+
<stop offset="1" stop-color="#23E6A8"/>
|
|
13
|
+
</linearGradient>
|
|
14
|
+
<linearGradient id="nm2" x1="66.331" y1="-0.00220857" x2="66.331" y2="160" gradientUnits="userSpaceOnUse">
|
|
15
|
+
<stop stop-color="#4783F2"/>
|
|
16
|
+
<stop offset="1" stop-color="#23E6A8"/>
|
|
17
|
+
</linearGradient>
|
|
18
|
+
</defs>
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""What carries the NodeMaven name: links, the mark, the start page of `open`, the CLI
|
|
2
|
+
banner. Nothing here reaches a page the browser visits - the start page is shown only
|
|
3
|
+
in `stealthmaven open` without a URL, as local content with no requests and no
|
|
4
|
+
scripts bound to the page.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from html import escape
|
|
10
|
+
from importlib.resources import files
|
|
11
|
+
|
|
12
|
+
from . import __version__
|
|
13
|
+
|
|
14
|
+
NAME = "stealthmaven"
|
|
15
|
+
BY = "by NodeMaven"
|
|
16
|
+
REPO = "https://github.com/nodemaven/stealthmaven"
|
|
17
|
+
SITE = (
|
|
18
|
+
"https://nodemaven.com/?utm_source=stealthmaven&utm_medium={medium}&utm_campaign=stealthmaven"
|
|
19
|
+
)
|
|
20
|
+
SIGNUP = (
|
|
21
|
+
"https://dashboard.nodemaven.com/accounts/signup/"
|
|
22
|
+
"?utm_source=stealthmaven&utm_medium={medium}&utm_campaign=stealthmaven"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
#: NodeMaven's mark, as in the organisation's GitHub assets.
|
|
26
|
+
MARK_SVG = files(__package__).joinpath("assets/nodemaven-mark.svg").read_text(encoding="utf-8")
|
|
27
|
+
|
|
28
|
+
#: The pages `stealthmaven check` reads, offered on the start page as plain links.
|
|
29
|
+
DETECTORS = (
|
|
30
|
+
("deviceandbrowserinfo.com", "https://deviceandbrowserinfo.com/are_you_a_bot"),
|
|
31
|
+
("BrowserScan", "https://www.browserscan.net/bot-detection"),
|
|
32
|
+
("CreepJS", "https://abrahamjuliot.github.io/creepjs/"),
|
|
33
|
+
("bot.sannysoft.com", "https://bot.sannysoft.com/"),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def banner() -> str:
|
|
38
|
+
return f"{NAME} {__version__} {BY}"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def signup(medium: str = "cli") -> str:
|
|
42
|
+
return SIGNUP.format(medium=medium)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def start_page(ident, proxy: str, screen=None) -> str:
|
|
46
|
+
"""The page `stealthmaven open` shows when no URL is given: who this browser is."""
|
|
47
|
+
where = "not looked up"
|
|
48
|
+
if ident.exit:
|
|
49
|
+
where = ident.exit.country + (f", {ident.exit.city}" if ident.exit.city else "")
|
|
50
|
+
rows = [
|
|
51
|
+
("Exit", where),
|
|
52
|
+
("Timezone", ident.timezone or "this machine's"),
|
|
53
|
+
("Languages", ", ".join(ident.languages)),
|
|
54
|
+
("Proxy", proxy),
|
|
55
|
+
]
|
|
56
|
+
if screen:
|
|
57
|
+
rows.append(("Screen", f"{screen[0]}x{screen[1]}, headless"))
|
|
58
|
+
table = "".join(f"<tr><th>{escape(k)}</th><td>{escape(v)}</td></tr>" for k, v in rows)
|
|
59
|
+
links = "".join(f'<a href="{escape(u)}">{escape(n)}</a>' for n, u in DETECTORS)
|
|
60
|
+
site = escape(SITE.format(medium="start_page"))
|
|
61
|
+
return f"""<!doctype html><html lang="en"><head><meta charset="utf-8">
|
|
62
|
+
<title>{NAME}</title><style>
|
|
63
|
+
:root {{ --fg:#0b1220; --muted:#5b6475; --card:#f5f7fb; --line:#e2e7f0; --bg:#ffffff;
|
|
64
|
+
--accent:#1153FC; }}
|
|
65
|
+
@media (prefers-color-scheme: dark) {{ :root {{ --fg:#e8edf7; --muted:#97a1b5;
|
|
66
|
+
--card:#141b2b; --line:#24304a; --bg:#0b1020; --accent:#6f9bff; }} }}
|
|
67
|
+
* {{ box-sizing:border-box }}
|
|
68
|
+
body {{ margin:0; min-height:100vh; display:grid; place-items:center; background:var(--bg);
|
|
69
|
+
color:var(--fg); font:15px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif }}
|
|
70
|
+
main {{ width:min(560px,92vw) }}
|
|
71
|
+
header {{ display:flex; align-items:center; gap:14px; margin-bottom:22px }}
|
|
72
|
+
header svg {{ width:40px; height:48px }}
|
|
73
|
+
h1 {{ margin:0; font-size:26px; letter-spacing:-.01em }}
|
|
74
|
+
.by {{ color:var(--muted); font-size:14px }}
|
|
75
|
+
.by a {{ color:inherit }}
|
|
76
|
+
table {{ width:100%; border-collapse:collapse; background:var(--card); border:1px solid var(--line);
|
|
77
|
+
border-radius:12px; overflow:hidden }}
|
|
78
|
+
th, td {{ text-align:left; padding:10px 14px; border-bottom:1px solid var(--line) }}
|
|
79
|
+
tr:last-child th, tr:last-child td {{ border-bottom:0 }}
|
|
80
|
+
th {{ width:32%; color:var(--muted); font-weight:500 }}
|
|
81
|
+
h2 {{ font-size:14px; color:var(--muted); font-weight:500; margin:26px 0 10px }}
|
|
82
|
+
nav {{ display:flex; flex-wrap:wrap; gap:8px }}
|
|
83
|
+
nav a {{ padding:7px 12px; border:1px solid var(--line); border-radius:8px; color:var(--accent);
|
|
84
|
+
text-decoration:none }}
|
|
85
|
+
nav a:hover {{ border-color:var(--accent) }}
|
|
86
|
+
footer {{ margin-top:26px; color:var(--muted); font-size:13px }}
|
|
87
|
+
footer a {{ color:inherit }}
|
|
88
|
+
</style></head><body><main>
|
|
89
|
+
<header>{MARK_SVG}<div><h1>{NAME}</h1>
|
|
90
|
+
<div class="by">{BY} · <a href="{site}">nodemaven.com</a></div></div></header>
|
|
91
|
+
<table>{table}</table>
|
|
92
|
+
<h2>Check this identity</h2><nav>{links}</nav>
|
|
93
|
+
<footer>{NAME} {__version__} · <a href="{REPO}">{REPO.removeprefix("https://")}</a>
|
|
94
|
+
· or run <code>stealthmaven check</code></footer>
|
|
95
|
+
</main></body></html>"""
|