zealium 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.
- zealium-0.1.0/PKG-INFO +133 -0
- zealium-0.1.0/README.md +117 -0
- zealium-0.1.0/pyproject.toml +24 -0
- zealium-0.1.0/src/zealium/__init__.py +5 -0
- zealium-0.1.0/src/zealium/core.py +169 -0
- zealium-0.1.0/src/zealium/human.py +278 -0
- zealium-0.1.0/src/zealium/injections/audio_oscillator_patch.js +14 -0
- zealium-0.1.0/src/zealium/injections/canvas_noise.js +20 -0
- zealium-0.1.0/src/zealium/injections/intl_datetime_patch.js +12 -0
- zealium-0.1.0/src/zealium/injections/mock_audio_fingerprint.js +10 -0
- zealium-0.1.0/src/zealium/injections/mock_chrome_runtime.js +5 -0
- zealium-0.1.0/src/zealium/injections/mock_media_devices.js +18 -0
- zealium-0.1.0/src/zealium/injections/mock_navigator_connection.js +10 -0
- zealium-0.1.0/src/zealium/injections/mock_navigator_plugins_and_mimetypes.js +8 -0
- zealium-0.1.0/src/zealium/injections/mock_webrtc.js +5 -0
- zealium-0.1.0/src/zealium/injections/navigator_properties.js +13 -0
- zealium-0.1.0/src/zealium/injections/override_function_toString.js +12 -0
- zealium-0.1.0/src/zealium/injections/permissions_query_patch.js +9 -0
- zealium-0.1.0/src/zealium/injections/rtc_peerconnection_patch.js +5 -0
- zealium-0.1.0/src/zealium/injections/screen_properties.js +9 -0
- zealium-0.1.0/src/zealium/injections/spoof_canvas_fingerprint.js +9 -0
- zealium-0.1.0/src/zealium/injections/spoof_webgl_precision.js +10 -0
- zealium-0.1.0/src/zealium/injections/stealth_injection.js +83 -0
- zealium-0.1.0/src/zealium/injections/webgl_spoof.js +8 -0
- zealium-0.1.0/src/zealium/stealth.py +70 -0
zealium-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: zealium
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A stealthy Chromium remote-control tool using DevTools Protocol with dynamic JS injection to evade bot detection.
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: Renks
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Dist: pychrome (>=0.2.4,<0.3.0)
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
Sure! Here's a professional README.md draft in English for your **zealium** project, focused on stealth Chromium automation, human behavior simulation, and anti-bot fingerprint evasion:
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# Zealium
|
|
22
|
+
|
|
23
|
+
**Zealium** is a stealthy Chromium remote-control toolkit leveraging the Chrome DevTools Protocol with dynamic JavaScript injection to evade bot detection. It provides multi-layered anti-fingerprinting patches, human-like interaction simulation, and robust stealth capabilities for advanced browser automation.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Stealth Browser Automation:**
|
|
30
|
+
Control Chromium-based browsers (Chrome, Edge) remotely with powerful stealth techniques to bypass modern bot detection systems and CAPTCHAs.
|
|
31
|
+
|
|
32
|
+
- **Dynamic JS Injection:**
|
|
33
|
+
Inject custom JavaScript patches at runtime to spoof browser fingerprints, including canvas, WebGL, audio, navigator properties, media devices, WebRTC, permissions, and more.
|
|
34
|
+
|
|
35
|
+
- **Human Behavior Simulation:**
|
|
36
|
+
Simulate natural mouse movements, clicks, scrolling, and typing with randomized, non-linear patterns, hesitations, and noise to mimic real user interactions.
|
|
37
|
+
|
|
38
|
+
- **Cross-Platform Support:**
|
|
39
|
+
Compatible with Windows, macOS, and Linux environments, detecting browser executables and managing user profiles seamlessly.
|
|
40
|
+
|
|
41
|
+
- **Customizable Stealth Levels:**
|
|
42
|
+
Choose from multiple preset stealth configurations (`low`, `normal`, `strict`), or supply your own patch methods for tailored stealth strategies.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
Requires Python 3.11+ and a Chromium-based browser installed.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install zealium
|
|
52
|
+
````
|
|
53
|
+
|
|
54
|
+
Or install dependencies manually with Poetry:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
poetry install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Usage Example
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from zealium.core import Zealium
|
|
66
|
+
|
|
67
|
+
# Launch browser with stealth
|
|
68
|
+
zealium = Zealium(browser="chrome", stealth_level="normal")
|
|
69
|
+
zealium.launch()
|
|
70
|
+
|
|
71
|
+
# Use human behavior simulator to type text
|
|
72
|
+
zealium.human.type_text("Hello, Zealium!")
|
|
73
|
+
|
|
74
|
+
# Interact stealthily via DevTools Protocol...
|
|
75
|
+
|
|
76
|
+
# Clean up
|
|
77
|
+
zealium.close()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Stealth Toolkit
|
|
83
|
+
|
|
84
|
+
Zealium includes a collection of JavaScript patches injected into the browser context to evade detection, such as:
|
|
85
|
+
|
|
86
|
+
* Spoofing `navigator.webdriver` and other common bot signals
|
|
87
|
+
* Canvas fingerprint noise and spoofing
|
|
88
|
+
* WebGL precision spoofing
|
|
89
|
+
* Overriding `Function.prototype.toString`
|
|
90
|
+
* Mocking `navigator.plugins` and `navigator.mimeTypes`
|
|
91
|
+
* Faking `chrome.runtime`
|
|
92
|
+
* Neutralizing WebRTC IP leaks
|
|
93
|
+
* Audio context fingerprint mitigation
|
|
94
|
+
* Mocking media devices and permissions queries
|
|
95
|
+
* Spoofing screen properties and Intl DateTime formatting
|
|
96
|
+
|
|
97
|
+
Stealth levels control which patches are applied:
|
|
98
|
+
|
|
99
|
+
* `low`: Basic evasion
|
|
100
|
+
* `normal`: Moderate stealth
|
|
101
|
+
* `strict`: Comprehensive patching
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Human Behavior Simulation
|
|
106
|
+
|
|
107
|
+
The `HumanBehaviorSimulator` mimics real user input with:
|
|
108
|
+
|
|
109
|
+
* Natural mouse movement with Bezier curves and noise
|
|
110
|
+
* Randomized pauses and hesitations
|
|
111
|
+
* Realistic typing with variable delays and error simulation
|
|
112
|
+
* Scrolling with randomized deltas
|
|
113
|
+
|
|
114
|
+
These features reduce detection by behavior analysis systems.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Project Structure
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
zealium/
|
|
122
|
+
├── core.py # Main controller for browser launch, stealth, human simulation
|
|
123
|
+
├── human.py # Human input simulation (mouse, keyboard)
|
|
124
|
+
├── stealth.py # JS stealth injection toolkit
|
|
125
|
+
└── injections/ # JS patches for fingerprint spoofing
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Disclaimer
|
|
131
|
+
|
|
132
|
+
Zealium is intended for educational and ethical automation use only. Misuse to violate terms of service or conduct unauthorized scraping may be illegal. Use responsibly.
|
|
133
|
+
|
zealium-0.1.0/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Sure! Here's a professional README.md draft in English for your **zealium** project, focused on stealth Chromium automation, human behavior simulation, and anti-bot fingerprint evasion:
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Zealium
|
|
7
|
+
|
|
8
|
+
**Zealium** is a stealthy Chromium remote-control toolkit leveraging the Chrome DevTools Protocol with dynamic JavaScript injection to evade bot detection. It provides multi-layered anti-fingerprinting patches, human-like interaction simulation, and robust stealth capabilities for advanced browser automation.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Stealth Browser Automation:**
|
|
15
|
+
Control Chromium-based browsers (Chrome, Edge) remotely with powerful stealth techniques to bypass modern bot detection systems and CAPTCHAs.
|
|
16
|
+
|
|
17
|
+
- **Dynamic JS Injection:**
|
|
18
|
+
Inject custom JavaScript patches at runtime to spoof browser fingerprints, including canvas, WebGL, audio, navigator properties, media devices, WebRTC, permissions, and more.
|
|
19
|
+
|
|
20
|
+
- **Human Behavior Simulation:**
|
|
21
|
+
Simulate natural mouse movements, clicks, scrolling, and typing with randomized, non-linear patterns, hesitations, and noise to mimic real user interactions.
|
|
22
|
+
|
|
23
|
+
- **Cross-Platform Support:**
|
|
24
|
+
Compatible with Windows, macOS, and Linux environments, detecting browser executables and managing user profiles seamlessly.
|
|
25
|
+
|
|
26
|
+
- **Customizable Stealth Levels:**
|
|
27
|
+
Choose from multiple preset stealth configurations (`low`, `normal`, `strict`), or supply your own patch methods for tailored stealth strategies.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Requires Python 3.11+ and a Chromium-based browser installed.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install zealium
|
|
37
|
+
````
|
|
38
|
+
|
|
39
|
+
Or install dependencies manually with Poetry:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
poetry install
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Usage Example
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from zealium.core import Zealium
|
|
51
|
+
|
|
52
|
+
# Launch browser with stealth
|
|
53
|
+
zealium = Zealium(browser="chrome", stealth_level="normal")
|
|
54
|
+
zealium.launch()
|
|
55
|
+
|
|
56
|
+
# Use human behavior simulator to type text
|
|
57
|
+
zealium.human.type_text("Hello, Zealium!")
|
|
58
|
+
|
|
59
|
+
# Interact stealthily via DevTools Protocol...
|
|
60
|
+
|
|
61
|
+
# Clean up
|
|
62
|
+
zealium.close()
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Stealth Toolkit
|
|
68
|
+
|
|
69
|
+
Zealium includes a collection of JavaScript patches injected into the browser context to evade detection, such as:
|
|
70
|
+
|
|
71
|
+
* Spoofing `navigator.webdriver` and other common bot signals
|
|
72
|
+
* Canvas fingerprint noise and spoofing
|
|
73
|
+
* WebGL precision spoofing
|
|
74
|
+
* Overriding `Function.prototype.toString`
|
|
75
|
+
* Mocking `navigator.plugins` and `navigator.mimeTypes`
|
|
76
|
+
* Faking `chrome.runtime`
|
|
77
|
+
* Neutralizing WebRTC IP leaks
|
|
78
|
+
* Audio context fingerprint mitigation
|
|
79
|
+
* Mocking media devices and permissions queries
|
|
80
|
+
* Spoofing screen properties and Intl DateTime formatting
|
|
81
|
+
|
|
82
|
+
Stealth levels control which patches are applied:
|
|
83
|
+
|
|
84
|
+
* `low`: Basic evasion
|
|
85
|
+
* `normal`: Moderate stealth
|
|
86
|
+
* `strict`: Comprehensive patching
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Human Behavior Simulation
|
|
91
|
+
|
|
92
|
+
The `HumanBehaviorSimulator` mimics real user input with:
|
|
93
|
+
|
|
94
|
+
* Natural mouse movement with Bezier curves and noise
|
|
95
|
+
* Randomized pauses and hesitations
|
|
96
|
+
* Realistic typing with variable delays and error simulation
|
|
97
|
+
* Scrolling with randomized deltas
|
|
98
|
+
|
|
99
|
+
These features reduce detection by behavior analysis systems.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Project Structure
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
zealium/
|
|
107
|
+
├── core.py # Main controller for browser launch, stealth, human simulation
|
|
108
|
+
├── human.py # Human input simulation (mouse, keyboard)
|
|
109
|
+
├── stealth.py # JS stealth injection toolkit
|
|
110
|
+
└── injections/ # JS patches for fingerprint spoofing
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Disclaimer
|
|
116
|
+
|
|
117
|
+
Zealium is intended for educational and ethical automation use only. Misuse to violate terms of service or conduct unauthorized scraping may be illegal. Use responsibly.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "zealium"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A stealthy Chromium remote-control tool using DevTools Protocol with dynamic JS injection to evade bot detection."
|
|
5
|
+
authors = [{name = "Renks"}]
|
|
6
|
+
license = {text = "MIT"}
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"pychrome (>=0.2.4,<0.3.0)"
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
packages = [
|
|
14
|
+
{ include = "zealium", from = "src" }
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
include = [
|
|
19
|
+
{ path = "src/zealium/injections/*.js", format = "file" }
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[build-system]
|
|
23
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
24
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
from .human import HumanBehaviorSimulator
|
|
2
|
+
from .stealth import StealthToolkit
|
|
3
|
+
import urllib.request
|
|
4
|
+
import urllib.error
|
|
5
|
+
import subprocess
|
|
6
|
+
import pychrome
|
|
7
|
+
import platform
|
|
8
|
+
import shutil
|
|
9
|
+
import time
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
|
|
13
|
+
_original_recv_loop = pychrome.Tab._recv_loop
|
|
14
|
+
|
|
15
|
+
def _safe_recv_loop(self):
|
|
16
|
+
try:
|
|
17
|
+
_original_recv_loop(self)
|
|
18
|
+
except json.decoder.JSONDecodeError:
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
pychrome.Tab._recv_loop = _safe_recv_loop
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Zealium:
|
|
25
|
+
def __init__(self,
|
|
26
|
+
browser="chrome",
|
|
27
|
+
chrome_path=None,
|
|
28
|
+
remote_debugging_port=9222,
|
|
29
|
+
user_data_dir=None,
|
|
30
|
+
lang="en-US",
|
|
31
|
+
window_size="1280,800",
|
|
32
|
+
speed_threshold=1.0,
|
|
33
|
+
stealth_level="normal",
|
|
34
|
+
stealth_custom_methods=None):
|
|
35
|
+
|
|
36
|
+
if browser not in ("chrome", "edge"):
|
|
37
|
+
raise ValueError(f"Browser '{browser}' not supported. Use 'chrome' or 'edge'.")
|
|
38
|
+
|
|
39
|
+
self.browser_choice = browser
|
|
40
|
+
self.remote_debugging_port = remote_debugging_port
|
|
41
|
+
self.lang = lang
|
|
42
|
+
self.window_size = window_size
|
|
43
|
+
self.speed_threshold = speed_threshold
|
|
44
|
+
self.chrome_proc = None
|
|
45
|
+
self.browser = None
|
|
46
|
+
self.tab = None
|
|
47
|
+
self.human = None
|
|
48
|
+
self.stealth_level = stealth_level
|
|
49
|
+
self.stealth_custom_methods = stealth_custom_methods or []
|
|
50
|
+
|
|
51
|
+
system = platform.system()
|
|
52
|
+
home = os.path.expanduser("~")
|
|
53
|
+
|
|
54
|
+
browser_exec_paths = {
|
|
55
|
+
"Windows": {
|
|
56
|
+
"chrome": [
|
|
57
|
+
os.path.join(os.environ.get("PROGRAMFILES(X86)", ""), "Google\\Chrome\\Application\\chrome.exe"),
|
|
58
|
+
os.path.join(os.environ.get("PROGRAMFILES", ""), "Google\\Chrome\\Application\\chrome.exe"),
|
|
59
|
+
os.path.join(os.environ.get("LOCALAPPDATA", ""), "Google\\Chrome\\Application\\chrome.exe")
|
|
60
|
+
],
|
|
61
|
+
"edge": [
|
|
62
|
+
os.path.join(os.environ.get("PROGRAMFILES(X86)", ""), "Microsoft\\Edge\\Application\\msedge.exe"),
|
|
63
|
+
os.path.join(os.environ.get("PROGRAMFILES", ""), "Microsoft\\Edge\\Application\\msedge.exe"),
|
|
64
|
+
os.path.join(os.environ.get("LOCALAPPDATA", ""), "Microsoft\\Edge\\Application\\msedge.exe")
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"Darwin": {
|
|
68
|
+
"chrome": ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"],
|
|
69
|
+
"edge": ["/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"]
|
|
70
|
+
},
|
|
71
|
+
"Linux": {
|
|
72
|
+
"chrome": [shutil.which("google-chrome"), shutil.which("chromium"), shutil.which("chromium-browser")],
|
|
73
|
+
"edge": [shutil.which("microsoft-edge"), shutil.which("microsoft-edge-dev")]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
profile_base_dirs = {
|
|
78
|
+
"Windows": lambda b: os.path.join(
|
|
79
|
+
os.environ.get("USERPROFILE", ""),
|
|
80
|
+
"AppData", "Local",
|
|
81
|
+
"Google" if b == "chrome" else "Microsoft",
|
|
82
|
+
b.capitalize(), "User Data", "BotProfile"
|
|
83
|
+
),
|
|
84
|
+
"Darwin": lambda b: os.path.join(
|
|
85
|
+
home, "Library", "Application Support",
|
|
86
|
+
"Google" if b == "chrome" else "Microsoft",
|
|
87
|
+
b.capitalize(), "BotProfile"
|
|
88
|
+
),
|
|
89
|
+
"Linux": lambda b: os.path.join(home, f".{b}-bot-profile")
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if system not in browser_exec_paths or system not in profile_base_dirs:
|
|
93
|
+
raise EnvironmentError(f"OS not supported: {system}")
|
|
94
|
+
|
|
95
|
+
exec_candidates = browser_exec_paths[system][browser]
|
|
96
|
+
self.chrome_path = chrome_path or next((p for p in exec_candidates if p and os.path.isfile(p)), None)
|
|
97
|
+
|
|
98
|
+
if not self.chrome_path:
|
|
99
|
+
raise FileNotFoundError(f"{browser.capitalize()} not found on system {system}")
|
|
100
|
+
|
|
101
|
+
if system == "Windows" and not os.environ.get("USERPROFILE"):
|
|
102
|
+
raise EnvironmentError("Env Variable USERPROFILE not found")
|
|
103
|
+
self.user_data_dir = user_data_dir or profile_base_dirs[system](browser)
|
|
104
|
+
|
|
105
|
+
self.stealth_toolkit = None
|
|
106
|
+
|
|
107
|
+
def await_proc(self, timeout=15, interval=0.5):
|
|
108
|
+
start = time.time()
|
|
109
|
+
url = f"http://127.0.0.1:{self.remote_debugging_port}/json/version"
|
|
110
|
+
|
|
111
|
+
while True:
|
|
112
|
+
try:
|
|
113
|
+
with urllib.request.urlopen(url, timeout=1) as response:
|
|
114
|
+
if response.status == 200:
|
|
115
|
+
return True
|
|
116
|
+
except urllib.error.URLError as e:
|
|
117
|
+
|
|
118
|
+
if isinstance(e.reason, ConnectionRefusedError):
|
|
119
|
+
pass
|
|
120
|
+
else:
|
|
121
|
+
raise
|
|
122
|
+
except Exception as e:
|
|
123
|
+
raise e
|
|
124
|
+
|
|
125
|
+
if time.time() - start > timeout:
|
|
126
|
+
raise TimeoutError(f"{self.browser_choice.capitalize()} DevTools without response after {timeout}s")
|
|
127
|
+
time.sleep(interval)
|
|
128
|
+
|
|
129
|
+
def launch(self):
|
|
130
|
+
flags = [
|
|
131
|
+
self.chrome_path,
|
|
132
|
+
f"--remote-debugging-port={self.remote_debugging_port}",
|
|
133
|
+
f"--user-data-dir={self.user_data_dir}_{self.remote_debugging_port}",
|
|
134
|
+
"--no-first-run",
|
|
135
|
+
"--disable-extensions",
|
|
136
|
+
f"--lang={self.lang}",
|
|
137
|
+
f"--window-size={self.window_size}",
|
|
138
|
+
"--start-maximized",
|
|
139
|
+
"--disable-blink-features=AutomationControlled"
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
self.chrome_proc = subprocess.Popen(flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
143
|
+
self.await_proc()
|
|
144
|
+
|
|
145
|
+
self.browser = pychrome.Browser(url=f"http://127.0.0.1:{self.remote_debugging_port}")
|
|
146
|
+
self.tab = self._get_active_tab()
|
|
147
|
+
self.tab.start()
|
|
148
|
+
|
|
149
|
+
self.human = HumanBehaviorSimulator(self.tab, speed_factor=self.speed_threshold)
|
|
150
|
+
|
|
151
|
+
self.stealth_toolkit = StealthToolkit(
|
|
152
|
+
tab=self.tab,
|
|
153
|
+
level=self.stealth_level,
|
|
154
|
+
custom_methods=self.stealth_custom_methods
|
|
155
|
+
)
|
|
156
|
+
self.stealth_toolkit.apply()
|
|
157
|
+
|
|
158
|
+
def _get_active_tab(self):
|
|
159
|
+
tabs = self.browser.list_tab()
|
|
160
|
+
if not tabs:
|
|
161
|
+
raise Exception("No tab on browser detected")
|
|
162
|
+
return tabs[0]
|
|
163
|
+
|
|
164
|
+
def close(self):
|
|
165
|
+
if self.tab:
|
|
166
|
+
self.tab.stop()
|
|
167
|
+
if self.chrome_proc:
|
|
168
|
+
self.chrome_proc.terminate()
|
|
169
|
+
self.chrome_proc.wait()
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
from pychrome.tab import Tab
|
|
2
|
+
import threading
|
|
3
|
+
import random
|
|
4
|
+
import time
|
|
5
|
+
import math
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def cubic_bezier(p0, p1, p2, p3, t):
|
|
9
|
+
u = 1 - t
|
|
10
|
+
tt = t * t
|
|
11
|
+
uu = u * u
|
|
12
|
+
uuu = uu * u
|
|
13
|
+
ttt = tt * t
|
|
14
|
+
x = uuu * p0[0] + 3 * uu * t * p1[0] + 3 * u * tt * p2[0] + ttt * p3[0]
|
|
15
|
+
y = uuu * p0[1] + 3 * uu * t * p1[1] + 3 * u * tt * p2[1] + ttt * p3[1]
|
|
16
|
+
return (x, y)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def ease_in_out(t):
|
|
20
|
+
return t * t * (3 - 2 * t)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def distance(p1, p2):
|
|
24
|
+
return math.hypot(p2[0] - p1[0], p2[1] - p1[1])
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class HumanMouseMover:
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
tab: Tab,
|
|
31
|
+
move_area=((100, 100), (1400, 800)),
|
|
32
|
+
min_curve_steps=30,
|
|
33
|
+
max_curve_steps=50,
|
|
34
|
+
pause_chance=0.02,
|
|
35
|
+
pause_duration_range=(0.1, 0.4),
|
|
36
|
+
) -> None:
|
|
37
|
+
self.tab = tab
|
|
38
|
+
self.running = False
|
|
39
|
+
self.paused = False
|
|
40
|
+
self._lock = threading.Lock()
|
|
41
|
+
self.thread = threading.Thread(target=self._move_loop, daemon=True)
|
|
42
|
+
|
|
43
|
+
self.current_pos = (800, 400)
|
|
44
|
+
self.target_pos = None
|
|
45
|
+
self._curve_points = None
|
|
46
|
+
self._curve_step = 0
|
|
47
|
+
self._curve_steps = 0
|
|
48
|
+
self._move_area = move_area
|
|
49
|
+
self._min_curve_steps = min_curve_steps
|
|
50
|
+
self._max_curve_steps = max_curve_steps
|
|
51
|
+
self._pause_chance = pause_chance
|
|
52
|
+
self._pause_duration_range = pause_duration_range
|
|
53
|
+
|
|
54
|
+
self._multi_curve_queue = []
|
|
55
|
+
|
|
56
|
+
def start(self) -> None:
|
|
57
|
+
self.running = True
|
|
58
|
+
self.thread.start()
|
|
59
|
+
|
|
60
|
+
def stop(self) -> None:
|
|
61
|
+
if self.running:
|
|
62
|
+
self.running = False
|
|
63
|
+
if self.thread.is_alive():
|
|
64
|
+
self.thread.join(timeout=2)
|
|
65
|
+
|
|
66
|
+
def pause(self) -> None:
|
|
67
|
+
with self._lock:
|
|
68
|
+
self.paused = True
|
|
69
|
+
|
|
70
|
+
def resume(self) -> None:
|
|
71
|
+
with self._lock:
|
|
72
|
+
self.paused = False
|
|
73
|
+
|
|
74
|
+
def _generate_next_target(self):
|
|
75
|
+
x = random.uniform(self._move_area[0][0], self._move_area[1][0])
|
|
76
|
+
y = random.uniform(self._move_area[0][1], self._move_area[1][1])
|
|
77
|
+
return (x, y)
|
|
78
|
+
|
|
79
|
+
def _generate_bezier_control_points(self, start, end):
|
|
80
|
+
dx = end[0] - start[0]
|
|
81
|
+
dy = end[1] - start[1]
|
|
82
|
+
distance_val = max(distance(start, end), 1)
|
|
83
|
+
norm_dx = dx / distance_val
|
|
84
|
+
norm_dy = dy / distance_val
|
|
85
|
+
|
|
86
|
+
cp1 = (
|
|
87
|
+
start[0] + dx * random.uniform(0.25, 0.4) + norm_dy * random.uniform(-distance_val * 0.3, distance_val * 0.3),
|
|
88
|
+
start[1] + dy * random.uniform(0.25, 0.4) - norm_dx * random.uniform(-distance_val * 0.3, distance_val * 0.3),
|
|
89
|
+
)
|
|
90
|
+
cp2 = (
|
|
91
|
+
start[0] + dx * random.uniform(0.6, 0.75) + norm_dy * random.uniform(-distance_val * 0.3, distance_val * 0.3),
|
|
92
|
+
start[1] + dy * random.uniform(0.6, 0.75) - norm_dx * random.uniform(-distance_val * 0.3, distance_val * 0.3),
|
|
93
|
+
)
|
|
94
|
+
return cp1, cp2
|
|
95
|
+
|
|
96
|
+
def _enqueue_multi_curve(self, start, end, segments=2):
|
|
97
|
+
points = [start]
|
|
98
|
+
for i in range(1, segments):
|
|
99
|
+
interp = i / segments
|
|
100
|
+
inter_point = (start[0] + (end[0] - start[0]) * interp, start[1] + (end[1] - start[1]) * interp)
|
|
101
|
+
points.append(inter_point)
|
|
102
|
+
points.append(end)
|
|
103
|
+
|
|
104
|
+
curves = []
|
|
105
|
+
for i in range(len(points) - 1):
|
|
106
|
+
cp1, cp2 = self._generate_bezier_control_points(points[i], points[i + 1])
|
|
107
|
+
curves.append((points[i], cp1, cp2, points[i + 1]))
|
|
108
|
+
self._multi_curve_queue.extend(curves)
|
|
109
|
+
|
|
110
|
+
def _should_pause(self):
|
|
111
|
+
return random.random() < self._pause_chance and len(self._multi_curve_queue) == 0
|
|
112
|
+
|
|
113
|
+
def _move_loop(self) -> None:
|
|
114
|
+
while self.running:
|
|
115
|
+
with self._lock:
|
|
116
|
+
if self.paused:
|
|
117
|
+
time.sleep(0.1)
|
|
118
|
+
continue
|
|
119
|
+
|
|
120
|
+
if not self._multi_curve_queue and (self.target_pos is None or distance(self.current_pos, self.target_pos) < 5):
|
|
121
|
+
self.target_pos = self._generate_next_target()
|
|
122
|
+
dist = distance(self.current_pos, self.target_pos)
|
|
123
|
+
|
|
124
|
+
segments = 3 if dist > 300 else 1
|
|
125
|
+
self._enqueue_multi_curve(self.current_pos, self.target_pos, segments=segments)
|
|
126
|
+
|
|
127
|
+
self._curve_step = 0
|
|
128
|
+
self._curve_steps = random.randint(self._min_curve_steps, self._max_curve_steps)
|
|
129
|
+
|
|
130
|
+
if self._multi_curve_queue:
|
|
131
|
+
curve = self._multi_curve_queue[0]
|
|
132
|
+
t_raw = self._curve_step / (self._curve_steps - 1)
|
|
133
|
+
t = ease_in_out(t_raw)
|
|
134
|
+
x, y = cubic_bezier(*curve, t)
|
|
135
|
+
|
|
136
|
+
speed_factor = 1 - abs(t - ease_in_out(max(0, t_raw - 0.05)))
|
|
137
|
+
noise_scale = 3 * speed_factor
|
|
138
|
+
noise_x = random.uniform(-noise_scale, noise_scale)
|
|
139
|
+
noise_y = random.uniform(-noise_scale, noise_scale)
|
|
140
|
+
|
|
141
|
+
x_noisy = x + noise_x
|
|
142
|
+
y_noisy = y + noise_y
|
|
143
|
+
|
|
144
|
+
self.tab.call_method(
|
|
145
|
+
"Input.dispatchMouseEvent",
|
|
146
|
+
type="mouseMoved",
|
|
147
|
+
x=x_noisy,
|
|
148
|
+
y=y_noisy,
|
|
149
|
+
button="none",
|
|
150
|
+
buttons=0,
|
|
151
|
+
clickCount=0,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
self.current_pos = (x, y)
|
|
155
|
+
self._curve_step += 1
|
|
156
|
+
|
|
157
|
+
if self._curve_step >= self._curve_steps:
|
|
158
|
+
self._multi_curve_queue.pop(0)
|
|
159
|
+
self._curve_step = 0
|
|
160
|
+
self._curve_steps = random.randint(self._min_curve_steps, self._max_curve_steps)
|
|
161
|
+
|
|
162
|
+
if not self._multi_curve_queue and self._should_pause():
|
|
163
|
+
time.sleep(max(0, random.uniform(*self._pause_duration_range)))
|
|
164
|
+
|
|
165
|
+
sleep_time = max(0.01, 0.03 - speed_factor * 0.02) + random.uniform(0, 0.01)
|
|
166
|
+
time.sleep(sleep_time)
|
|
167
|
+
else:
|
|
168
|
+
time.sleep(0.05)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class HumanBehaviorSimulator:
|
|
172
|
+
def __init__(self, tab: Tab, speed_factor: float = 1.0) -> None:
|
|
173
|
+
self.tab = tab
|
|
174
|
+
self.speed_factor = max(0.1, speed_factor)
|
|
175
|
+
|
|
176
|
+
def _smooth_step(self, t: float) -> float:
|
|
177
|
+
return t * t * (3 - 2 * t)
|
|
178
|
+
|
|
179
|
+
def _sigmoid(self, x: float) -> float:
|
|
180
|
+
return 1 / (1 + math.exp(-x))
|
|
181
|
+
|
|
182
|
+
def _gaussian_noise(self, mean: float = 0, std_dev: float = 1) -> float:
|
|
183
|
+
adjusted_std = std_dev * self.speed_factor
|
|
184
|
+
return random.gauss(mean, adjusted_std)
|
|
185
|
+
|
|
186
|
+
def _attention_curve(self, position: int, total_steps: int, base: float = 0.25, peak_delay: float = 0.5) -> float:
|
|
187
|
+
normalized = position / max(total_steps - 1, 1)
|
|
188
|
+
delay = base + (math.sin(normalized * math.pi) * peak_delay)
|
|
189
|
+
noise = self._gaussian_noise(0, 0.02)
|
|
190
|
+
result = max(0.05, delay + noise)
|
|
191
|
+
return result * self.speed_factor
|
|
192
|
+
|
|
193
|
+
def _hesitation_curve(self, time_passed: float, intensity: float = 1.0) -> float:
|
|
194
|
+
base = 0.3
|
|
195
|
+
decay = 0.4 * math.exp(-time_passed * intensity)
|
|
196
|
+
result = base + decay
|
|
197
|
+
return result * self.speed_factor
|
|
198
|
+
|
|
199
|
+
def wait_for_pageload(self, timeout: int = 15) -> bool:
|
|
200
|
+
start = time.time()
|
|
201
|
+
while time.time() - start < timeout:
|
|
202
|
+
result = self.tab.call_method("Runtime.evaluate", expression="document.readyState")
|
|
203
|
+
if result["result"]["value"] == "complete":
|
|
204
|
+
return True
|
|
205
|
+
time.sleep(max(0, 0.3 * self.speed_factor))
|
|
206
|
+
return False
|
|
207
|
+
|
|
208
|
+
def scroll_page(self) -> None:
|
|
209
|
+
for _ in range(random.randint(2, 6)):
|
|
210
|
+
delta = random.randint(20, 60)
|
|
211
|
+
x = random.randint(300, 600)
|
|
212
|
+
y = random.randint(300, 600)
|
|
213
|
+
|
|
214
|
+
self.tab.call_method("Input.dispatchMouseEvent",
|
|
215
|
+
type="mouseWheel",
|
|
216
|
+
x=x,
|
|
217
|
+
y=y,
|
|
218
|
+
deltaX=0,
|
|
219
|
+
deltaY=delta,
|
|
220
|
+
modifiers=0
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
time.sleep(max(0, (abs(math.sin(time.time())) * 0.2 + 0.1) * self.speed_factor))
|
|
224
|
+
|
|
225
|
+
def type_text(self, text: str, typing_speed: float = 1.0) -> None:
|
|
226
|
+
typed = ""
|
|
227
|
+
digits = "0123456789"
|
|
228
|
+
start_time = time.time()
|
|
229
|
+
|
|
230
|
+
for i, char in enumerate(text):
|
|
231
|
+
vk = ord(char)
|
|
232
|
+
|
|
233
|
+
if random.random() < 0.05 and len(typed) > 1:
|
|
234
|
+
wrong_digit = random.choice([d for d in digits if d != char])
|
|
235
|
+
vk_wrong = ord(wrong_digit)
|
|
236
|
+
|
|
237
|
+
self.tab.call_method("Input.dispatchKeyEvent", type="keyDown", windowsVirtualKeyCode=vk_wrong)
|
|
238
|
+
time.sleep(max(0, 0.005 * typing_speed))
|
|
239
|
+
self.tab.call_method("Input.dispatchKeyEvent", type="char", text=wrong_digit)
|
|
240
|
+
time.sleep(max(0, 0.005 * typing_speed))
|
|
241
|
+
self.tab.call_method("Input.dispatchKeyEvent", type="keyUp", windowsVirtualKeyCode=vk_wrong)
|
|
242
|
+
time.sleep(max(0, 0.04 * typing_speed))
|
|
243
|
+
|
|
244
|
+
self.tab.call_method("Input.dispatchKeyEvent", type="keyDown", windowsVirtualKeyCode=8)
|
|
245
|
+
self.tab.call_method("Input.dispatchKeyEvent", type="keyUp", windowsVirtualKeyCode=8)
|
|
246
|
+
time.sleep(max(0, 0.04 * typing_speed))
|
|
247
|
+
|
|
248
|
+
self.tab.call_method("Input.dispatchKeyEvent", type="keyDown", windowsVirtualKeyCode=vk)
|
|
249
|
+
time.sleep(max(0, 0.003 * typing_speed))
|
|
250
|
+
self.tab.call_method("Input.dispatchKeyEvent", type="char", text=char)
|
|
251
|
+
time.sleep(max(0, 0.003 * typing_speed))
|
|
252
|
+
self.tab.call_method("Input.dispatchKeyEvent", type="keyUp", windowsVirtualKeyCode=vk)
|
|
253
|
+
|
|
254
|
+
typed += char
|
|
255
|
+
|
|
256
|
+
delay = self._attention_curve(i, len(text))
|
|
257
|
+
time.sleep(max(0, delay * typing_speed))
|
|
258
|
+
|
|
259
|
+
total_time = time.time() - start_time
|
|
260
|
+
time.sleep(max(0, self._hesitation_curve(total_time) * typing_speed))
|
|
261
|
+
|
|
262
|
+
def move_mouse(self, start_x: int, start_y: int, end_x: int, end_y: int, steps: int = 20):
|
|
263
|
+
for i in range(steps):
|
|
264
|
+
t = self._smooth_step(i / (steps - 1))
|
|
265
|
+
x = start_x + (end_x - start_x) * t + self._gaussian_noise(0, 1.2)
|
|
266
|
+
y = start_y + (end_y - start_y) * t + self._gaussian_noise(0, 1.2)
|
|
267
|
+
|
|
268
|
+
self.tab.call_method("Input.dispatchMouseEvent", type="mouseMoved", x=x, y=y)
|
|
269
|
+
time.sleep(max(0, (0.015 + self._gaussian_noise(0, 0.005)) * self.speed_factor))
|
|
270
|
+
|
|
271
|
+
def click(self, x: int, y: int) -> None:
|
|
272
|
+
origin_x = random.randint(0, 100)
|
|
273
|
+
origin_y = random.randint(0, 100)
|
|
274
|
+
self.move_mouse(origin_x, origin_y, x, y)
|
|
275
|
+
|
|
276
|
+
self.tab.call_method("Input.dispatchMouseEvent", type="mousePressed", x=x, y=y, button="left", clickCount=1)
|
|
277
|
+
time.sleep(max(0, (0.08 + self._gaussian_noise(0, 0.02)) * max(0.1, self.speed_factor / 2)))
|
|
278
|
+
self.tab.call_method("Input.dispatchMouseEvent", type="mouseReleased", x=x, y=y, button="left", clickCount=1)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const AudioContextPrototype = window.AudioContext && window.AudioContext.prototype;
|
|
3
|
+
if (AudioContextPrototype) {
|
|
4
|
+
const createOscillator = AudioContextPrototype.createOscillator;
|
|
5
|
+
AudioContextPrototype.createOscillator = function() {
|
|
6
|
+
const osc = createOscillator.call(this);
|
|
7
|
+
const originalStart = osc.start;
|
|
8
|
+
osc.start = function(when) {
|
|
9
|
+
originalStart.call(this, when + Math.random() * 0.001);
|
|
10
|
+
};
|
|
11
|
+
return osc;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
})();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const toDataURL = HTMLCanvasElement.prototype.toDataURL;
|
|
3
|
+
HTMLCanvasElement.prototype.toDataURL = function(...args) {
|
|
4
|
+
const ctx = this.getContext('2d');
|
|
5
|
+
ctx.fillStyle = 'rgba(255,255,255,0.01)';
|
|
6
|
+
ctx.fillRect(0, 0, this.width, this.height);
|
|
7
|
+
return toDataURL.apply(this, args);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const getImageData = CanvasRenderingContext2D.prototype.getImageData;
|
|
11
|
+
CanvasRenderingContext2D.prototype.getImageData = function(x, y, w, h) {
|
|
12
|
+
const imageData = getImageData.call(this, x, y, w, h);
|
|
13
|
+
for (let i = 0; i < imageData.data.length; i += 4) {
|
|
14
|
+
imageData.data[i] ^= 1;
|
|
15
|
+
imageData.data[i+1] ^= 1;
|
|
16
|
+
imageData.data[i+2] ^= 1;
|
|
17
|
+
}
|
|
18
|
+
return imageData;
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
const getFloatFrequencyData = AnalyserNode.prototype.getFloatFrequencyData;
|
|
3
|
+
AnalyserNode.prototype.getFloatFrequencyData = function(array) {
|
|
4
|
+
const variation = Math.random() * 0.0001;
|
|
5
|
+
for (let i = 0; i < array.length; i++) {
|
|
6
|
+
array[i] = array[i] + variation;
|
|
7
|
+
}
|
|
8
|
+
return getFloatFrequencyData.call(this, array);
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
navigator.mediaDevices.enumerateDevices = function() {
|
|
3
|
+
return Promise.resolve([
|
|
4
|
+
{
|
|
5
|
+
kind: 'audioinput',
|
|
6
|
+
label: 'Microphone',
|
|
7
|
+
deviceId: 'audio-1',
|
|
8
|
+
groupId: 'group-1'
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
kind: 'videoinput',
|
|
12
|
+
label: 'Camera',
|
|
13
|
+
deviceId: 'video-1',
|
|
14
|
+
groupId: 'group-1'
|
|
15
|
+
}
|
|
16
|
+
]);
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
Object.defineProperty(navigator, 'webdriver', { get: () => false });
|
|
3
|
+
Object.defineProperty(navigator, 'plugins', { get: () => [1, 2, 3, 4, 5] });
|
|
4
|
+
Object.defineProperty(navigator, 'languages', { get: () => ['pt-BR', 'pt', 'en-US', 'en'] });
|
|
5
|
+
Object.defineProperty(navigator, 'platform', { get: () => 'Win32' });
|
|
6
|
+
Object.defineProperty(navigator, 'hardwareConcurrency', { get: () => 8 });
|
|
7
|
+
Object.defineProperty(navigator, 'deviceMemory', { get: () => 8 });
|
|
8
|
+
Object.defineProperty(navigator, 'maxTouchPoints', { get: () => 1 });
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(navigator, 'userAgent', {
|
|
11
|
+
get: () => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
|
|
12
|
+
});
|
|
13
|
+
})();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
const nativeToString = Function.prototype.toString;
|
|
3
|
+
const toStringProxy = new Proxy(nativeToString, {
|
|
4
|
+
apply: function(target, thisArg, args) {
|
|
5
|
+
if (thisArg.name === 'getParameter') {
|
|
6
|
+
return 'function getParameter() { [native code] }';
|
|
7
|
+
}
|
|
8
|
+
return Reflect.apply(...arguments);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
Function.prototype.toString = toStringProxy;
|
|
12
|
+
})();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const originalQuery = navigator.permissions.query;
|
|
3
|
+
navigator.permissions.query = function(parameters) {
|
|
4
|
+
if (parameters.name === 'notifications') {
|
|
5
|
+
return Promise.resolve({ state: Notification.permission });
|
|
6
|
+
}
|
|
7
|
+
return originalQuery(parameters);
|
|
8
|
+
};
|
|
9
|
+
})();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
Object.defineProperty(window.screen, 'width', { get: () => 1920 });
|
|
3
|
+
Object.defineProperty(window.screen, 'height', { get: () => 1080 });
|
|
4
|
+
Object.defineProperty(window.screen, 'availWidth', { get: () => 1920 });
|
|
5
|
+
Object.defineProperty(window.screen, 'availHeight', { get: () => 1040 });
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(window, 'outerWidth', { get: () => window.innerWidth + 100 });
|
|
8
|
+
Object.defineProperty(window, 'outerHeight', { get: () => window.innerHeight + 100 });
|
|
9
|
+
})();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
const toDataURL = HTMLCanvasElement.prototype.toDataURL;
|
|
3
|
+
HTMLCanvasElement.prototype.toDataURL = function() {
|
|
4
|
+
const ctx = this.getContext('2d');
|
|
5
|
+
ctx.fillStyle = 'rgb(' + [Math.floor(Math.random()*255), Math.floor(Math.random()*255), Math.floor(Math.random()*255)].join(',') + ')';
|
|
6
|
+
ctx.fillRect(0, 0, 10, 10);
|
|
7
|
+
return toDataURL.apply(this, arguments);
|
|
8
|
+
};
|
|
9
|
+
})();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
const original = WebGLRenderingContext.prototype.getShaderPrecisionFormat;
|
|
3
|
+
WebGLRenderingContext.prototype.getShaderPrecisionFormat = function() {
|
|
4
|
+
return {
|
|
5
|
+
rangeMin: 127,
|
|
6
|
+
rangeMax: 127,
|
|
7
|
+
precision: Math.floor(Math.random() * 23 + 8)
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
Object.defineProperty(navigator, 'webdriver', { get: () => false });
|
|
3
|
+
Object.defineProperty(navigator, 'plugins', { get: () => [1, 2, 3, 4, 5] });
|
|
4
|
+
Object.defineProperty(navigator, 'languages', { get: () => ['pt-BR', 'pt', 'en-US', 'en'] });
|
|
5
|
+
Object.defineProperty(navigator, 'platform', { get: () => 'Win32' });
|
|
6
|
+
Object.defineProperty(navigator, 'hardwareConcurrency', { get: () => 8 });
|
|
7
|
+
Object.defineProperty(navigator, 'deviceMemory', { get: () => 8 });
|
|
8
|
+
Object.defineProperty(navigator, 'maxTouchPoints', { get: () => 1 });
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(navigator, 'userAgent', {
|
|
11
|
+
get: () => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
Object.defineProperty(window.screen, 'width', { get: () => 1920 });
|
|
15
|
+
Object.defineProperty(window.screen, 'height', { get: () => 1080 });
|
|
16
|
+
Object.defineProperty(window.screen, 'availWidth', { get: () => 1920 });
|
|
17
|
+
Object.defineProperty(window.screen, 'availHeight', { get: () => 1040 });
|
|
18
|
+
|
|
19
|
+
const getParameter = WebGLRenderingContext.prototype.getParameter;
|
|
20
|
+
WebGLRenderingContext.prototype.getParameter = function(parameter) {
|
|
21
|
+
if (parameter === 37445) return "Intel Inc.";
|
|
22
|
+
if (parameter === 37446) return "Intel Iris OpenGL Engine";
|
|
23
|
+
return getParameter.call(this, parameter);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const toDataURL = HTMLCanvasElement.prototype.toDataURL;
|
|
27
|
+
HTMLCanvasElement.prototype.toDataURL = function(...args) {
|
|
28
|
+
const ctx = this.getContext('2d');
|
|
29
|
+
ctx.fillStyle = 'rgba(255,255,255,0.01)';
|
|
30
|
+
ctx.fillRect(0, 0, this.width, this.height);
|
|
31
|
+
return toDataURL.apply(this, args);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getImageData = CanvasRenderingContext2D.prototype.getImageData;
|
|
35
|
+
CanvasRenderingContext2D.prototype.getImageData = function(x, y, w, h) {
|
|
36
|
+
const imageData = getImageData.call(this, x, y, w, h);
|
|
37
|
+
for (let i = 0; i < imageData.data.length; i += 4) {
|
|
38
|
+
imageData.data[i] ^= 1;
|
|
39
|
+
imageData.data[i+1] ^= 1;
|
|
40
|
+
imageData.data[i+2] ^= 1;
|
|
41
|
+
}
|
|
42
|
+
return imageData;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const AudioContextPrototype = window.AudioContext && window.AudioContext.prototype;
|
|
46
|
+
if (AudioContextPrototype) {
|
|
47
|
+
const createOscillator = AudioContextPrototype.createOscillator;
|
|
48
|
+
AudioContextPrototype.createOscillator = function() {
|
|
49
|
+
const osc = createOscillator.call(this);
|
|
50
|
+
const originalStart = osc.start;
|
|
51
|
+
osc.start = function(when) {
|
|
52
|
+
originalStart.call(this, when + Math.random() * 0.001);
|
|
53
|
+
};
|
|
54
|
+
return osc;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const originalQuery = navigator.permissions.query;
|
|
59
|
+
navigator.permissions.query = function(parameters) {
|
|
60
|
+
if (parameters.name === 'notifications') {
|
|
61
|
+
return Promise.resolve({ state: Notification.permission });
|
|
62
|
+
}
|
|
63
|
+
return originalQuery(parameters);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
Object.defineProperty(window, 'RTCPeerConnection', {
|
|
67
|
+
get: () => undefined
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
Object.defineProperty(window, 'outerWidth', { get: () => window.innerWidth + 100 });
|
|
71
|
+
Object.defineProperty(window, 'outerHeight', { get: () => window.innerHeight + 100 });
|
|
72
|
+
|
|
73
|
+
Object.defineProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', {
|
|
74
|
+
value: function() {
|
|
75
|
+
return {
|
|
76
|
+
locale: 'pt-BR',
|
|
77
|
+
calendar: 'gregory',
|
|
78
|
+
numberingSystem: 'latn',
|
|
79
|
+
timeZone: 'America/Sao_Paulo'
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
})();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const getParameter = WebGLRenderingContext.prototype.getParameter;
|
|
3
|
+
WebGLRenderingContext.prototype.getParameter = function(parameter) {
|
|
4
|
+
if (parameter === 37445) return "Intel Inc.";
|
|
5
|
+
if (parameter === 37446) return "Intel Iris OpenGL Engine";
|
|
6
|
+
return getParameter.call(this, parameter);
|
|
7
|
+
};
|
|
8
|
+
})();
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import importlib.resources as pkg_resources
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
class StealthToolkit:
|
|
6
|
+
|
|
7
|
+
BASE_DIR = os.path.join(os.path.dirname(__file__), "injections")
|
|
8
|
+
|
|
9
|
+
PATCHES = {
|
|
10
|
+
"base": "stealth_injection.js",
|
|
11
|
+
"canvas": "spoof_canvas_fingerprint.js",
|
|
12
|
+
"webgl": "spoof_webgl_precision.js",
|
|
13
|
+
"toString": "override_function_toString.js",
|
|
14
|
+
"plugins_mimetypes": "mock_navigator_plugins_and_mimetypes.js",
|
|
15
|
+
"chrome_runtime": "mock_chrome_runtime.js",
|
|
16
|
+
"webrtc": "mock_webrtc.js",
|
|
17
|
+
"audio": "mock_audio_fingerprint.js",
|
|
18
|
+
"connection": "mock_navigator_connection.js",
|
|
19
|
+
"media": "mock_media_devices.js",
|
|
20
|
+
"navigator_props": "navigator_properties.js",
|
|
21
|
+
"screen_props": "screen_properties.js",
|
|
22
|
+
"webgl_spoof": "webgl_spoof.js",
|
|
23
|
+
"canvas_noise": "canvas_noise.js",
|
|
24
|
+
"audio_oscillator": "audio_oscillator_patch.js",
|
|
25
|
+
"permissions_query": "permissions_query_patch.js",
|
|
26
|
+
"rtc_peerconnection": "rtc_peerconnection_patch.js",
|
|
27
|
+
"intl_datetime": "intl_datetime_patch.js",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
LEVELS = {
|
|
31
|
+
"low": ["base", "canvas", "toString"],
|
|
32
|
+
"normal": ["base", "canvas", "webgl", "toString", "plugins_mimetypes", "chrome_runtime"],
|
|
33
|
+
"strict": list(PATCHES.keys())
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def __init__(self, tab, level="normal", custom_methods=None):
|
|
38
|
+
self.tab = tab
|
|
39
|
+
self.level = level
|
|
40
|
+
self.custom_methods = custom_methods or []
|
|
41
|
+
|
|
42
|
+
def apply(self):
|
|
43
|
+
if self.level == "custom":
|
|
44
|
+
patches = self.custom_methods
|
|
45
|
+
else:
|
|
46
|
+
patches = self.LEVELS.get(self.level)
|
|
47
|
+
if not patches:
|
|
48
|
+
raise ValueError(f"invalid stealth level: {self.level}")
|
|
49
|
+
|
|
50
|
+
for patch_key in patches:
|
|
51
|
+
file_name = self.PATCHES.get(patch_key)
|
|
52
|
+
if not file_name:
|
|
53
|
+
continue
|
|
54
|
+
|
|
55
|
+
script_path = os.path.join(self.BASE_DIR, file_name)
|
|
56
|
+
self._inject_script(script_path)
|
|
57
|
+
|
|
58
|
+
def _inject_script(self, path):
|
|
59
|
+
if isinstance(path, str):
|
|
60
|
+
try:
|
|
61
|
+
with open(path, "r", encoding="utf-8") as f:
|
|
62
|
+
js_code = f.read()
|
|
63
|
+
except FileNotFoundError:
|
|
64
|
+
package = __package__ + ".injections"
|
|
65
|
+
file_name = Path(path).name
|
|
66
|
+
js_code = pkg_resources.read_text(package, file_name)
|
|
67
|
+
else:
|
|
68
|
+
js_code = path.read_text(encoding="utf-8")
|
|
69
|
+
|
|
70
|
+
self.tab.call_method("Runtime.evaluate", expression=js_code)
|