jumpy-lion 1.0.0-beta.4 → 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 +47 -7
- package/dist/browser-process/anti-detect-config.d.ts.map +1 -1
- package/dist/browser-process/anti-detect-config.js +79 -48
- 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 +121 -17
- 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 +158 -0
- package/dist/browser-process/integrity-headers.d.ts.map +1 -0
- package/dist/browser-process/integrity-headers.js +228 -0
- package/dist/browser-process/integrity-headers.js.map +1 -0
- 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.d.ts +46 -0
- package/dist/fingerprinting/hardware-realism.d.ts.map +1 -1
- package/dist/fingerprinting/hardware-realism.js +104 -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
|
@@ -15,6 +15,12 @@ export interface ResolveLocaleInput {
|
|
|
15
15
|
timezone?: string;
|
|
16
16
|
/** Explicit Accept-Language header value (e.g. 'ko-KR,ko;q=0.9'). Overrides derived list. */
|
|
17
17
|
languages?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The caller's requested fingerprint-generator locales (e.g. ['it-IT', 'it']).
|
|
20
|
+
* This is explicit caller intent, unlike the generator's host-biased Accept-Language
|
|
21
|
+
* output, so the first valid tag ranks above the proxy country lookup.
|
|
22
|
+
*/
|
|
23
|
+
generatorLocales?: string[];
|
|
18
24
|
/** ISO 3166-1 alpha-2 country code from proxy IP lookup (e.g. 'KR'). */
|
|
19
25
|
proxyCountry?: string;
|
|
20
26
|
/** Fingerprint-generator language, used as a fallback when nothing else is available. */
|
|
@@ -32,6 +38,21 @@ export interface ResolvedLocale {
|
|
|
32
38
|
}
|
|
33
39
|
/** Resolve every locale surface from whatever signals are available. */
|
|
34
40
|
export declare function resolveLocale(input?: ResolveLocaleInput): ResolvedLocale;
|
|
41
|
+
/**
|
|
42
|
+
* Turn an Accept-Language style list ('it-IT,it;q=0.9,en;q=0.8') into the q-less
|
|
43
|
+
* comma list that Chromium's --lang switch and the config's navigator.languages expect.
|
|
44
|
+
*/
|
|
45
|
+
export declare function toLangList(languages: string | undefined): string;
|
|
46
|
+
/**
|
|
47
|
+
* The value for Chromium's --lang switch, which sets ICU's default locale and so drives
|
|
48
|
+
* Intl.*().resolvedOptions().locale. Reads the one resolved locale; when none exists it
|
|
49
|
+
* derives the list from the fingerprint config's navigator languages (so --lang can never
|
|
50
|
+
* disagree with navigator.languages) and only then uses the historical en-US default.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveLangSwitch(resolvedLocale: Pick<ResolvedLocale, 'locale' | 'languages'> | undefined, configNavigator?: {
|
|
53
|
+
language?: string;
|
|
54
|
+
languages?: string;
|
|
55
|
+
}): string;
|
|
35
56
|
/**
|
|
36
57
|
* Look up the proxy IP's country (ISO 3166-1 alpha-2) via ipinfo.io.
|
|
37
58
|
* Best-effort: returns undefined on any failure so callers can fall through
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale-resolver.d.ts","sourceRoot":"","sources":["../../src/fingerprinting/locale-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,kBAAkB;IAC/B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC3B,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC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;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAetF"}
|
|
@@ -70,9 +70,15 @@ export function resolveLocale(input = {}) {
|
|
|
70
70
|
const posix = toPosix(locale);
|
|
71
71
|
return { locale, languages, timezone, posix };
|
|
72
72
|
}
|
|
73
|
-
function pickLocale({ locale, proxyCountry, fingerprintLanguage }) {
|
|
73
|
+
function pickLocale({ locale, generatorLocales, proxyCountry, fingerprintLanguage }) {
|
|
74
74
|
if (locale && isValidBcp47(locale))
|
|
75
75
|
return locale;
|
|
76
|
+
// A lookup over the network can fail (a residential proxy often times out against
|
|
77
|
+
// ipinfo.io), and a failed lookup used to silently demote an Italian run to en-US while
|
|
78
|
+
// the fingerprint config still claimed it-IT. The caller's own locales never fail.
|
|
79
|
+
const fromGenerator = generatorLocales?.find(isValidBcp47);
|
|
80
|
+
if (fromGenerator)
|
|
81
|
+
return fromGenerator;
|
|
76
82
|
if (proxyCountry) {
|
|
77
83
|
const fromCountry = COUNTRY_TO_LOCALE[proxyCountry.toUpperCase()];
|
|
78
84
|
if (fromCountry)
|
|
@@ -96,19 +102,22 @@ function pickLocale({ locale, proxyCountry, fingerprintLanguage }) {
|
|
|
96
102
|
}
|
|
97
103
|
return DEFAULT_LOCALE;
|
|
98
104
|
}
|
|
105
|
+
// Timezone priority: explicit tz > proxy country (the exit IP's own zone) > locale region > UTC.
|
|
106
|
+
// The proxy outranks the locale region because a page can compare the timezone with the IP geo,
|
|
107
|
+
// while a locale such as en-US legitimately appears on a German exit.
|
|
99
108
|
function pickTimezone({ timezone, proxyCountry }, region) {
|
|
100
109
|
if (timezone)
|
|
101
110
|
return timezone;
|
|
102
|
-
if (region) {
|
|
103
|
-
const fromRegion = REGION_TO_TIMEZONE[region];
|
|
104
|
-
if (fromRegion)
|
|
105
|
-
return fromRegion;
|
|
106
|
-
}
|
|
107
111
|
if (proxyCountry) {
|
|
108
112
|
const fromProxy = REGION_TO_TIMEZONE[proxyCountry.toUpperCase()];
|
|
109
113
|
if (fromProxy)
|
|
110
114
|
return fromProxy;
|
|
111
115
|
}
|
|
116
|
+
if (region) {
|
|
117
|
+
const fromRegion = REGION_TO_TIMEZONE[region];
|
|
118
|
+
if (fromRegion)
|
|
119
|
+
return fromRegion;
|
|
120
|
+
}
|
|
112
121
|
return DEFAULT_TIMEZONE;
|
|
113
122
|
}
|
|
114
123
|
/**
|
|
@@ -131,6 +140,34 @@ function buildLanguages(locale) {
|
|
|
131
140
|
}
|
|
132
141
|
return parts.join(',');
|
|
133
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Turn an Accept-Language style list ('it-IT,it;q=0.9,en;q=0.8') into the q-less
|
|
145
|
+
* comma list that Chromium's --lang switch and the config's navigator.languages expect.
|
|
146
|
+
*/
|
|
147
|
+
export function toLangList(languages) {
|
|
148
|
+
return (languages ?? '')
|
|
149
|
+
.split(',')
|
|
150
|
+
.map(l => l.split(';')[0].trim())
|
|
151
|
+
.filter(Boolean)
|
|
152
|
+
.join(',');
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The value for Chromium's --lang switch, which sets ICU's default locale and so drives
|
|
156
|
+
* Intl.*().resolvedOptions().locale. Reads the one resolved locale; when none exists it
|
|
157
|
+
* derives the list from the fingerprint config's navigator languages (so --lang can never
|
|
158
|
+
* disagree with navigator.languages) and only then uses the historical en-US default.
|
|
159
|
+
*/
|
|
160
|
+
export function resolveLangSwitch(resolvedLocale, configNavigator) {
|
|
161
|
+
if (resolvedLocale?.locale) {
|
|
162
|
+
return toLangList(resolvedLocale.languages) || resolvedLocale.locale;
|
|
163
|
+
}
|
|
164
|
+
const fromConfig = toLangList(configNavigator?.languages);
|
|
165
|
+
if (fromConfig)
|
|
166
|
+
return fromConfig;
|
|
167
|
+
if (configNavigator?.language)
|
|
168
|
+
return configNavigator.language;
|
|
169
|
+
return `${DEFAULT_LOCALE},en`;
|
|
170
|
+
}
|
|
134
171
|
/** Extract the region subtag (uppercase) from a BCP-47 tag. 'ko-KR' → 'KR'. */
|
|
135
172
|
function extractRegion(locale) {
|
|
136
173
|
const [, region] = locale.split('-');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale-resolver.js","sourceRoot":"","sources":["../../src/fingerprinting/locale-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"locale-resolver.js","sourceRoot":"","sources":["../../src/fingerprinting/locale-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAgCH,qFAAqF;AACrF,qFAAqF;AACrF,MAAM,iBAAiB,GAA2B;IAC9C,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO;IAC5E,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO;IACrC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO;IACrC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO;IAC5E,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO;IACxB,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO;IACxB,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO;IAC5E,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO,EAAE,E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,CAAC,cAAc,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC;YAC/B,GAAG,EAAE,wBAAwB;YAC7B,QAAQ;YACR,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;SAC7B,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAwC,CAAC;QAC/D,OAAO,IAAI,EAAE,OAAO,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,SAAS,CAAC;IACrB,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,9 @@ export { restoreSession, installSessionInjectionHook, buildStorageInjectionScrip
|
|
|
10
10
|
export { assertValidBundle, SCHEMA_VERSION } from "./session/types.js";
|
|
11
11
|
export type { SessionBundle, SessionBundleBrowserProfile, SessionBundleFingerprintInput, SessionBundleProxyMeta, SessionBundleUserDataDir, SerializedCookie, StorageMap, LaunchSnapshot, } from "./session/types.js";
|
|
12
12
|
export type { SaveSessionOptions } from "./session/save.js";
|
|
13
|
+
export { launchStealthBrowser, getStealthBrowserPath } from "./launch-stealth-browser.js";
|
|
14
|
+
export type { LaunchStealthBrowserOptions, StealthBrowserLaunch } from "./launch-stealth-browser.js";
|
|
15
|
+
export type { FingerprintConfigJson } from "./browser-process/anti-detect-config.js";
|
|
16
|
+
export { applyIntegrityToConfig, buildIntegrityHeaderArgs, VERIFIED_INTEGRITY_PROFILES, INTEGRITY_CLAIMED_VERSION, CHROME_API_KEYS, } from "./browser-process/integrity-headers.js";
|
|
17
|
+
export type { IntegrityProfile, ClaimedIntegrityPlatform } from "./browser-process/integrity-headers.js";
|
|
13
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cA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,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,YAAY,EACR,aAAa,EACb,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,UAAU,EACV,cAAc,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAO5D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,YAAY,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACrG,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAWrF,OAAO,EACH,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,eAAe,GAClB,MAAM,wCAAwC,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,4 +9,20 @@ export { CdpPage };
|
|
|
9
9
|
export { saveSession } from "./session/save.js";
|
|
10
10
|
export { restoreSession, installSessionInjectionHook, buildStorageInjectionScript } from "./session/inject-hook.js";
|
|
11
11
|
export { assertValidBundle, SCHEMA_VERSION } from "./session/types.js";
|
|
12
|
+
// Standalone launcher - the crawler's own stealth setup, without the crawler.
|
|
13
|
+
// Composes profile selection, C++ fingerprint config generation, binary-version
|
|
14
|
+
// alignment and the Google integrity headers in the order that matters, then
|
|
15
|
+
// launches the anti-detect binary. See launch-stealth-browser.ts for why the
|
|
16
|
+
// order is load-bearing.
|
|
17
|
+
export { launchStealthBrowser, getStealthBrowserPath } from "./launch-stealth-browser.js";
|
|
18
|
+
// Google-only request-header integrity. Exported so a consumer can see which
|
|
19
|
+
// Chrome builds we hold a VERIFIED seed for, and align the claimed version with
|
|
20
|
+
// it. Previously this module had no reachable caller at all: it was neither
|
|
21
|
+
// re-exported here nor deep-importable through the `exports` map, so the version
|
|
22
|
+
// the digest is computed for could not be chosen from outside the package.
|
|
23
|
+
//
|
|
24
|
+
// Only verified seeds are usable. A missing header set leaves us
|
|
25
|
+
// indistinguishable from every other Chromium build; a header carrying a wrong
|
|
26
|
+
// digest is impossible-valued and therefore unique.
|
|
27
|
+
export { applyIntegrityToConfig, buildIntegrityHeaderArgs, VERIFIED_INTEGRITY_PROFILES, INTEGRITY_CLAIMED_VERSION, CHROME_API_KEYS, } from "./browser-process/integrity-headers.js";
|
|
12
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAavE,8EAA8E;AAC9E,gFAAgF;AAChF,6EAA6E;AAC7E,6EAA6E;AAC7E,yBAAyB;AACzB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAI1F,6EAA6E;AAC7E,gFAAgF;AAChF,4EAA4E;AAC5E,iFAAiF;AACjF,2EAA2E;AAC3E,EAAE;AACF,iEAAiE;AACjE,+EAA+E;AAC/E,oDAAoD;AACpD,OAAO,EACH,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,eAAe,GAClB,MAAM,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
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 type { FingerprintConfigJson } from './browser-process/anti-detect-config.js';
|
|
36
|
+
import type { BrowserProcess } from './browser-process/process.js';
|
|
37
|
+
export interface LaunchStealthBrowserOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Path to the browser binary. Defaults to the installed anti-detect build.
|
|
40
|
+
*
|
|
41
|
+
* Point this at stock Chrome only deliberately: the C++ overrides are what
|
|
42
|
+
* most of the stealth surface is, and a stock binary silently ignores the
|
|
43
|
+
* config file, leaving the host's own fingerprint on every surface the JS
|
|
44
|
+
* layer does not cover.
|
|
45
|
+
*/
|
|
46
|
+
executablePath?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Remote-debugging port. Omit for no CDP endpoint at all.
|
|
49
|
+
*
|
|
50
|
+
* A FIXED port is safe; `0` is not. Chromium sets `navigator.webdriver` when
|
|
51
|
+
* it is started with `--remote-debugging-port=0` (as it does for
|
|
52
|
+
* `--enable-automation`, `--headless` and `--remote-debugging-pipe`), so
|
|
53
|
+
* asking for an ephemeral port advertises automation on a surface every
|
|
54
|
+
* detector reads. Pass a real port number or nothing.
|
|
55
|
+
*/
|
|
56
|
+
debuggingPort?: number;
|
|
57
|
+
/** Upstream proxy URL. Prefer SOCKS5 - see the note on TLS below. */
|
|
58
|
+
proxyUrl?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Stable identity key. Two launches with the same value get the same
|
|
61
|
+
* fingerprint, because seeds are derived from it rather than from
|
|
62
|
+
* `Date.now()` / `Math.random()`.
|
|
63
|
+
*
|
|
64
|
+
* Omitting it falls back to seeding from the proxy URL, so distinct sessions
|
|
65
|
+
* sharing one proxy would claim the same machine. Pass it whenever you want
|
|
66
|
+
* one identity per session.
|
|
67
|
+
*/
|
|
68
|
+
sessionId?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Use real captured Chrome device profiles instead of generated ones.
|
|
71
|
+
* Defaults to `true`.
|
|
72
|
+
*/
|
|
73
|
+
useNonApifyFingerprints?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Which OS the session should CLAIM, e.g. `{ operatingSystems: ['macos'] }`.
|
|
76
|
+
* This is the claimed identity, not the host's.
|
|
77
|
+
*/
|
|
78
|
+
fingerprintGeneratorOptions?: {
|
|
79
|
+
operatingSystems?: string[];
|
|
80
|
+
} & Record<string, unknown>;
|
|
81
|
+
/** BCP-47 locale driving navigator, Intl, Accept-Language and timezone together. */
|
|
82
|
+
locale?: string;
|
|
83
|
+
/** Window size. Defaults to a desktop-typical 1920x1080. */
|
|
84
|
+
windowWidth?: number;
|
|
85
|
+
windowHeight?: number;
|
|
86
|
+
/** Reuse an existing profile directory instead of a fresh temp one. */
|
|
87
|
+
userDataDir?: string;
|
|
88
|
+
/** Keep the profile directory on exit. Defaults to true only when you supplied one. */
|
|
89
|
+
keepUserDataDir?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* A captured `FingerprintConfigJson` to use verbatim, skipping generation.
|
|
92
|
+
* This is how session continuity works: feed back the config a previous
|
|
93
|
+
* launch used and the second browser is byte-for-byte the first one.
|
|
94
|
+
*/
|
|
95
|
+
fingerprintConfig?: FingerprintConfigJson;
|
|
96
|
+
/** Extra command-line switches, appended last. */
|
|
97
|
+
extraArgs?: string[];
|
|
98
|
+
}
|
|
99
|
+
export interface StealthBrowserLaunch {
|
|
100
|
+
/** The live process. `await wsEndpoint()` for the CDP URL, `kill()` to stop it. */
|
|
101
|
+
browserProcess: BrowserProcess;
|
|
102
|
+
/**
|
|
103
|
+
* The config this launch actually used - after profile selection, binary
|
|
104
|
+
* alignment and integrity-version alignment.
|
|
105
|
+
*
|
|
106
|
+
* Keep it to reproduce the session later via `fingerprintConfig`, and read it
|
|
107
|
+
* to know what the session is claiming rather than inferring it.
|
|
108
|
+
*/
|
|
109
|
+
fingerprintConfig?: FingerprintConfigJson;
|
|
110
|
+
/** Whether the resolved binary is the anti-detect build (native C++ stealth). */
|
|
111
|
+
usingNativeStealth: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Launch a fully-spoofed browser and return the process plus the config it used.
|
|
115
|
+
*
|
|
116
|
+
* ```ts
|
|
117
|
+
* import { launchStealthBrowser } from 'jumpy-lion';
|
|
118
|
+
*
|
|
119
|
+
* const { browserProcess, fingerprintConfig } = await launchStealthBrowser({
|
|
120
|
+
* debuggingPort: 9222,
|
|
121
|
+
* sessionId: 'session-1',
|
|
122
|
+
* fingerprintGeneratorOptions: { operatingSystems: ['macos'] },
|
|
123
|
+
* });
|
|
124
|
+
*
|
|
125
|
+
* const wsUrl = await browserProcess.wsEndpoint();
|
|
126
|
+
* // … drive it over CDP …
|
|
127
|
+
* await browserProcess.kill();
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* On proxies: `proxyUrl` is passed to Chromium directly. Prefer SOCKS5 over an
|
|
131
|
+
* HTTP proxy that terminates TLS - a MITM proxy replaces Chromium's own TLS
|
|
132
|
+
* ClientHello with its runtime's, which changes the JA4 fingerprint and undoes
|
|
133
|
+
* work no JS or C++ override can reach.
|
|
134
|
+
*/
|
|
135
|
+
export declare function launchStealthBrowser(options?: LaunchStealthBrowserOptions): Promise<StealthBrowserLaunch>;
|
|
136
|
+
/**
|
|
137
|
+
* Where the anti-detect binary was found, or `null` if it is not installed.
|
|
138
|
+
*
|
|
139
|
+
* Exported so a consumer can check for the native build before launching rather
|
|
140
|
+
* than discovering from a warning that it ran unspoofed.
|
|
141
|
+
*/
|
|
142
|
+
export declare function getStealthBrowserPath(): string | null;
|
|
143
|
+
//# sourceMappingURL=launch-stealth-browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch-stealth-browser.d.ts","sourceRoot":"","sources":["../src/launch-stealth-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAIrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,WAAW,2BAA2B;IACxC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,2BAA2B,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExF,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uFAAuF;IACvF,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IAE1C,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACjC,mFAAmF;IACnF,cAAc,EAAE,cAAc,CAAC;IAC/B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IAC1C,iFAAiF;IACjF,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,oBAAoB,CACtC,OAAO,GAAE,2BAAgC,GAC1C,OAAO,CAAC,oBAAoB,CAAC,CAuE/B;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAErD"}
|
|
@@ -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,kBAA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