/** * Enhanced CDP Fingerprint Injector for 2025 * * This module provides advanced fingerprint spoofing and anti-detection capabilities * specifically designed to bypass hardcore fingerprinting techniques used in 2025. * * Key Features: * * 1. **WebGPU Fingerprinting Protection**: * - Spoofs GPU adapter information and capabilities * - Fakes GPU uptime to appear as if the GPU has been running for 24-72 hours * - Intercepts timestamp queries to prevent timing-based detection * * 2. **Platform Consistency (1:1 Fingerprinting)**: * - Ensures all browser properties match the specified platform (Win32, MacIntel, Linux) * - Synchronizes navigator properties, screen metrics, and WebGL/WebGPU values * - Platform-specific GPU configurations for realistic fingerprints * * 3. **Runtime.enable Bypass**: * - Prevents CDP detection through console.log(Error) technique * - Intercepts and blocks Runtime.enable calls * - Modifies Error stack traces to hide automation * * 4. **Advanced Canvas Protection**: * - Adds controlled noise to canvas operations * - Protects against both 2D and WebGL canvas fingerprinting * - Includes font measurement variations * * 5. **WebRTC IP Leak Prevention**: * - Filters STUN servers to prevent IP leaks * - Provides fake but consistent device IDs * - Modifies ICE candidates and statistics * * 6. **Audio Context Spoofing**: * - Adds noise to audio processing to prevent fingerprinting * - Works with both AudioContext and OfflineAudioContext * * 7. **Client Rect Variations**: * - Adds small variations to getBoundingClientRect results * - Makes automation harder to detect through DOM measurements * * 8. **Mouse Movement Humanization**: * - Generates bezier curve movements instead of straight lines * - Adds random variations to mouse paths * * Usage: * ```typescript * await CdpFingerprintInjector.injectFingerprint(page, fingerprint, { * enableAdvancedStealth: true, * bypassRuntimeEnable: true, * platform: 'Win32', // Spoof as Windows for better evasion on Apify Linux * spoofWebGL: true, * spoofAudioContext: true, * spoofClientRects: true, * humanizeInteractions: true, * spoofFonts: true, // New: Hide Linux-specific fonts * spoofPerformance: true, // New: Windows-like timing characteristics * spoofLocale: true, // New: Consistent Windows locale formatting * useFingerprintDefaults: true // Use fingerprint-generator Windows values * }); * ``` */ import type { BrowserFingerprintWithHeaders } from 'fingerprint-generator'; import type CdpPage from "../page.js"; interface Viewport { width: number; height: number; deviceScaleFactor: number; mobile: boolean; } /** * Humanization options for simulating realistic user behavior * All options are disabled by default for performance */ interface HumanizationOptions { /** Enable mouse movement humanization (Bezier curves, natural movement). Default: false */ mouse?: boolean; /** Enable keyboard humanization (realistic typing delays). Default: false */ keyboard?: boolean; /** Enable scroll humanization (natural physics, momentum). Default: false */ scroll?: boolean; } interface AttachOptions { debug?: boolean; timezone?: string; proxyUrl?: string; detectTimezone?: boolean; viewport?: Viewport; enableAdvancedStealth?: boolean; bypassRuntimeEnable?: boolean; /** @deprecated Use humanization.mouse instead */ humanizeInteractions?: boolean; spoofWebGL?: boolean; spoofAudioContext?: boolean; spoofClientRects?: boolean; maskAutomationFlags?: boolean; platform?: 'Win32' | 'MacIntel' | 'Linux x86_64'; spoofFonts?: boolean; spoofPerformance?: boolean; spoofLocale?: boolean; useExperimentalFingerprints?: boolean; useFingerprintDefaults?: boolean; /** Enable CDP detection bypass (iframe, eval, sourceURL hiding) */ bypassCDPDetection?: boolean; /** Enable storage API consistency (quota, IndexedDB, CacheStorage) */ spoofStorage?: boolean; /** Enable timing consistency (Date.now, performance.now alignment) */ spoofTiming?: boolean; /** Enable DataDome-specific bypass (JS challenges, proof-of-work) */ enableDataDomeBypass?: boolean; /** WebRTC handling strategy. Default: 'spoof'. */ webRtcPolicy?: 'spoof' | 'disable'; /** * Alias for enableDataDomeBypass - enables all DataDome-specific protections * When true, injects enhanced bypass early in the script chain */ bypassDatadome?: boolean; /** * Humanization options for simulating realistic user behavior. * All options are disabled by default for performance. * Enable specific options to simulate human-like interactions. */ humanization?: HumanizationOptions; } export declare class CdpFingerprintInjector { private page; constructor(page: CdpPage); /** * Get recommended settings for Apify platform * These settings are optimized for running headful Chrome on Apify (Linux) * but spoofed to appear as Windows for better anti-bot evasion. * * Note: Humanization is disabled by default for performance. * Use getDataDomeSettings() or enable humanization manually for anti-bot sites. */ static getApifyRecommendedSettings(): AttachOptions; /** * Get settings specifically optimized for DataDome-protected sites. * Enables all humanization features for maximum anti-bot evasion. */ static getDataDomeSettings(): AttachOptions; static injectFingerprint(page: CdpPage, fingerprint: BrowserFingerprintWithHeaders, options?: AttachOptions): Promise; private setViewport; private setExtraHTTPHeaders; /** * Set User-Agent with full client hints metadata via CDP. * This ensures HTTP-level Sec-CH-UA-* headers match the JS-side spoofing. * Without this, the browser sends its real client hints headers which * don't match the spoofed navigator.userAgentData values. */ private setUserAgentWithMetadata; private getTimezoneFromIp; private setTimezoneOverride; /** * Create a debug script that logs fingerprint override status to the console */ private createDebugScript; /** * Extract relevant data from fingerprint for overrides */ private extractFingerprintData; private getActualChromeVersion; private alignUserAgentWithBrowserVersion; attachToPage(browserFingerprintWithHeaders: BrowserFingerprintWithHeaders, options?: AttachOptions): Promise; } export {}; //# sourceMappingURL=fingerprint-injector.d.ts.map