jumpy-lion 0.0.40 → 0.0.42
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-controller.d.ts.map +1 -1
- package/dist/browser-controller.js +102 -16
- package/dist/browser-controller.js.map +1 -1
- package/dist/browser-plugin.d.ts +26 -1
- package/dist/browser-plugin.d.ts.map +1 -1
- package/dist/browser-plugin.js +25 -2
- package/dist/browser-plugin.js.map +1 -1
- package/dist/browser-process/browser.d.ts +24 -1
- package/dist/browser-process/browser.d.ts.map +1 -1
- package/dist/browser-process/browser.js +79 -6
- package/dist/browser-process/browser.js.map +1 -1
- package/dist/browser-profiles/chrome/default.d.ts +116 -0
- package/dist/browser-profiles/chrome/default.d.ts.map +1 -1
- package/dist/browser-profiles/chrome/default.js +118 -1
- package/dist/browser-profiles/chrome/default.js.map +1 -1
- package/dist/browser-profiles/chrome/populate-profile.d.ts +76 -0
- package/dist/browser-profiles/chrome/populate-profile.d.ts.map +1 -0
- package/dist/browser-profiles/chrome/populate-profile.js +300 -0
- package/dist/browser-profiles/chrome/populate-profile.js.map +1 -0
- package/dist/browser-profiles/index.d.ts +1 -0
- package/dist/browser-profiles/index.d.ts.map +1 -1
- package/dist/browser-profiles/index.js +2 -0
- package/dist/browser-profiles/index.js.map +1 -1
- package/dist/crawler.d.ts +34 -1
- package/dist/crawler.d.ts.map +1 -1
- package/dist/crawler.js +7 -0
- package/dist/crawler.js.map +1 -1
- package/dist/fingerprinting/custom-fingerprint-injector.d.ts +87 -0
- package/dist/fingerprinting/custom-fingerprint-injector.d.ts.map +1 -0
- package/dist/fingerprinting/custom-fingerprint-injector.js +342 -0
- package/dist/fingerprinting/custom-fingerprint-injector.js.map +1 -0
- package/dist/fingerprinting/fingerprint-injector.d.ts +40 -2
- package/dist/fingerprinting/fingerprint-injector.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-injector.js +449 -44
- 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 +11 -1
- package/dist/fingerprinting/fingerprint-overrides/audio-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/canvas-protection.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/canvas-protection.js +11 -1
- package/dist/fingerprinting/fingerprint-overrides/canvas-protection.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/cdp-detection-bypass.d.ts +14 -0
- package/dist/fingerprinting/fingerprint-overrides/cdp-detection-bypass.d.ts.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/cdp-detection-bypass.js +497 -0
- package/dist/fingerprinting/fingerprint-overrides/cdp-detection-bypass.js.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/client-rect-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/client-rect-spoofing.js +11 -1
- package/dist/fingerprinting/fingerprint-overrides/client-rect-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/datadome-bypass.d.ts +14 -0
- package/dist/fingerprinting/fingerprint-overrides/datadome-bypass.d.ts.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/datadome-bypass.js +536 -0
- package/dist/fingerprinting/fingerprint-overrides/datadome-bypass.js.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/font-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/font-spoofing.js +11 -1
- package/dist/fingerprinting/fingerprint-overrides/font-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/index.d.ts +16 -1
- package/dist/fingerprinting/fingerprint-overrides/index.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/index.js +19 -1
- package/dist/fingerprinting/fingerprint-overrides/index.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/keyboard-humanization.d.ts +45 -0
- package/dist/fingerprinting/fingerprint-overrides/keyboard-humanization.d.ts.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/keyboard-humanization.js +291 -0
- package/dist/fingerprinting/fingerprint-overrides/keyboard-humanization.js.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/locale-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/locale-spoofing.js +54 -22
- package/dist/fingerprinting/fingerprint-overrides/locale-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/mouse-humanization.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/mouse-humanization.js +4 -5
- package/dist/fingerprinting/fingerprint-overrides/mouse-humanization.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/performance-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/performance-spoofing.js +11 -1
- package/dist/fingerprinting/fingerprint-overrides/performance-spoofing.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/platform-consistency.d.ts +13 -0
- package/dist/fingerprinting/fingerprint-overrides/platform-consistency.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/platform-consistency.js +413 -70
- package/dist/fingerprinting/fingerprint-overrides/platform-consistency.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/runtime-enable-bypass.d.ts +10 -3
- package/dist/fingerprinting/fingerprint-overrides/runtime-enable-bypass.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/runtime-enable-bypass.js +132 -73
- package/dist/fingerprinting/fingerprint-overrides/runtime-enable-bypass.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/scroll-humanization.d.ts +55 -0
- package/dist/fingerprinting/fingerprint-overrides/scroll-humanization.d.ts.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/scroll-humanization.js +380 -0
- package/dist/fingerprinting/fingerprint-overrides/scroll-humanization.js.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/stealth-script.d.ts +8 -0
- package/dist/fingerprinting/fingerprint-overrides/stealth-script.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/stealth-script.js +417 -71
- package/dist/fingerprinting/fingerprint-overrides/stealth-script.js.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/storage-consistency.d.ts +13 -0
- package/dist/fingerprinting/fingerprint-overrides/storage-consistency.d.ts.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/storage-consistency.js +368 -0
- package/dist/fingerprinting/fingerprint-overrides/storage-consistency.js.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/timing-consistency.d.ts +13 -0
- package/dist/fingerprinting/fingerprint-overrides/timing-consistency.d.ts.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/timing-consistency.js +438 -0
- package/dist/fingerprinting/fingerprint-overrides/timing-consistency.js.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/utils.d.ts +12 -0
- package/dist/fingerprinting/fingerprint-overrides/utils.d.ts.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/utils.js +315 -0
- package/dist/fingerprinting/fingerprint-overrides/utils.js.map +1 -0
- package/dist/fingerprinting/fingerprint-overrides/webgl-spoofing.d.ts.map +1 -1
- package/dist/fingerprinting/fingerprint-overrides/webgl-spoofing.js +13 -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 +11 -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 +11 -1
- package/dist/fingerprinting/fingerprint-overrides/webrtc-spoofing.js.map +1 -1
- package/dist/page.d.ts +12 -0
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +35 -3
- package/dist/page.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/fingerprinting/canvas-fingerprint.d.ts +0 -4
- package/dist/fingerprinting/canvas-fingerprint.d.ts.map +0 -1
- package/dist/fingerprinting/canvas-fingerprint.js +0 -60
- package/dist/fingerprinting/canvas-fingerprint.js.map +0 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stealth Utility Functions
|
|
3
|
+
*
|
|
4
|
+
* Similar to puppeteer-extra-plugin-stealth's utils.js
|
|
5
|
+
* Provides helper functions for overriding browser properties without detection.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Creates a stealth utilities script that can be injected into the browser.
|
|
9
|
+
* This script provides helper functions for property overrides that hide their tracks.
|
|
10
|
+
*/
|
|
11
|
+
export const createStealthUtilsScript = () => {
|
|
12
|
+
return `
|
|
13
|
+
(() => {
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
// Skip if already initialized
|
|
17
|
+
if (window.__STEALTH_UTILS_INITIALIZED__) return;
|
|
18
|
+
window.__STEALTH_UTILS_INITIALIZED__ = true;
|
|
19
|
+
|
|
20
|
+
// ============================================
|
|
21
|
+
// STEALTH UTILITIES - Hide Property Overrides
|
|
22
|
+
// ============================================
|
|
23
|
+
|
|
24
|
+
// Cache original toString BEFORE any modifications
|
|
25
|
+
const nativeToStringFunctionString = Function.prototype.toString.call(Function.prototype.toString);
|
|
26
|
+
const nativeToStringFunc = Function.prototype.toString;
|
|
27
|
+
|
|
28
|
+
// WeakMap to track which functions should appear native
|
|
29
|
+
const nativeFunctionOverrides = new WeakMap();
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Generate a native-looking function string
|
|
33
|
+
*/
|
|
34
|
+
const makeNativeString = (name = '') => {
|
|
35
|
+
return \`function \${name}() { [native code] }\`;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Register a function to appear native when toString is called
|
|
40
|
+
*/
|
|
41
|
+
const registerNativeFunction = (fn, name = '') => {
|
|
42
|
+
nativeFunctionOverrides.set(fn, name);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Patch Function.prototype.toString to hide overridden functions
|
|
47
|
+
*/
|
|
48
|
+
const patchToString = () => {
|
|
49
|
+
const patchedToString = function() {
|
|
50
|
+
// Check if this function should appear native
|
|
51
|
+
if (nativeFunctionOverrides.has(this)) {
|
|
52
|
+
const name = nativeFunctionOverrides.get(this);
|
|
53
|
+
return makeNativeString(name);
|
|
54
|
+
}
|
|
55
|
+
// Otherwise return original toString
|
|
56
|
+
return nativeToStringFunc.call(this);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Make patchedToString itself appear native
|
|
60
|
+
nativeFunctionOverrides.set(patchedToString, 'toString');
|
|
61
|
+
|
|
62
|
+
// Replace Function.prototype.toString
|
|
63
|
+
Function.prototype.toString = patchedToString;
|
|
64
|
+
|
|
65
|
+
// Also patch Function.prototype.toString.toString to look native
|
|
66
|
+
Object.defineProperty(Function.prototype.toString, 'toString', {
|
|
67
|
+
value: patchedToString,
|
|
68
|
+
writable: false,
|
|
69
|
+
configurable: false
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Check if a property can be redefined on an object
|
|
75
|
+
*/
|
|
76
|
+
const canRedefineProperty = (obj, prop) => {
|
|
77
|
+
try {
|
|
78
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
79
|
+
// Property doesn't exist or is configurable
|
|
80
|
+
return !descriptor || descriptor.configurable !== false;
|
|
81
|
+
} catch (e) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Safely override a property with guards
|
|
88
|
+
* Returns true if successful, false otherwise
|
|
89
|
+
*/
|
|
90
|
+
const overridePropertyWithGuard = (obj, prop, descriptor) => {
|
|
91
|
+
if (!canRedefineProperty(obj, prop)) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
Object.defineProperty(obj, prop, descriptor);
|
|
96
|
+
return true;
|
|
97
|
+
} catch (e) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Override a getter property and make the getter appear native
|
|
104
|
+
*/
|
|
105
|
+
const overrideGetterWithNative = (obj, prop, getter, name = '') => {
|
|
106
|
+
// Register the getter to appear native
|
|
107
|
+
registerNativeFunction(getter, name || \`get \${prop}\`);
|
|
108
|
+
|
|
109
|
+
return overridePropertyWithGuard(obj, prop, {
|
|
110
|
+
get: getter,
|
|
111
|
+
configurable: true,
|
|
112
|
+
enumerable: true
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Create a proxy handler that makes all accessed functions appear native
|
|
118
|
+
*/
|
|
119
|
+
const createNativeProxyHandler = (targetName = '') => {
|
|
120
|
+
return {
|
|
121
|
+
get(target, property, receiver) {
|
|
122
|
+
const value = Reflect.get(target, property, receiver);
|
|
123
|
+
|
|
124
|
+
// Bind functions to target and register as native
|
|
125
|
+
if (typeof value === 'function') {
|
|
126
|
+
const bound = value.bind(target);
|
|
127
|
+
registerNativeFunction(bound, value.name || property);
|
|
128
|
+
return bound;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return value;
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// Make the proxy's toString appear native
|
|
135
|
+
apply(target, thisArg, args) {
|
|
136
|
+
return Reflect.apply(target, thisArg, args);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Cache original property value before overriding
|
|
143
|
+
* This prevents infinite recursion when getter calls itself
|
|
144
|
+
*/
|
|
145
|
+
const cacheAndOverride = (obj, prop, transformFn) => {
|
|
146
|
+
// Cache the original value BEFORE any override
|
|
147
|
+
let originalValue;
|
|
148
|
+
try {
|
|
149
|
+
originalValue = obj[prop];
|
|
150
|
+
} catch (e) {
|
|
151
|
+
originalValue = undefined;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Create getter that uses cached value
|
|
155
|
+
const getter = function() {
|
|
156
|
+
return transformFn(originalValue);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
return overrideGetterWithNative(obj, prop, getter, \`get \${prop}\`);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Log property override success
|
|
164
|
+
*/
|
|
165
|
+
const logPropertyOverride = (objName, propName, value, success = true) => {
|
|
166
|
+
const DEBUG_PREFIX = '[CDP-FP-DEBUG]';
|
|
167
|
+
const ERROR_PREFIX = '[CDP-FP-ERROR]';
|
|
168
|
+
|
|
169
|
+
if (success) {
|
|
170
|
+
console.log(DEBUG_PREFIX, \`✓ Overridden \${objName}.\${propName} to:\`, value);
|
|
171
|
+
} else {
|
|
172
|
+
console.warn(ERROR_PREFIX, \`⚠ Failed to override \${objName}.\${propName}\`);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Verify that a property override was successful
|
|
178
|
+
*/
|
|
179
|
+
const verifyOverride = (obj, objName, propName, expectedValue) => {
|
|
180
|
+
const DEBUG_PREFIX = '[CDP-FP-DEBUG]';
|
|
181
|
+
try {
|
|
182
|
+
const actualValue = obj[propName];
|
|
183
|
+
const matches = JSON.stringify(actualValue) === JSON.stringify(expectedValue);
|
|
184
|
+
|
|
185
|
+
if (matches) {
|
|
186
|
+
console.log(DEBUG_PREFIX, \`✓ Verified \${objName}.\${propName}\`);
|
|
187
|
+
} else {
|
|
188
|
+
console.warn(DEBUG_PREFIX, \`⚠ Mismatch for \${objName}.\${propName}: expected\`, expectedValue, 'got', actualValue);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return matches;
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.error(DEBUG_PREFIX, \`Error verifying \${objName}.\${propName}:\`, error);
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Handle frozen properties using Proxy fallback (puppeteer-stealth style)
|
|
200
|
+
*/
|
|
201
|
+
const handleFrozenProperty = (obj, prop, value) => {
|
|
202
|
+
const DEBUG_PREFIX = '[CDP-FP-DEBUG]';
|
|
203
|
+
const ERROR_PREFIX = '[CDP-FP-ERROR]';
|
|
204
|
+
|
|
205
|
+
try {
|
|
206
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
207
|
+
|
|
208
|
+
// If property is frozen (configurable: false), use Proxy approach
|
|
209
|
+
if (descriptor && descriptor.configurable === false) {
|
|
210
|
+
console.warn(DEBUG_PREFIX, \`Property is frozen: \${prop}, attempting Proxy fallback\`);
|
|
211
|
+
|
|
212
|
+
// Strategy 1: Try to redefine on the prototype
|
|
213
|
+
const proto = Object.getPrototypeOf(obj);
|
|
214
|
+
if (proto && canRedefineProperty(proto, prop)) {
|
|
215
|
+
const getter = () => value;
|
|
216
|
+
registerNativeFunction(getter, \`get \${prop}\`);
|
|
217
|
+
|
|
218
|
+
Object.defineProperty(proto, prop, {
|
|
219
|
+
get: getter,
|
|
220
|
+
configurable: true,
|
|
221
|
+
enumerable: true
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
console.log(DEBUG_PREFIX, \`✓ Overridden \${prop} via prototype\`);
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Strategy 2: Log that we cannot override
|
|
229
|
+
console.warn(ERROR_PREFIX, \`Cannot override frozen property: \${prop}\`);
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Property is configurable, use normal override
|
|
234
|
+
return false; // Let caller handle normal override
|
|
235
|
+
} catch (error) {
|
|
236
|
+
console.error(ERROR_PREFIX, \`Error handling frozen property \${prop}:\`, error);
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Wrap a function with error boundary that logs errors
|
|
243
|
+
*/
|
|
244
|
+
const withErrorBoundary = (fn, fnName = 'anonymous') => {
|
|
245
|
+
return function(...args) {
|
|
246
|
+
const ERROR_PREFIX = '[CDP-FP-ERROR]';
|
|
247
|
+
try {
|
|
248
|
+
return fn.apply(this, args);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
console.error(ERROR_PREFIX, \`Error in \${fnName}:\`, error);
|
|
251
|
+
throw error; // Re-throw to make errors visible
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Enhanced override with frozen property handling and logging
|
|
258
|
+
*/
|
|
259
|
+
const overridePropertySafe = (obj, objName, prop, value) => {
|
|
260
|
+
const DEBUG_PREFIX = '[CDP-FP-DEBUG]';
|
|
261
|
+
|
|
262
|
+
// First, check if property is frozen
|
|
263
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
264
|
+
if (descriptor && descriptor.configurable === false) {
|
|
265
|
+
console.warn(DEBUG_PREFIX, \`⚠ Property \${objName}.\${prop} is frozen\`);
|
|
266
|
+
|
|
267
|
+
// Attempt frozen property handling
|
|
268
|
+
const handled = handleFrozenProperty(obj, prop, value);
|
|
269
|
+
if (handled) {
|
|
270
|
+
logPropertyOverride(objName, prop, value, true);
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
logPropertyOverride(objName, prop, value, false);
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Property is configurable, override normally
|
|
279
|
+
const getter = () => value;
|
|
280
|
+
registerNativeFunction(getter, \`get \${prop}\`);
|
|
281
|
+
|
|
282
|
+
const success = overridePropertyWithGuard(obj, prop, {
|
|
283
|
+
get: getter,
|
|
284
|
+
configurable: true,
|
|
285
|
+
enumerable: true
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
logPropertyOverride(objName, prop, value, success);
|
|
289
|
+
return success;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// Initialize toString patch immediately
|
|
293
|
+
patchToString();
|
|
294
|
+
|
|
295
|
+
// Export utilities to global scope for use by other scripts
|
|
296
|
+
window.__stealthUtils__ = {
|
|
297
|
+
makeNativeString,
|
|
298
|
+
registerNativeFunction,
|
|
299
|
+
canRedefineProperty,
|
|
300
|
+
overridePropertyWithGuard,
|
|
301
|
+
overrideGetterWithNative,
|
|
302
|
+
createNativeProxyHandler,
|
|
303
|
+
cacheAndOverride,
|
|
304
|
+
nativeFunctionOverrides,
|
|
305
|
+
// New logging and safety utilities
|
|
306
|
+
logPropertyOverride,
|
|
307
|
+
verifyOverride,
|
|
308
|
+
handleFrozenProperty,
|
|
309
|
+
withErrorBoundary,
|
|
310
|
+
overridePropertySafe
|
|
311
|
+
};
|
|
312
|
+
})();
|
|
313
|
+
`;
|
|
314
|
+
};
|
|
315
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAW,EAAE;IACjD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6SV,CAAC;AACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-spoofing.d.ts","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webgl-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,yBAAyB,sBAAuB,WAAW,KAAG,
|
|
1
|
+
{"version":3,"file":"webgl-spoofing.d.ts","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webgl-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,yBAAyB,sBAAuB,WAAW,KAAG,MA8K1E,CAAC"}
|
|
@@ -20,6 +20,7 @@ export const createWebGLSpoofingScript = (fingerprintWebGL) => {
|
|
|
20
20
|
const fingerprintConfig = ${JSON.stringify(fingerprintWebGL)};
|
|
21
21
|
const selectedVendor = fingerprintConfig.vendorUnmasked || fingerprintConfig.vendor || 'Intel Inc.';
|
|
22
22
|
const selectedRenderer = fingerprintConfig.rendererUnmasked || fingerprintConfig.renderer || 'Intel Iris OpenGL Engine';
|
|
23
|
+
console.log('[CDP-FP-DEBUG] WebGL using fingerprint data - Vendor:', selectedVendor, 'Renderer:', selectedRenderer.substring(0, 50));
|
|
23
24
|
` : `
|
|
24
25
|
// Detect platform from navigator
|
|
25
26
|
const platform = navigator.platform || 'Linux x86_64';
|
|
@@ -58,6 +59,7 @@ export const createWebGLSpoofingScript = (fingerprintWebGL) => {
|
|
|
58
59
|
const config = gpuConfigs[platform] || gpuConfigs['Linux x86_64'];
|
|
59
60
|
const selectedVendor = config.vendors[Math.floor(Math.random() * config.vendors.length)];
|
|
60
61
|
const selectedRenderer = config.renderers.find(r => r.includes(selectedVendor.split(' ')[0])) || config.renderers[0];
|
|
62
|
+
console.log('[CDP-FP-DEBUG] WebGL using platform:', platform, '- Vendor:', selectedVendor, 'Renderer:', selectedRenderer.substring(0, 50));
|
|
61
63
|
`}
|
|
62
64
|
|
|
63
65
|
// Override getParameter
|
|
@@ -161,7 +163,17 @@ export const createWebGLSpoofingScript = (fingerprintWebGL) => {
|
|
|
161
163
|
}
|
|
162
164
|
};
|
|
163
165
|
|
|
164
|
-
|
|
166
|
+
const DEBUG_PREFIX = '[CDP-FP-DEBUG]';
|
|
167
|
+
const ERROR_PREFIX = '[CDP-FP-ERROR]';
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
console.log(DEBUG_PREFIX, 'Starting WebGL spoofing...');
|
|
171
|
+
spoofWebGL();
|
|
172
|
+
console.log(DEBUG_PREFIX, '✓ WebGL spoofing applied');
|
|
173
|
+
} catch (e) {
|
|
174
|
+
console.error(ERROR_PREFIX, '✗ Failed to apply WebGL spoofing:', e);
|
|
175
|
+
throw e; // Rethrow to make errors visible
|
|
176
|
+
}
|
|
165
177
|
})();`;
|
|
166
178
|
};
|
|
167
179
|
//# sourceMappingURL=webgl-spoofing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-spoofing.js","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webgl-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,gBAA8B,EAAU,EAAE;IAChF,iFAAiF;IACjF,MAAM,cAAc,GAAG,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,cAAc,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAElH,OAAO;;;;;;;;;;UAUD,cAAc,CAAC,CAAC,CAAC;;oCAES,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"webgl-spoofing.js","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webgl-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,gBAA8B,EAAU,EAAE;IAChF,iFAAiF;IACjF,MAAM,cAAc,GAAG,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,cAAc,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAElH,OAAO;;;;;;;;;;UAUD,cAAc,CAAC,CAAC,CAAC;;oCAES,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;;;;SAI3D,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAuCH;;;;;;;;;;;;;;yBAcgB,cAAc,IAAI,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,UAAU;;;yBAGxF,cAAc,IAAI,gBAAgB,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA2CjH,CAAC,cAAc,CAAC,CAAC,CAAC;;;;;;;;;SASnB,CAAC,CAAC,CAAC;;SAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2CH,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-spoofing.d.ts","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webgpu-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,0BAA0B,kCAA+B,
|
|
1
|
+
{"version":3,"file":"webgpu-spoofing.d.ts","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webgpu-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,0BAA0B,kCAA+B,MAiNrE,CAAC"}
|
|
@@ -199,7 +199,17 @@ export const createWebGPUSpoofingScript = (experimentalMode = false) => {
|
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
const DEBUG_PREFIX = '[CDP-FP-DEBUG]';
|
|
203
|
+
const ERROR_PREFIX = '[CDP-FP-ERROR]';
|
|
204
|
+
|
|
205
|
+
try {
|
|
206
|
+
console.log(DEBUG_PREFIX, 'Starting WebGPU spoofing...');
|
|
207
|
+
spoofWebGPU();
|
|
208
|
+
console.log(DEBUG_PREFIX, '✓ WebGPU spoofing applied');
|
|
209
|
+
} catch (e) {
|
|
210
|
+
console.error(ERROR_PREFIX, '✗ Failed to apply WebGPU spoofing:', e);
|
|
211
|
+
throw e;
|
|
212
|
+
}
|
|
203
213
|
})();`;
|
|
204
214
|
};
|
|
205
215
|
//# sourceMappingURL=webgpu-spoofing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-spoofing.js","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webgpu-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,gBAAgB,GAAG,KAAK,EAAU,EAAE;IAC3E,OAAO;;;;;;;UAOD,gBAAgB,CAAC,CAAC,CAAC;;;;;;;;;SASpB,CAAC,CAAC,CAAC,EAAE
|
|
1
|
+
{"version":3,"file":"webgpu-spoofing.js","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webgpu-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,gBAAgB,GAAG,KAAK,EAAU,EAAE;IAC3E,OAAO;;;;;;;UAOD,gBAAgB,CAAC,CAAC,CAAC;;;;;;;;;SASpB,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+LR,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webrtc-spoofing.d.ts","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webrtc-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,0BAA0B,QAAO,
|
|
1
|
+
{"version":3,"file":"webrtc-spoofing.d.ts","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webrtc-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,0BAA0B,QAAO,MAoG7C,CAAC"}
|
|
@@ -90,7 +90,17 @@ export const createWebRTCSpoofingScript = () => {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
const DEBUG_PREFIX = '[CDP-FP-DEBUG]';
|
|
94
|
+
const ERROR_PREFIX = '[CDP-FP-ERROR]';
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
console.log(DEBUG_PREFIX, 'Starting WebRTC spoofing...');
|
|
98
|
+
spoofWebRTC();
|
|
99
|
+
console.log(DEBUG_PREFIX, '✓ WebRTC spoofing applied');
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.error(ERROR_PREFIX, '✗ Failed to apply WebRTC spoofing:', e);
|
|
102
|
+
throw e;
|
|
103
|
+
}
|
|
94
104
|
})();`;
|
|
95
105
|
};
|
|
96
106
|
//# sourceMappingURL=webrtc-spoofing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webrtc-spoofing.js","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webrtc-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAW,EAAE;IACnD,OAAO
|
|
1
|
+
{"version":3,"file":"webrtc-spoofing.js","sourceRoot":"","sources":["../../../src/fingerprinting/fingerprint-overrides/webrtc-spoofing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAW,EAAE;IACnD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkGL,CAAC;AACP,CAAC,CAAC"}
|
package/dist/page.d.ts
CHANGED
|
@@ -67,6 +67,18 @@ export default class CdpPage extends EventEmitter {
|
|
|
67
67
|
private _attachConnectionMonitor;
|
|
68
68
|
static create(client: CDP.Client): Promise<CdpPage>;
|
|
69
69
|
private initialize;
|
|
70
|
+
/**
|
|
71
|
+
* Lazily enable Page domain only when needed for script injection.
|
|
72
|
+
* This avoids enabling Page upfront which is a CDP detection vector.
|
|
73
|
+
* Once enabled, subsequent calls are no-ops.
|
|
74
|
+
*/
|
|
75
|
+
ensurePageEnabled(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Lazily enable Network domain only when needed for request interception/monitoring.
|
|
78
|
+
* This avoids enabling Network upfront which is a CDP detection vector.
|
|
79
|
+
* Once enabled, subsequent calls are no-ops.
|
|
80
|
+
*/
|
|
81
|
+
ensureNetworkEnabled(): Promise<void>;
|
|
70
82
|
url(): Promise<string>;
|
|
71
83
|
goto(url: string, options?: GotoOptions): Promise<void>;
|
|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B,OAAO,CAAC,IAAI,CAAC;IAqEhB;;OAEG;YACW,oBAAoB;IAiElC;;;;;;OAMG;YACW,qBAAqB;IAiFnC;;;OAGG;YACW,yBAAyB;IAmFvC;;;;;OAKG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAWtD"}
|
package/dist/page.js
CHANGED
|
@@ -199,6 +199,38 @@ export default class CdpPage extends EventEmitter {
|
|
|
199
199
|
// Network.enable().catch(e => log.error('Failed to enable Network:', e)),
|
|
200
200
|
// ]);
|
|
201
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Lazily enable Page domain only when needed for script injection.
|
|
204
|
+
* This avoids enabling Page upfront which is a CDP detection vector.
|
|
205
|
+
* Once enabled, subsequent calls are no-ops.
|
|
206
|
+
*/
|
|
207
|
+
async ensurePageEnabled() {
|
|
208
|
+
if (this.enabledDomains.has('Page')) {
|
|
209
|
+
return; // Already enabled
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
await this.client.Page.enable();
|
|
213
|
+
this.enabledDomains.add('Page');
|
|
214
|
+
log.debug('Page domain enabled lazily for script injection');
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
log.error('Failed to enable Page domain:', { error });
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Lazily enable Network domain only when needed for request interception/monitoring.
|
|
223
|
+
* This avoids enabling Network upfront which is a CDP detection vector.
|
|
224
|
+
* Once enabled, subsequent calls are no-ops.
|
|
225
|
+
*/
|
|
226
|
+
async ensureNetworkEnabled() {
|
|
227
|
+
if (this.enabledDomains.has('Network')) {
|
|
228
|
+
return; // Already enabled
|
|
229
|
+
}
|
|
230
|
+
await this.client.Network.enable();
|
|
231
|
+
this.enabledDomains.add('Network');
|
|
232
|
+
log.debug('Network domain enabled (lazy)');
|
|
233
|
+
}
|
|
202
234
|
async url() {
|
|
203
235
|
if (!this.loadedUrl) {
|
|
204
236
|
return await this.evaluate("window.location.href");
|
|
@@ -688,7 +720,7 @@ export default class CdpPage extends EventEmitter {
|
|
|
688
720
|
}
|
|
689
721
|
// Wait for response
|
|
690
722
|
async waitForResponse(urlPart, statusCode = 200, timeout = 180000) {
|
|
691
|
-
await this.
|
|
723
|
+
await this.ensureNetworkEnabled(); // Lazy enable Network only when needed
|
|
692
724
|
return new Promise((resolve, reject) => {
|
|
693
725
|
let timer;
|
|
694
726
|
const onResponseReceived = async ({ requestId, response }) => {
|
|
@@ -705,7 +737,7 @@ export default class CdpPage extends EventEmitter {
|
|
|
705
737
|
// Retry logic with exponential backoff
|
|
706
738
|
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
707
739
|
try {
|
|
708
|
-
await this.
|
|
740
|
+
await this.ensureNetworkEnabled();
|
|
709
741
|
await new Promise((resolveTimeout) => setTimeout(resolveTimeout, 1000 * 2 ** attempt)); // Exponential backoff
|
|
710
742
|
const { body } = await this.client.Network.getResponseBody({ requestId });
|
|
711
743
|
resolve({
|
|
@@ -838,7 +870,7 @@ export default class CdpPage extends EventEmitter {
|
|
|
838
870
|
// Block requests matching URL patterns
|
|
839
871
|
async blockRequests(urlPatterns) {
|
|
840
872
|
const { Network } = this.client;
|
|
841
|
-
await
|
|
873
|
+
await this.ensureNetworkEnabled(); // Lazy enable Network only when needed
|
|
842
874
|
await Network.setRequestInterception({ patterns: [{ urlPattern: '*' }] });
|
|
843
875
|
Network.on('requestIntercepted', async (params) => {
|
|
844
876
|
const shouldBlock = urlPatterns.some((pattern) => {
|