jumpy-lion 0.1.6-beta.0 → 0.1.6-beta.3
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.
- package/README.md +13 -0
- package/dist/browser-controller.d.ts.map +1 -1
- package/dist/browser-controller.js +57 -2
- package/dist/browser-controller.js.map +1 -1
- package/dist/browser-plugin.d.ts +49 -0
- package/dist/browser-plugin.d.ts.map +1 -1
- package/dist/browser-plugin.js +103 -1
- package/dist/browser-plugin.js.map +1 -1
- package/dist/browser-process/anti-detect-browser.d.ts +56 -0
- package/dist/browser-process/anti-detect-browser.d.ts.map +1 -0
- package/dist/browser-process/anti-detect-browser.js +142 -0
- package/dist/browser-process/anti-detect-browser.js.map +1 -0
- package/dist/browser-process/anti-detect-config.d.ts +102 -0
- package/dist/browser-process/anti-detect-config.d.ts.map +1 -0
- package/dist/browser-process/anti-detect-config.js +328 -0
- package/dist/browser-process/anti-detect-config.js.map +1 -0
- package/dist/browser-process/browser.d.ts +26 -0
- package/dist/browser-process/browser.d.ts.map +1 -1
- package/dist/browser-process/browser.js +115 -6
- package/dist/browser-process/browser.js.map +1 -1
- package/dist/browser-process/get-chrome-executable.d.ts +7 -0
- package/dist/browser-process/get-chrome-executable.d.ts.map +1 -1
- package/dist/browser-process/get-chrome-executable.js +42 -0
- package/dist/browser-process/get-chrome-executable.js.map +1 -1
- package/dist/browser-process/index.d.ts +4 -1
- package/dist/browser-process/index.d.ts.map +1 -1
- package/dist/browser-process/index.js +3 -1
- package/dist/browser-process/index.js.map +1 -1
- package/dist/crawler.d.ts +17 -0
- package/dist/crawler.d.ts.map +1 -1
- package/dist/crawler.js +5 -2
- package/dist/crawler.js.map +1 -1
- package/dist/fingerprinting/fingerprint-injector.d.ts +54 -0
- package/dist/fingerprinting/fingerprint-injector.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-injector.js +207 -58
- package/dist/fingerprinting/fingerprint-injector.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/audio-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/audio-spoofing.js +16 -0
- package/dist/fingerprinting/fingerprint-overrides/audio-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/cdp-detection-bypass.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/cdp-detection-bypass.js +3 -2
- package/dist/fingerprinting/fingerprint-overrides/cdp-detection-bypass.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/datadome-bypass.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/datadome-bypass.js +18 -10
- package/dist/fingerprinting/fingerprint-overrides/datadome-bypass.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/index.d.ts +1 -2
- package/dist/fingerprinting/fingerprint-overrides/index.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/index.js +1 -2
- package/dist/fingerprinting/fingerprint-overrides/index.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/keyboard-humanization.d.ts +10 -2
- package/dist/fingerprinting/fingerprint-overrides/keyboard-humanization.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/keyboard-humanization.js +11 -2
- package/dist/fingerprinting/fingerprint-overrides/keyboard-humanization.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/locale-spoofing.d.ts +20 -2
- package/dist/fingerprinting/fingerprint-overrides/locale-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/locale-spoofing.js +47 -250
- package/dist/fingerprinting/fingerprint-overrides/locale-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/mouse-humanization.d.ts +12 -1
- package/dist/fingerprinting/fingerprint-overrides/mouse-humanization.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/mouse-humanization.js +27 -22
- package/dist/fingerprinting/fingerprint-overrides/mouse-humanization.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/platform-consistency.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/platform-consistency.js +86 -28
- package/dist/fingerprinting/fingerprint-overrides/platform-consistency.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/scroll-humanization.d.ts +9 -2
- package/dist/fingerprinting/fingerprint-overrides/scroll-humanization.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/scroll-humanization.js +10 -2
- package/dist/fingerprinting/fingerprint-overrides/scroll-humanization.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/stealth-script.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/stealth-script.js +165 -33
- package/dist/fingerprinting/fingerprint-overrides/stealth-script.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/storage-consistency.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/storage-consistency.js +10 -8
- package/dist/fingerprinting/fingerprint-overrides/storage-consistency.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/timing-consistency.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/timing-consistency.js +9 -7
- package/dist/fingerprinting/fingerprint-overrides/timing-consistency.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/ua-ch.js +6 -6
- package/dist/fingerprinting/fingerprint-overrides/utils.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/utils.js +44 -1
- package/dist/fingerprinting/fingerprint-overrides/utils.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/webgl-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/webgl-spoofing.js +43 -1
- package/dist/fingerprinting/fingerprint-overrides/webgl-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/webgpu-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/webgpu-spoofing.js +9 -1
- package/dist/fingerprinting/fingerprint-overrides/webgpu-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/webrtc-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/webrtc-spoofing.js +14 -3
- package/dist/fingerprinting/fingerprint-overrides/webrtc-spoofing.js.map +1 -1
- package/dist/fingerprinting/locale-resolver.d.ts +41 -0
- package/dist/fingerprinting/locale-resolver.d.ts.map +1 -0
- package/dist/fingerprinting/locale-resolver.js +155 -0
- package/dist/fingerprinting/locale-resolver.js.map +1 -0
- package/dist/fingerprinting/non-apify-fingerprint-generator.d.ts +32 -0
- package/dist/fingerprinting/non-apify-fingerprint-generator.d.ts.map +1 -0
- package/dist/fingerprinting/non-apify-fingerprint-generator.js +480 -0
- package/dist/fingerprinting/non-apify-fingerprint-generator.js.map +1 -0
- package/dist/keyboard-layout.d.ts +45 -0
- package/dist/keyboard-layout.d.ts.map +1 -0
- package/dist/keyboard-layout.js +162 -0
- package/dist/keyboard-layout.js.map +1 -0
- package/dist/page.d.ts +18 -0
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +96 -6
- package/dist/page.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -1
- package/dist/fingerprinting/fingerprint-overrides/coalesced-events-spoofing.d.ts +0 -10
- package/dist/fingerprinting/fingerprint-overrides/coalesced-events-spoofing.d.ts.map +0 -1
- package/dist/fingerprinting/fingerprint-overrides/coalesced-events-spoofing.js +0 -210
- package/dist/fingerprinting/fingerprint-overrides/coalesced-events-spoofing.js.map +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* anti-detect-browser.ts — Detect whether the running browser is the custom anti-detect build
|
|
3
|
+
*
|
|
4
|
+
* Used by fingerprint-injector.ts to decide which JS override modules to skip
|
|
5
|
+
* (those already handled natively by C++ patches in the anti-detect browser).
|
|
6
|
+
*/
|
|
7
|
+
import { spawnSync } from 'child_process';
|
|
8
|
+
import { existsSync } from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
// ─── Detection ────────────────────────────────────────────────────────────────
|
|
11
|
+
/**
|
|
12
|
+
* Check if the given executable is the anti-detect browser build.
|
|
13
|
+
*
|
|
14
|
+
* Detection strategy:
|
|
15
|
+
* 1. Check for a .anti-detect-version marker file alongside the binary
|
|
16
|
+
* 2. Check the --version output for the "AntiDetect" build marker
|
|
17
|
+
* 3. Fall back to false (standard Chrome behavior)
|
|
18
|
+
*
|
|
19
|
+
* @param executablePath - Path to the Chrome/Chromium executable
|
|
20
|
+
*/
|
|
21
|
+
export async function isAntiDetectBrowser(executablePath) {
|
|
22
|
+
if (!executablePath || !existsSync(executablePath)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
// Strategy 1: Check for marker file alongside the binary
|
|
26
|
+
// The build process writes a .anti-detect-version file next to the binary
|
|
27
|
+
const binaryDir = path.dirname(executablePath);
|
|
28
|
+
const markerFile = path.join(binaryDir, '.anti-detect-version');
|
|
29
|
+
if (existsSync(markerFile)) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
// Also check the .browser/ directory root
|
|
33
|
+
const browserDirMarker = path.join(binaryDir, '..', '.anti-detect-version');
|
|
34
|
+
if (existsSync(browserDirMarker)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
// Strategy 2: Check --version output for build marker
|
|
38
|
+
// The anti-detect build adds "AntiDetect/X.Y" to the version string
|
|
39
|
+
try {
|
|
40
|
+
const result = spawnSync(executablePath, ['--version'], {
|
|
41
|
+
encoding: 'utf8',
|
|
42
|
+
timeout: 5000,
|
|
43
|
+
});
|
|
44
|
+
const output = `${result.stdout ?? ''} ${result.stderr ?? ''}`;
|
|
45
|
+
if (output.includes('AntiDetect')) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Ignore — binary may not support --version in this way
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Synchronous version for use during browser launch (before async context).
|
|
56
|
+
*/
|
|
57
|
+
export function isAntiDetectBrowserSync(executablePath) {
|
|
58
|
+
if (!executablePath || !existsSync(executablePath)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
// Walk up to 5 ancestors looking for the .anti-detect-version marker.
|
|
62
|
+
// macOS packages the binary at `.../Chromium.app/Contents/MacOS/Chromium`,
|
|
63
|
+
// and the build script can install the marker next to the `.app`, inside
|
|
64
|
+
// Contents/, or inside Contents/MacOS/ — so a single depth check is
|
|
65
|
+
// brittle. 5 levels covers every current build layout.
|
|
66
|
+
let dir = path.dirname(executablePath);
|
|
67
|
+
for (let i = 0; i < 5; i++) {
|
|
68
|
+
if (existsSync(path.join(dir, '.anti-detect-version'))) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
const parent = path.dirname(dir);
|
|
72
|
+
if (parent === dir)
|
|
73
|
+
break; // hit filesystem root
|
|
74
|
+
dir = parent;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
const result = spawnSync(executablePath, ['--version'], {
|
|
78
|
+
encoding: 'utf8',
|
|
79
|
+
timeout: 5000,
|
|
80
|
+
});
|
|
81
|
+
const output = `${result.stdout ?? ''} ${result.stderr ?? ''}`;
|
|
82
|
+
return output.includes('AntiDetect');
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// ─── Capability map ───────────────────────────────────────────────────────────
|
|
89
|
+
/**
|
|
90
|
+
* When useNativeStealth=true, the fingerprint-injector skips the ENTIRE JS override
|
|
91
|
+
* pipeline — no fingerprint scripts are injected at all. This set exists for
|
|
92
|
+
* reference/documentation and for any external callers that check individual module
|
|
93
|
+
* names via shouldSkipJsOverride().
|
|
94
|
+
*
|
|
95
|
+
* Primary mechanism: fingerprint-injector.ts early-returns when nativeStealth=true,
|
|
96
|
+
* before any of these modules are built or injected.
|
|
97
|
+
*
|
|
98
|
+
* C++ patch coverage (browser/patches/):
|
|
99
|
+
* 0001 navigator.webdriver = false
|
|
100
|
+
* 0002 navigator.platform
|
|
101
|
+
* 0003 UA-CH (navigator.userAgentData + Sec-CH-UA-* headers)
|
|
102
|
+
* 0004 WebGL UNMASKED_VENDOR/RENDERER
|
|
103
|
+
* 0005 CDP automation artifact removal
|
|
104
|
+
* 0006 screen.width/height/availWidth/availHeight/colorDepth
|
|
105
|
+
* 0007 Page-level fingerprint seed (cross-process consistency)
|
|
106
|
+
* 0008 FingerprintConfig CLI ingestion
|
|
107
|
+
* 0009 Canvas document noise factors (seeded)
|
|
108
|
+
* 0010 AudioContext noise (seeded)
|
|
109
|
+
* 0011 getBoundingClientRect / getClientRects noise
|
|
110
|
+
* 0012 WebGPU adapter info
|
|
111
|
+
* 0013 queryLocalFonts() → empty
|
|
112
|
+
* 0015 Runtime.enable console side effects + sourceURL leaks
|
|
113
|
+
* cromite-override/0001 hardwareConcurrency / deviceMemory
|
|
114
|
+
* cromite-override/0002 canvas pixel shuffle (seeded)
|
|
115
|
+
* Cromite built-in font allowlist, performance.now() clamping
|
|
116
|
+
*/
|
|
117
|
+
export const NATIVE_STEALTH_SKIPS = new Set([
|
|
118
|
+
'canvas-protection', // patches 0009, co/0002
|
|
119
|
+
'webgl-spoofing', // patch 0004
|
|
120
|
+
'audio-spoofing', // patch 0010
|
|
121
|
+
'client-rect-spoofing', // patch 0011
|
|
122
|
+
'font-spoofing', // Cromite built-in + patch 0013
|
|
123
|
+
'performance-spoofing', // Cromite built-in (perf.now clamping)
|
|
124
|
+
'ua-ch', // patch 0003
|
|
125
|
+
'platform-consistency', // patches 0002, 0006
|
|
126
|
+
'runtime-enable-bypass', // patches 0005, 0015
|
|
127
|
+
'cdp-detection-bypass', // patches 0001, 0005, 0015
|
|
128
|
+
'webgpu-spoofing', // patch 0012
|
|
129
|
+
'storage-consistency', // no C++ equivalent — skipped for simplicity
|
|
130
|
+
'timing-consistency', // Cromite perf.now clamping covers the main vector
|
|
131
|
+
'locale-spoofing', // Cromite ICU config covers locale
|
|
132
|
+
'stealth-utils', // no JS overrides needed — C++ handles at source
|
|
133
|
+
'prototype-integrity', // no JS overrides needed — C++ patches are native
|
|
134
|
+
]);
|
|
135
|
+
/**
|
|
136
|
+
* Returns true if a given override module should be skipped when using the
|
|
137
|
+
* anti-detect browser (fully handled by C++ patches).
|
|
138
|
+
*/
|
|
139
|
+
export function shouldSkipJsOverride(moduleName) {
|
|
140
|
+
return NATIVE_STEALTH_SKIPS.has(moduleName);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=anti-detect-browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anti-detect-browser.js","sourceRoot":"","sources":["../../src/browser-process/anti-detect-browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,iFAAiF;AAEjF;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,cAAsB;IAC5D,IAAI,CAAC,cAAc,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACjD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,yDAAyD;IACzD,0EAA0E;IAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;IAChE,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,0CAA0C;IAC1C,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,sBAAsB,CAAC,CAAC;IAC5E,IAAI,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC/B,O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AS,CAAC,cAAc,EAAE,CAAC,WAAW,CAAC,EAAE;YACpD,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QAC/D,OAAO,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACxC,mBAAmB,EAAQ,wBAAwB;IACnD,gBAAgB,EAAW,aAAa;IACxC,gBAAgB,EAAW,aAAa;IACxC,sBAAsB,EAAK,aAAa;IACxC,eAAe,EAAY,gCAAgC;IAC3D,sBAAsB,EAAK,uCAAuC;IAClE,OAAO,EAAoB,aAAa;IACxC,sBAAsB,EAAK,qBAAqB;IAChD,uBAAuB,EAAI,qBAAqB;IAChD,sBAAsB,EAAK,2BAA2B;IACtD,iBAAiB,EAAU,aAAa;IACxC,qBAAqB,EAAM,6CAA6C;IACxE,oBAAoB,EAAO,mDAAmD;IAC9E,iBAAiB,EAAU,mCAAmC;IAC9D,eAAe,EAAY,iDAAiD;IAC5E,qBAAqB,EAAM,kDAAkD;CAChF,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IACnD,OAAO,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* anti-detect-config.ts — Generate and manage FingerprintConfig JSON for the anti-detect browser
|
|
3
|
+
*
|
|
4
|
+
* Called by browser.ts before launching the browser when useNativeStealth is enabled.
|
|
5
|
+
* Translates the fingerprint-generator BrowserFingerprintWithHeaders output into
|
|
6
|
+
* the --fingerprint-config JSON schema consumed by the C++ FingerprintConfig class.
|
|
7
|
+
*/
|
|
8
|
+
import type { BrowserFingerprintWithHeaders } from 'fingerprint-generator';
|
|
9
|
+
import type { ResolvedLocale } from '../fingerprinting/locale-resolver.js';
|
|
10
|
+
export interface FingerprintConfigUaBrand {
|
|
11
|
+
brand: string;
|
|
12
|
+
version: string;
|
|
13
|
+
full_version?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FingerprintConfigBattery {
|
|
16
|
+
charging: boolean;
|
|
17
|
+
level: number;
|
|
18
|
+
chargingTime: number;
|
|
19
|
+
dischargingTime: number;
|
|
20
|
+
}
|
|
21
|
+
export interface FingerprintConfigJson {
|
|
22
|
+
version: 1;
|
|
23
|
+
/** 64-bit seed (number, as JSON doesn't support BigInt) */
|
|
24
|
+
seed: number;
|
|
25
|
+
/** Primary brand name for Sec-CH-UA fallback (e.g. "Google Chrome") */
|
|
26
|
+
brandName: string;
|
|
27
|
+
/** IANA timezone id, e.g. "Asia/Seoul". Consumed by C++ patches + CDP override. */
|
|
28
|
+
timezone?: string;
|
|
29
|
+
navigator: {
|
|
30
|
+
platform: string;
|
|
31
|
+
/** BCP-47 primary locale, e.g. "ko-KR". Drives navigator.language + ICU default. */
|
|
32
|
+
language?: string;
|
|
33
|
+
/** Comma-separated accept-languages, e.g. "en-US,en;q=0.9" */
|
|
34
|
+
languages?: string;
|
|
35
|
+
hardwareConcurrency: number;
|
|
36
|
+
deviceMemory: number;
|
|
37
|
+
userAgent: string;
|
|
38
|
+
userAgentData?: {
|
|
39
|
+
brands: FingerprintConfigUaBrand[];
|
|
40
|
+
mobile: boolean;
|
|
41
|
+
platform: string;
|
|
42
|
+
platformVersion: string;
|
|
43
|
+
architecture: string;
|
|
44
|
+
bitness: string;
|
|
45
|
+
model: string;
|
|
46
|
+
uaFullVersion: string;
|
|
47
|
+
fullVersionList: FingerprintConfigUaBrand[];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
webgl: {
|
|
51
|
+
vendor: string;
|
|
52
|
+
renderer: string;
|
|
53
|
+
};
|
|
54
|
+
screen: {
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
availWidth: number;
|
|
58
|
+
availHeight: number;
|
|
59
|
+
colorDepth: number;
|
|
60
|
+
pixelRatio: number;
|
|
61
|
+
};
|
|
62
|
+
fonts?: {
|
|
63
|
+
allowlist: string;
|
|
64
|
+
};
|
|
65
|
+
battery: FingerprintConfigBattery;
|
|
66
|
+
noise: {
|
|
67
|
+
canvas: boolean;
|
|
68
|
+
audio: boolean;
|
|
69
|
+
rects: boolean;
|
|
70
|
+
measureText: boolean;
|
|
71
|
+
};
|
|
72
|
+
timing: {
|
|
73
|
+
performanceNowResolutionMs: number;
|
|
74
|
+
};
|
|
75
|
+
webgpu?: {
|
|
76
|
+
vendor: string;
|
|
77
|
+
architecture: string;
|
|
78
|
+
device: string;
|
|
79
|
+
description: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Generate a FingerprintConfig JSON object from fingerprint-generator output.
|
|
84
|
+
*
|
|
85
|
+
* @param fingerprint - BrowserFingerprintWithHeaders from fingerprint-generator
|
|
86
|
+
* @param sessionId - Session identifier used to derive the seed (proxy session ID, etc.)
|
|
87
|
+
* @param resolvedLocale - Pre-resolved locale/languages/timezone triple. When provided,
|
|
88
|
+
* these values win over anything derived from fingerprint-generator headers so that a
|
|
89
|
+
* user-supplied `locale: 'ko-KR'` coherently propagates to every locale surface
|
|
90
|
+
* (Accept-Language, navigator.language, Intl defaults, timezone).
|
|
91
|
+
*/
|
|
92
|
+
export declare function generateFingerprintConfig(fingerprint: BrowserFingerprintWithHeaders, sessionId?: string, resolvedLocale?: ResolvedLocale): FingerprintConfigJson;
|
|
93
|
+
/**
|
|
94
|
+
* Write the fingerprint config to a temp file and return the path.
|
|
95
|
+
* The caller is responsible for deleting the file after the browser exits.
|
|
96
|
+
*/
|
|
97
|
+
export declare function writeTempFingerprintConfig(config: FingerprintConfigJson): Promise<string>;
|
|
98
|
+
/**
|
|
99
|
+
* Delete the temp config file after the browser has exited.
|
|
100
|
+
*/
|
|
101
|
+
export declare function cleanupTempFingerprintConfig(filePath: string): Promise<void>;
|
|
102
|
+
//# sourceMappingURL=anti-detect-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anti-detect-config.d.ts","sourceRoot":"","sources":["../../src/browser-process/anti-detect-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAI3E,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,CAAC,CAAC;IACX,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,oFAAoF;QACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,8DAA8D;QAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,C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ED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAM/F;AAED;;GAEG;AACH,wBAAsB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlF"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* anti-detect-config.ts — Generate and manage FingerprintConfig JSON for the anti-detect browser
|
|
3
|
+
*
|
|
4
|
+
* Called by browser.ts before launching the browser when useNativeStealth is enabled.
|
|
5
|
+
* Translates the fingerprint-generator BrowserFingerprintWithHeaders output into
|
|
6
|
+
* the --fingerprint-config JSON schema consumed by the C++ FingerprintConfig class.
|
|
7
|
+
*/
|
|
8
|
+
import fs from 'fs/promises';
|
|
9
|
+
import os from 'os';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import crypto from 'crypto';
|
|
12
|
+
// ─── Generation ───────────────────────────────────────────────────────────────
|
|
13
|
+
/**
|
|
14
|
+
* Generate a FingerprintConfig JSON object from fingerprint-generator output.
|
|
15
|
+
*
|
|
16
|
+
* @param fingerprint - BrowserFingerprintWithHeaders from fingerprint-generator
|
|
17
|
+
* @param sessionId - Session identifier used to derive the seed (proxy session ID, etc.)
|
|
18
|
+
* @param resolvedLocale - Pre-resolved locale/languages/timezone triple. When provided,
|
|
19
|
+
* these values win over anything derived from fingerprint-generator headers so that a
|
|
20
|
+
* user-supplied `locale: 'ko-KR'` coherently propagates to every locale surface
|
|
21
|
+
* (Accept-Language, navigator.language, Intl defaults, timezone).
|
|
22
|
+
*/
|
|
23
|
+
export function generateFingerprintConfig(fingerprint, sessionId, resolvedLocale) {
|
|
24
|
+
const fp = fingerprint.fingerprint;
|
|
25
|
+
const headers = fingerprint.headers;
|
|
26
|
+
// Seed derivation:
|
|
27
|
+
// - With a sessionId (proxy session tag) → deterministic: same session ID
|
|
28
|
+
// always yields the same seed so cookies/IP/canvas/audio stay coherent
|
|
29
|
+
// across requests within the session. This is the common production path.
|
|
30
|
+
// - Without a sessionId (harvest runs, ad-hoc launches) → per-process
|
|
31
|
+
// random. Without this, the fingerprint-generator macOS/Chrome pool
|
|
32
|
+
// emits exactly one UA across many runs, so sessionId-less calls would
|
|
33
|
+
// all produce the same seed and therefore the same canvas/audio noise
|
|
34
|
+
// hash across every session — a cross-session correlation signal.
|
|
35
|
+
const seedSource = sessionId
|
|
36
|
+
? `${sessionId}|${fp.navigator?.userAgent ?? ''}`
|
|
37
|
+
: `${crypto.randomBytes(16).toString('hex')}|${fp.navigator?.userAgent ?? ''}`;
|
|
38
|
+
const seedHash = crypto.createHash('sha256').update(seedSource).digest();
|
|
39
|
+
// Take first 8 bytes as a number (JavaScript number precision is sufficient for 53-bit ints)
|
|
40
|
+
const seed = seedHash.readUInt32BE(0) * 0x100000000 + seedHash.readUInt32BE(4);
|
|
41
|
+
// Navigator platform
|
|
42
|
+
// navigator.platform (legacy) and navigator.userAgentData.platform (UA-CH)
|
|
43
|
+
// are DIFFERENT APIs with DIFFERENT values:
|
|
44
|
+
// navigator.platform → 'MacIntel' | 'Win32' | 'Linux x86_64'
|
|
45
|
+
// navigator.userAgentData.platform → 'macOS' | 'Windows' | 'Linux'
|
|
46
|
+
// Previously this code collapsed both to the UA-CH form, which made
|
|
47
|
+
// navigator.platform report "macOS" in both the main frame and workers —
|
|
48
|
+
// that is a Chrome invariant violation (real Chrome always returns
|
|
49
|
+
// "MacIntel" from navigator.platform regardless of architecture).
|
|
50
|
+
//
|
|
51
|
+
// Keep the two values separate:
|
|
52
|
+
// platform → legacy form, stored in config.navigator.platform
|
|
53
|
+
// uaChPlatform → UA-CH form, stored in config.navigator.userAgentData.platform
|
|
54
|
+
// and used for battery/platform-specific heuristics below.
|
|
55
|
+
const platform = fp.navigator?.platform ?? 'Win32';
|
|
56
|
+
const legacyToUaCH = {
|
|
57
|
+
'Win32': 'Windows',
|
|
58
|
+
'MacIntel': 'macOS',
|
|
59
|
+
'Linux x86_64': 'Linux',
|
|
60
|
+
};
|
|
61
|
+
const uaChPlatform = legacyToUaCH[platform] ?? platform;
|
|
62
|
+
// UA-CH brands from fingerprint
|
|
63
|
+
const uaData = fp.navigator?.userAgentData;
|
|
64
|
+
const brands = uaData?.brands ?? [];
|
|
65
|
+
const fullVersionList = uaData?.fullVersionList ?? brands;
|
|
66
|
+
const uaBrands = brands.map((b, i) => ({
|
|
67
|
+
brand: b.brand,
|
|
68
|
+
version: b.version,
|
|
69
|
+
full_version: fullVersionList[i]?.version ?? b.version,
|
|
70
|
+
}));
|
|
71
|
+
// WebGL from fingerprint. Real Chrome 147 on Apple Silicon leaks the
|
|
72
|
+
// exact chip variant verbatim ("ANGLE (Apple, ANGLE Metal Renderer:
|
|
73
|
+
// Apple M4 Pro, Unspecified Version)"), confirmed against a user's
|
|
74
|
+
// shipping Chrome + CreepJS verdict. Matching that behavior is safer than
|
|
75
|
+
// sanitizing to a generic M1 — anti-bot ML models expect the raw string,
|
|
76
|
+
// and the hardware leak is not a Chrome-level invariant violation.
|
|
77
|
+
const videoCard = fp.videoCard;
|
|
78
|
+
const webglVendor = videoCard?.vendor ?? 'Google Inc. (NVIDIA)';
|
|
79
|
+
const webglRenderer = videoCard?.renderer
|
|
80
|
+
?? 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0, D3D11)';
|
|
81
|
+
// Screen
|
|
82
|
+
const screen = fp.screen;
|
|
83
|
+
// User agent from headers (most accurate source)
|
|
84
|
+
const userAgent = headers['user-agent']
|
|
85
|
+
?? fp.navigator?.userAgent
|
|
86
|
+
?? '';
|
|
87
|
+
// Accept-language: prefer the pre-resolved triple (so a user-supplied locale wins)
|
|
88
|
+
// and fall back to fingerprint headers when no resolution happened.
|
|
89
|
+
//
|
|
90
|
+
// Important: the C++ FingerprintConfig reader splits this string on commas and
|
|
91
|
+
// feeds each entry verbatim into `navigator.languages` (the JS array). Real Chrome's
|
|
92
|
+
// navigator.languages never carries q-values — those are HTTP Accept-Language
|
|
93
|
+
// semantics only. If we leave `"en-US,en;q=0.9"` in the config, the JS array leaks
|
|
94
|
+
// `"en;q=0.9"` which is an instant detectable anomaly. Strip q-values here so the
|
|
95
|
+
// config field is the clean list; the HTTP header flows from the same field and
|
|
96
|
+
// will also be q-less, which is a valid (if less common) real-browser pattern.
|
|
97
|
+
const rawAcceptLanguage = resolvedLocale?.languages
|
|
98
|
+
?? headers['accept-language']
|
|
99
|
+
?? headers['Accept-Language'];
|
|
100
|
+
const acceptLanguage = rawAcceptLanguage
|
|
101
|
+
? rawAcceptLanguage.split(',').map((l) => l.split(';')[0].trim()).filter(Boolean).join(',')
|
|
102
|
+
: undefined;
|
|
103
|
+
const navLanguage = resolvedLocale?.locale;
|
|
104
|
+
const timezone = resolvedLocale?.timezone;
|
|
105
|
+
// Primary brand name — extract from UA-CH brands or derive from User-Agent
|
|
106
|
+
const brandName = extractBrandName(uaBrands, userAgent);
|
|
107
|
+
// Battery — generate realistic values based on target platform.
|
|
108
|
+
// Uses UA-CH platform names ('Windows'|'macOS'|'Linux') for the desktop/mac checks.
|
|
109
|
+
const battery = generateBatteryConfig(uaChPlatform, seed);
|
|
110
|
+
// deviceMemory: spec requires the value be one of {0.25, 0.5, 1, 2, 4, 8}
|
|
111
|
+
// (https://www.w3.org/TR/device-memory/#sec-device-memory-js-api). Exposing
|
|
112
|
+
// anything outside this set — in particular the real 32 on a 32 GB machine —
|
|
113
|
+
// is an immediate "bot" signal for any vendor that checks.
|
|
114
|
+
const rawDeviceMemory = fp.navigator?.deviceMemory ?? 8;
|
|
115
|
+
const deviceMemory = clampDeviceMemoryToSpecBuckets(rawDeviceMemory);
|
|
116
|
+
// colorDepth: real Chrome privacy-reduces to 24 regardless of display HDR
|
|
117
|
+
// capability. 30 is the raw macOS value that leaks through when we don't cap.
|
|
118
|
+
const rawColorDepth = screen?.colorDepth ?? 24;
|
|
119
|
+
const colorDepth = Math.min(rawColorDepth, 24);
|
|
120
|
+
const config = {
|
|
121
|
+
version: 1,
|
|
122
|
+
seed,
|
|
123
|
+
brandName,
|
|
124
|
+
...(timezone && { timezone }),
|
|
125
|
+
navigator: {
|
|
126
|
+
platform, // legacy form: 'MacIntel' | 'Win32' | 'Linux x86_64'
|
|
127
|
+
...(navLanguage && { language: navLanguage }),
|
|
128
|
+
...(acceptLanguage && { languages: acceptLanguage }),
|
|
129
|
+
hardwareConcurrency: fp.navigator?.hardwareConcurrency ?? 8,
|
|
130
|
+
deviceMemory,
|
|
131
|
+
userAgent,
|
|
132
|
+
...(uaBrands.length > 0 && {
|
|
133
|
+
userAgentData: {
|
|
134
|
+
brands: uaBrands,
|
|
135
|
+
mobile: uaData?.mobile ?? false,
|
|
136
|
+
platform: uaData?.platform ?? uaChPlatform,
|
|
137
|
+
platformVersion: uaData?.platformVersion ?? '15.0.0',
|
|
138
|
+
architecture: uaData?.architecture ?? 'x86',
|
|
139
|
+
bitness: uaData?.bitness ?? '64',
|
|
140
|
+
model: uaData?.model ?? '',
|
|
141
|
+
uaFullVersion: uaData?.uaFullVersion ?? extractFullVersion(userAgent),
|
|
142
|
+
fullVersionList: uaBrands,
|
|
143
|
+
},
|
|
144
|
+
}),
|
|
145
|
+
},
|
|
146
|
+
webgl: {
|
|
147
|
+
vendor: webglVendor,
|
|
148
|
+
renderer: webglRenderer,
|
|
149
|
+
},
|
|
150
|
+
screen: {
|
|
151
|
+
width: screen?.width ?? 1920,
|
|
152
|
+
height: screen?.height ?? 1080,
|
|
153
|
+
availWidth: screen?.availWidth ?? screen?.width ?? 1920,
|
|
154
|
+
availHeight: screen?.availHeight ?? (screen?.height ? screen.height - 40 : 1040),
|
|
155
|
+
colorDepth,
|
|
156
|
+
pixelRatio: screen?.devicePixelRatio ?? 1,
|
|
157
|
+
},
|
|
158
|
+
battery,
|
|
159
|
+
noise: {
|
|
160
|
+
canvas: true,
|
|
161
|
+
audio: true,
|
|
162
|
+
rects: true,
|
|
163
|
+
measureText: true,
|
|
164
|
+
},
|
|
165
|
+
timing: {
|
|
166
|
+
performanceNowResolutionMs: 1,
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
// WebGPU — from explicit webgpu field on fingerprint (non-Apify profiles), or
|
|
170
|
+
// derived from WebGL vendor as a fallback (Apify fingerprints have no webgpu data).
|
|
171
|
+
const webgpuData = fp.webgpu;
|
|
172
|
+
const derivedWebGPUVendor = webgpuData?.vendor ?? deriveWebGPUVendorFromWebGL(webglVendor);
|
|
173
|
+
if (derivedWebGPUVendor) {
|
|
174
|
+
config.webgpu = {
|
|
175
|
+
vendor: derivedWebGPUVendor,
|
|
176
|
+
architecture: webgpuData?.architecture ?? '',
|
|
177
|
+
device: webgpuData?.device ?? '',
|
|
178
|
+
description: webgpuData?.description ?? '',
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return config;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Write the fingerprint config to a temp file and return the path.
|
|
185
|
+
* The caller is responsible for deleting the file after the browser exits.
|
|
186
|
+
*/
|
|
187
|
+
export async function writeTempFingerprintConfig(config) {
|
|
188
|
+
const tmpDir = os.tmpdir();
|
|
189
|
+
const fileName = `fp-${Date.now()}-${Math.random().toString(36).slice(2)}.json`;
|
|
190
|
+
const filePath = path.join(tmpDir, fileName);
|
|
191
|
+
await fs.writeFile(filePath, JSON.stringify(config, null, 2), 'utf8');
|
|
192
|
+
return filePath;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Delete the temp config file after the browser has exited.
|
|
196
|
+
*/
|
|
197
|
+
export async function cleanupTempFingerprintConfig(filePath) {
|
|
198
|
+
try {
|
|
199
|
+
await fs.unlink(filePath);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Non-fatal — temp file will be cleaned by OS eventually
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
206
|
+
/**
|
|
207
|
+
* Clamp a raw device-memory-in-GB value to the buckets required by the
|
|
208
|
+
* Device Memory API spec (https://www.w3.org/TR/device-memory/). Chrome
|
|
209
|
+
* always quantizes to {0.25, 0.5, 1, 2, 4, 8}. Returning anything outside
|
|
210
|
+
* this set — especially the real value on >8 GB machines — is an instant
|
|
211
|
+
* anti-bot detection signal.
|
|
212
|
+
*
|
|
213
|
+
* Rule (per spec): the returned value is the closest bucket that is less
|
|
214
|
+
* than or equal to the actual value, capped at 8.
|
|
215
|
+
*/
|
|
216
|
+
function clampDeviceMemoryToSpecBuckets(raw) {
|
|
217
|
+
const buckets = [0.25, 0.5, 1, 2, 4, 8];
|
|
218
|
+
if (!Number.isFinite(raw) || raw <= 0)
|
|
219
|
+
return 8;
|
|
220
|
+
if (raw >= 8)
|
|
221
|
+
return 8;
|
|
222
|
+
let bucket = buckets[0];
|
|
223
|
+
for (const b of buckets) {
|
|
224
|
+
if (b <= raw)
|
|
225
|
+
bucket = b;
|
|
226
|
+
}
|
|
227
|
+
return bucket;
|
|
228
|
+
}
|
|
229
|
+
/** Extract full Chrome version string from User-Agent (e.g. "Chrome/136.0.7103.0") */
|
|
230
|
+
function extractFullVersion(userAgent) {
|
|
231
|
+
const match = userAgent.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/);
|
|
232
|
+
return match?.[1] ?? '136.0.0.0';
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Extract primary brand name from UA-CH brands or User-Agent string.
|
|
236
|
+
* Returns the non-Chromium, non-greased brand (e.g. "Google Chrome").
|
|
237
|
+
*/
|
|
238
|
+
function extractBrandName(brands, userAgent) {
|
|
239
|
+
for (const b of brands) {
|
|
240
|
+
if (b.brand !== 'Chromium' && !b.brand.startsWith('Not')) {
|
|
241
|
+
return b.brand;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Fallback: derive from User-Agent header
|
|
245
|
+
if (userAgent.includes('Edg/'))
|
|
246
|
+
return 'Microsoft Edge';
|
|
247
|
+
if (userAgent.includes('OPR/'))
|
|
248
|
+
return 'Opera';
|
|
249
|
+
if (userAgent.includes('Brave'))
|
|
250
|
+
return 'Brave';
|
|
251
|
+
return 'Google Chrome';
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Generate realistic battery values based on platform and seed.
|
|
255
|
+
* Desktop machines are typically plugged in (charging=true, level=1.0).
|
|
256
|
+
* Uses seed for deterministic but varied values across sessions.
|
|
257
|
+
*/
|
|
258
|
+
function generateBatteryConfig(platform, seed) {
|
|
259
|
+
// Seeded PRNG for deterministic variation
|
|
260
|
+
const rng = seedRng(seed);
|
|
261
|
+
const isDesktop = platform === 'Windows' || platform === 'Linux';
|
|
262
|
+
const isMac = platform === 'macOS';
|
|
263
|
+
if (isDesktop) {
|
|
264
|
+
// Desktop: almost always plugged in, full battery
|
|
265
|
+
// ~90% chance fully charged, ~10% chance slightly below
|
|
266
|
+
if (rng() < 0.9) {
|
|
267
|
+
return { charging: true, level: 1.0, chargingTime: 0, dischargingTime: Infinity };
|
|
268
|
+
}
|
|
269
|
+
// Simulate charging desktop with near-full battery
|
|
270
|
+
const level = 0.85 + rng() * 0.14; // 0.85-0.99
|
|
271
|
+
return {
|
|
272
|
+
charging: true,
|
|
273
|
+
level: Math.round(level * 100) / 100,
|
|
274
|
+
chargingTime: Math.floor(rng() * 1800), // 0-30min remaining
|
|
275
|
+
dischargingTime: Infinity,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
if (isMac) {
|
|
279
|
+
// MacBooks: ~70% plugged in, sometimes on battery
|
|
280
|
+
const charging = rng() < 0.7;
|
|
281
|
+
if (charging) {
|
|
282
|
+
const level = 0.6 + rng() * 0.4; // 0.60-1.0
|
|
283
|
+
return {
|
|
284
|
+
charging: true,
|
|
285
|
+
level: Math.round(level * 100) / 100,
|
|
286
|
+
chargingTime: level >= 1.0 ? 0 : Math.floor((1.0 - level) * 7200),
|
|
287
|
+
dischargingTime: Infinity,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
const level = 0.3 + rng() * 0.65; // 0.30-0.95
|
|
291
|
+
return {
|
|
292
|
+
charging: false,
|
|
293
|
+
level: Math.round(level * 100) / 100,
|
|
294
|
+
chargingTime: Infinity,
|
|
295
|
+
dischargingTime: Math.floor(level * 14400), // proportional to level
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
// Default: plugged-in desktop
|
|
299
|
+
return { charging: true, level: 1.0, chargingTime: 0, dischargingTime: Infinity };
|
|
300
|
+
}
|
|
301
|
+
/** Simple seeded PRNG (mulberry32) returning [0, 1) */
|
|
302
|
+
function seedRng(seed) {
|
|
303
|
+
let s = seed | 0;
|
|
304
|
+
return () => {
|
|
305
|
+
s = (s + 0x6D2B79F5) | 0;
|
|
306
|
+
let t = Math.imul(s ^ (s >>> 15), 1 | s);
|
|
307
|
+
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
308
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Derive a WebGPU vendor string from the WebGL unmasked vendor string.
|
|
313
|
+
* Used as a fallback when no explicit webgpu profile data is available (Apify fingerprints).
|
|
314
|
+
* e.g. "Google Inc. (NVIDIA)" → "nvidia"
|
|
315
|
+
*/
|
|
316
|
+
function deriveWebGPUVendorFromWebGL(webglVendor) {
|
|
317
|
+
const v = webglVendor.toLowerCase();
|
|
318
|
+
if (v.includes('nvidia'))
|
|
319
|
+
return 'nvidia';
|
|
320
|
+
if (v.includes('amd') || v.includes('ati'))
|
|
321
|
+
return 'amd';
|
|
322
|
+
if (v.includes('intel'))
|
|
323
|
+
return 'intel';
|
|
324
|
+
if (v.includes('apple'))
|
|
325
|
+
return 'apple';
|
|
326
|
+
return '';
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=anti-detect-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anti-detect-config.js","sourceRoot":"","sources":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AG,CAAC,CAAC,CAAC;QACzC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC/C,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC;IACjD,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAS,2BAA2B,CAAC,WAAmB;IACpD,MAAM,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IACpC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC1C,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzD,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACxC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACxC,OAAO,EAAE,CAAC;AACd,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BrowserProcess } from './process.js';
|
|
2
|
+
import { type FingerprintConfigJson } from './anti-detect-config.js';
|
|
3
|
+
import type { ResolvedLocale } from '../fingerprinting/locale-resolver.js';
|
|
2
4
|
/**
|
|
3
5
|
* Humanization options for simulating realistic user behavior
|
|
4
6
|
* All options are disabled by default for performance
|
|
@@ -20,6 +22,17 @@ export interface LaunchBrowserOptions {
|
|
|
20
22
|
headless?: boolean;
|
|
21
23
|
executablePath?: string;
|
|
22
24
|
useExperimentalFingerprints?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Use the native anti-detect browser (Cromite-based custom build) for
|
|
27
|
+
* fingerprint spoofing at the C++ level. When true and the anti-detect
|
|
28
|
+
* browser is installed (via postinstall.js), it will be used instead of
|
|
29
|
+
* system Chrome. JS-level overrides for C++-handled properties are skipped,
|
|
30
|
+
* reducing the injection bundle from ~150KB to ~40KB.
|
|
31
|
+
*
|
|
32
|
+
* Falls back silently to system Chrome if the anti-detect binary is not found.
|
|
33
|
+
* Default: false
|
|
34
|
+
*/
|
|
35
|
+
useNativeStealth?: boolean;
|
|
23
36
|
/** Whether to start the browser maximized and fullscreen. Default: true */
|
|
24
37
|
maximizeWindow?: boolean;
|
|
25
38
|
/** Enable all stealth arguments for anti-bot evasion. Default: true */
|
|
@@ -70,6 +83,19 @@ export interface LaunchBrowserOptions {
|
|
|
70
83
|
/** Humanization options (all disabled by default) */
|
|
71
84
|
humanization?: HumanizationOptions;
|
|
72
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Pre-generated FingerprintConfig JSON to pass via --fingerprint-config to the
|
|
88
|
+
* anti-detect browser. When provided, this overrides the static default_fingerprint.json
|
|
89
|
+
* so that each browser instance gets unique C++-level hardware fingerprints (GPU, screen,
|
|
90
|
+
* CPU count, device memory) derived from the real device profile.
|
|
91
|
+
*/
|
|
92
|
+
fingerprintConfig?: FingerprintConfigJson;
|
|
93
|
+
/**
|
|
94
|
+
* Pre-resolved locale triple from `resolveLocale()`. Drives `--lang`,
|
|
95
|
+
* `--fingerprint-accept-language` (when native-stealth is active), and the LANG/LC_ALL
|
|
96
|
+
* env vars passed to the spawned Chrome process.
|
|
97
|
+
*/
|
|
98
|
+
resolvedLocale?: ResolvedLocale;
|
|
73
99
|
}
|
|
74
100
|
export declare const launchBrowserWithNewProfile: (executablePath: string, options?: LaunchBrowserOptions) => Promise<BrowserProcess>;
|
|
75
101
|
export declare const createTempUserDataDir: () => Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser-process/browser.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,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