jumpy-lion 1.0.0-beta.5 → 1.0.0-beta.7
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/dist/browser-plugin.d.ts.map +1 -1
- package/dist/browser-plugin.js +15 -5
- package/dist/browser-plugin.js.map +1 -1
- package/dist/browser-process/anti-detect-config.d.ts +7 -0
- package/dist/browser-process/anti-detect-config.d.ts.map +1 -1
- package/dist/browser-process/anti-detect-config.js +68 -18
- package/dist/browser-process/anti-detect-config.js.map +1 -1
- package/dist/browser-process/apple-silicon-devices.d.ts +96 -0
- package/dist/browser-process/apple-silicon-devices.d.ts.map +1 -0
- package/dist/browser-process/apple-silicon-devices.js +185 -0
- package/dist/browser-process/apple-silicon-devices.js.map +1 -0
- package/dist/browser-process/browser.d.ts.map +1 -1
- package/dist/browser-process/browser.js +58 -21
- package/dist/browser-process/browser.js.map +1 -1
- package/dist/browser-process/gpu-family-profiles.d.ts +3 -0
- package/dist/browser-process/gpu-family-profiles.d.ts.map +1 -1
- package/dist/browser-process/gpu-family-profiles.js +170 -88
- package/dist/browser-process/gpu-family-profiles.js.map +1 -1
- package/dist/browser-process/integrity-headers.d.ts +33 -15
- package/dist/browser-process/integrity-headers.d.ts.map +1 -1
- package/dist/browser-process/integrity-headers.js +79 -19
- package/dist/browser-process/integrity-headers.js.map +1 -1
- package/dist/browser-profiles/chrome/create.d.ts +2 -1
- package/dist/browser-profiles/chrome/create.d.ts.map +1 -1
- package/dist/browser-profiles/chrome/create.js +2 -2
- package/dist/browser-profiles/chrome/create.js.map +1 -1
- package/dist/browser-profiles/chrome/default.d.ts +7 -0
- package/dist/browser-profiles/chrome/default.d.ts.map +1 -1
- package/dist/browser-profiles/chrome/default.js +16 -0
- package/dist/browser-profiles/chrome/default.js.map +1 -1
- package/dist/browser-profiles/chrome/populate-profile.d.ts +2 -0
- package/dist/browser-profiles/chrome/populate-profile.d.ts.map +1 -1
- package/dist/browser-profiles/chrome/populate-profile.js +2 -2
- package/dist/browser-profiles/chrome/populate-profile.js.map +1 -1
- package/dist/fingerprinting/hardware-realism.js +53 -1
- package/dist/fingerprinting/hardware-realism.js.map +1 -1
- package/dist/fingerprinting/locale-resolver.d.ts +21 -0
- package/dist/fingerprinting/locale-resolver.d.ts.map +1 -1
- package/dist/fingerprinting/locale-resolver.js +43 -6
- package/dist/fingerprinting/locale-resolver.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/launch-stealth-browser.d.ts +143 -0
- package/dist/launch-stealth-browser.d.ts.map +1 -0
- package/dist/launch-stealth-browser.js +133 -0
- package/dist/launch-stealth-browser.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `launchStealthBrowser()` - launch the anti-detect browser with the same stealth
|
|
3
|
+
* setup the crawler uses internally, without going through the crawler.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS EXISTS. Everything needed to launch a properly-spoofed session was
|
|
6
|
+
* already in the package and none of it was reachable from outside it. The
|
|
7
|
+
* `exports` map allows only `.` and `./package.json`, so a consumer cannot deep
|
|
8
|
+
* import `browser-process/*`, and `index.ts` exported the crawler, the router,
|
|
9
|
+
* `CdpPage` and the session-bundle helpers - no launcher. A consumer who wanted a
|
|
10
|
+
* browser rather than a crawl had to re-implement the composition, and the parts
|
|
11
|
+
* are not obvious: miss one and the launch still succeeds while advertising a
|
|
12
|
+
* contradiction.
|
|
13
|
+
*
|
|
14
|
+
* That gap had a measurable cost. The Google-only integrity header module shipped
|
|
15
|
+
* with no reachable caller, so `sec-ch-ua-full-version` could not be aligned with
|
|
16
|
+
* the digest's build from outside the package at all.
|
|
17
|
+
*
|
|
18
|
+
* WHAT THE ORDER BUYS YOU. These steps are sequenced, not a bag of options:
|
|
19
|
+
*
|
|
20
|
+
* 1. `prepareForLaunch` picks an OS-matching, uncontaminated profile and
|
|
21
|
+
* generates the C++ `FingerprintConfigJson` from it. Selection must happen
|
|
22
|
+
* before the config is written - once the browser starts with a wrong-OS
|
|
23
|
+
* profile baked in, nothing afterwards can undo it.
|
|
24
|
+
* 2. The same call aligns UA and UA-CH with the real binary version, so the
|
|
25
|
+
* profile's own Chrome vintage never contradicts the binary.
|
|
26
|
+
* 3. `launchBrowserWithNewProfile` applies the integrity headers - which also
|
|
27
|
+
* re-aligns the advertised full version onto the seed's build - then writes
|
|
28
|
+
* the config and composes the command line.
|
|
29
|
+
*
|
|
30
|
+
* Per ADR 0004 the identity a session claims is the reference, never the host. On
|
|
31
|
+
* Linux with a macOS profile every surface has to present the macOS shape, so the
|
|
32
|
+
* profile's OS is what drives the config, and `fingerprintGeneratorOptions.
|
|
33
|
+
* operatingSystems` is how you choose it.
|
|
34
|
+
*/
|
|
35
|
+
import { log } from 'crawlee';
|
|
36
|
+
import { isAntiDetectBrowserSync } from './browser-process/anti-detect-browser.js';
|
|
37
|
+
import { launchBrowserWithNewProfile } from './browser-process/browser.js';
|
|
38
|
+
import { prepareForLaunch } from './browser-process/fingerprint-config.js';
|
|
39
|
+
import { resolveAntiDetectBrowserPath, getAntiDetectBrowserPath } from './browser-process/get-chrome-executable.js';
|
|
40
|
+
/**
|
|
41
|
+
* Launch a fully-spoofed browser and return the process plus the config it used.
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { launchStealthBrowser } from 'jumpy-lion';
|
|
45
|
+
*
|
|
46
|
+
* const { browserProcess, fingerprintConfig } = await launchStealthBrowser({
|
|
47
|
+
* debuggingPort: 9222,
|
|
48
|
+
* sessionId: 'session-1',
|
|
49
|
+
* fingerprintGeneratorOptions: { operatingSystems: ['macos'] },
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* const wsUrl = await browserProcess.wsEndpoint();
|
|
53
|
+
* // … drive it over CDP …
|
|
54
|
+
* await browserProcess.kill();
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* On proxies: `proxyUrl` is passed to Chromium directly. Prefer SOCKS5 over an
|
|
58
|
+
* HTTP proxy that terminates TLS - a MITM proxy replaces Chromium's own TLS
|
|
59
|
+
* ClientHello with its runtime's, which changes the JA4 fingerprint and undoes
|
|
60
|
+
* work no JS or C++ override can reach.
|
|
61
|
+
*/
|
|
62
|
+
export async function launchStealthBrowser(options = {}) {
|
|
63
|
+
const executablePath = options.executablePath
|
|
64
|
+
// resolveAntiDetectBrowserPath throws a diagnostic naming the paths it
|
|
65
|
+
// checked, which is better than launching something unspoofed.
|
|
66
|
+
?? resolveAntiDetectBrowserPath();
|
|
67
|
+
const usingNativeStealth = isAntiDetectBrowserSync(executablePath);
|
|
68
|
+
if (!usingNativeStealth) {
|
|
69
|
+
log.warning('[AntiDetect] launchStealthBrowser: the resolved binary is not the anti-detect build, '
|
|
70
|
+
+ 'so every C++-level override is inactive and only the JS layer applies. '
|
|
71
|
+
+ `Path: ${executablePath}`);
|
|
72
|
+
}
|
|
73
|
+
// The shape prepareForLaunch reads and writes. It stamps the generated config
|
|
74
|
+
// onto launchOptions, which is the same object passed to the launcher below,
|
|
75
|
+
// so the config reaches the browser without being threaded by hand.
|
|
76
|
+
const launchOptions = {
|
|
77
|
+
executablePath,
|
|
78
|
+
debuggingPort: options.debuggingPort,
|
|
79
|
+
anonymizedProxyUrl: options.proxyUrl,
|
|
80
|
+
windowWidth: options.windowWidth ?? 1920,
|
|
81
|
+
windowHeight: options.windowHeight ?? 1080,
|
|
82
|
+
userDataDir: options.userDataDir,
|
|
83
|
+
keepUserDataDir: options.keepUserDataDir,
|
|
84
|
+
useNativeStealth: usingNativeStealth,
|
|
85
|
+
enableStealthMode: true,
|
|
86
|
+
extraArgs: options.extraArgs,
|
|
87
|
+
fingerprintGeneratorOptions: options.fingerprintGeneratorOptions,
|
|
88
|
+
fingerprintOptions: {
|
|
89
|
+
// Real captured Chrome device profiles rather than generated ones.
|
|
90
|
+
// Defaulted ON: a generated profile is internally consistent but its
|
|
91
|
+
// combination of values need not correspond to any machine that
|
|
92
|
+
// exists, and the population of generated profiles is itself a
|
|
93
|
+
// distribution a detector can learn. Overridable, not forced.
|
|
94
|
+
useNonApifyFingerprints: options.useNonApifyFingerprints ?? true,
|
|
95
|
+
// The seed key IS the identity. resolveSeedKey falls back to the
|
|
96
|
+
// proxy URL when this is absent, so without it two launches on one
|
|
97
|
+
// proxy silently share a fingerprint.
|
|
98
|
+
...(options.sessionId && { seedKey: options.sessionId }),
|
|
99
|
+
...(options.locale && { locale: options.locale }),
|
|
100
|
+
},
|
|
101
|
+
// A caller-supplied config wins: prepareForLaunch leaves an already
|
|
102
|
+
// stamped config alone, which is what makes session replay exact.
|
|
103
|
+
...(options.fingerprintConfig && { fingerprintConfig: options.fingerprintConfig }),
|
|
104
|
+
};
|
|
105
|
+
if (!options.fingerprintConfig) {
|
|
106
|
+
// launchOptions is passed BY REFERENCE, not spread. prepareForLaunch
|
|
107
|
+
// communicates by mutating it - it stamps the generated config onto
|
|
108
|
+
// `launchOptions.fingerprintConfig` and resizes the window to the claimed
|
|
109
|
+
// screen. Handing it a copy would leave both changes on an object nobody
|
|
110
|
+
// reads, and the launch would still succeed, using an unaligned config.
|
|
111
|
+
await prepareForLaunch({
|
|
112
|
+
proxyUrl: options.proxyUrl,
|
|
113
|
+
useNativeStealth: usingNativeStealth,
|
|
114
|
+
launchOptions: launchOptions,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const browserProcess = await launchBrowserWithNewProfile(executablePath, launchOptions);
|
|
118
|
+
return {
|
|
119
|
+
browserProcess,
|
|
120
|
+
fingerprintConfig: launchOptions.fingerprintConfig,
|
|
121
|
+
usingNativeStealth,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Where the anti-detect binary was found, or `null` if it is not installed.
|
|
126
|
+
*
|
|
127
|
+
* Exported so a consumer can check for the native build before launching rather
|
|
128
|
+
* than discovering from a warning that it ran unspoofed.
|
|
129
|
+
*/
|
|
130
|
+
export function getStealthBrowserPath() {
|
|
131
|
+
return getAntiDetectBrowserPath();
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=launch-stealth-browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch-stealth-browser.js","sourceRoot":"","sources":["../src/launch-stealth-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAEnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAyFpH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACtC,UAAuC,EAAE;IAEzC,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc;QACzC,uEAAuE;QACvE,+DAA+D;WAC5D,4BAA4B,EAAE,CAAC;IAEtC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,cAAc,CAAC,CAAC;IACnE,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACtB,GAAG,CAAC,OAAO,CACP,uFAAuF;cACrF,yEAAyE;cACzE,SAAS,cAAc,EAAE,CAC9B,CAAC;IACN,CAAC;IAED,8EAA8E;IAC9E,6EAA6E;IAC7E,oEAAoE;IACpE,MAAM,aAAa,GAA4B;QAC3C,cAAc;QACd,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,kBAAkB,EAAE,OAAO,CAAC,QAAQ;QACpC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;QACxC,YAAY,EAAE,OAAO,C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