From a34e3c72f0b35c29483d70b107bac7a1507ec47c Mon Sep 17 00:00:00 2001 From: AskaEth Date: Wed, 12 Aug 2026 21:18:19 +0800 Subject: [PATCH] feat(daemon): add built-in fingerprint profiles for desktop Chrome (Task 16) --- .../src/stealth/profiles/desktop-chrome.ts | 32 +++++++++++++++++++ .../src/stealth/profiles/desktop-mac.ts | 31 ++++++++++++++++++ .../src/stealth/profiles/desktop-windows.ts | 32 +++++++++++++++++++ packages/daemon/src/stealth/profiles/index.ts | 21 ++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 packages/daemon/src/stealth/profiles/desktop-chrome.ts create mode 100644 packages/daemon/src/stealth/profiles/desktop-mac.ts create mode 100644 packages/daemon/src/stealth/profiles/desktop-windows.ts create mode 100644 packages/daemon/src/stealth/profiles/index.ts diff --git a/packages/daemon/src/stealth/profiles/desktop-chrome.ts b/packages/daemon/src/stealth/profiles/desktop-chrome.ts new file mode 100644 index 0000000..4709b75 --- /dev/null +++ b/packages/daemon/src/stealth/profiles/desktop-chrome.ts @@ -0,0 +1,32 @@ +// Default desktop Chrome fingerprint (Linux) / 默认桌面 Chrome 指纹 (Linux) +import type { FingerprintProfile } from '@visionl/core'; + +export const desktopChrome: FingerprintProfile = { + id: 'desktop-chrome', + name: '桌面 Chrome (通用)', + userAgent: + 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36', + platform: 'Linux x86_64', + languages: ['zh-CN', 'en-US'], + acceptLanguage: 'zh-CN,zh;q=0.9,en;q=0.8', + screen: { width: 1920, height: 1080, colorDepth: 24, pixelRatio: 1 }, + viewport: { width: 1920, height: 937 }, + webgl: { + vendor: 'Google Inc. (Intel)', + renderer: + 'ANGLE (Intel, Mesa Intel(R) UHD Graphics (CML GT2), OpenGL 4.6)', + }, + timezone: 'Asia/Shanghai', + permissions: { + notifications: 'prompt', + geolocation: 'prompt', + camera: 'prompt', + microphone: 'prompt', + }, + behavior: { + mouseMoveDelay: { min: 5, max: 15 }, + keyPressDelay: { min: 50, max: 150 }, + scrollStepDelay: { min: 20, max: 40 }, + }, + canvasNoise: { enabled: true, strength: 0.3 }, +}; diff --git a/packages/daemon/src/stealth/profiles/desktop-mac.ts b/packages/daemon/src/stealth/profiles/desktop-mac.ts new file mode 100644 index 0000000..b83edd1 --- /dev/null +++ b/packages/daemon/src/stealth/profiles/desktop-mac.ts @@ -0,0 +1,31 @@ +// macOS Chrome fingerprint / macOS Chrome 指纹 +import type { FingerprintProfile } from '@visionl/core'; + +export const desktopMac: FingerprintProfile = { + id: 'desktop-mac', + name: '桌面 Chrome (macOS)', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36', + platform: 'MacIntel', + languages: ['zh-CN', 'en-US'], + acceptLanguage: 'zh-CN,zh;q=0.9,en;q=0.8', + screen: { width: 1920, height: 1080, colorDepth: 24, pixelRatio: 2 }, + viewport: { width: 1920, height: 937 }, + webgl: { + vendor: 'Apple Inc.', + renderer: 'Apple M1', + }, + timezone: 'Asia/Shanghai', + permissions: { + notifications: 'prompt', + geolocation: 'prompt', + camera: 'prompt', + microphone: 'prompt', + }, + behavior: { + mouseMoveDelay: { min: 5, max: 15 }, + keyPressDelay: { min: 50, max: 150 }, + scrollStepDelay: { min: 20, max: 40 }, + }, + canvasNoise: { enabled: true, strength: 0.3 }, +}; diff --git a/packages/daemon/src/stealth/profiles/desktop-windows.ts b/packages/daemon/src/stealth/profiles/desktop-windows.ts new file mode 100644 index 0000000..6ea30a2 --- /dev/null +++ b/packages/daemon/src/stealth/profiles/desktop-windows.ts @@ -0,0 +1,32 @@ +// Windows 10 Chrome fingerprint / Windows 10 Chrome 指纹 +import type { FingerprintProfile } from '@visionl/core'; + +export const desktopWindows: FingerprintProfile = { + id: 'desktop-windows', + name: '桌面 Chrome (Windows)', + userAgent: + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36', + platform: 'Win32', + languages: ['zh-CN', 'en-US'], + acceptLanguage: 'zh-CN,zh;q=0.9,en;q=0.8', + screen: { width: 1920, height: 1080, colorDepth: 24, pixelRatio: 1 }, + viewport: { width: 1920, height: 937 }, + webgl: { + vendor: 'Google Inc. (NVIDIA)', + renderer: + 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1660 Ti Direct3D11 vs_5_0 ps_5_0)', + }, + timezone: 'Asia/Shanghai', + permissions: { + notifications: 'prompt', + geolocation: 'prompt', + camera: 'prompt', + microphone: 'prompt', + }, + behavior: { + mouseMoveDelay: { min: 5, max: 15 }, + keyPressDelay: { min: 50, max: 150 }, + scrollStepDelay: { min: 20, max: 40 }, + }, + canvasNoise: { enabled: true, strength: 0.3 }, +}; diff --git a/packages/daemon/src/stealth/profiles/index.ts b/packages/daemon/src/stealth/profiles/index.ts new file mode 100644 index 0000000..b92ba36 --- /dev/null +++ b/packages/daemon/src/stealth/profiles/index.ts @@ -0,0 +1,21 @@ +// Built-in fingerprint profiles registry / 内置指纹配置注册表 +import type { FingerprintProfile } from '@visionl/core'; +import { desktopChrome } from './desktop-chrome.js'; +import { desktopWindows } from './desktop-windows.js'; +import { desktopMac } from './desktop-mac.js'; + +const profiles = new Map([ + [desktopChrome.id, desktopChrome], + [desktopWindows.id, desktopWindows], + [desktopMac.id, desktopMac], +]); + +export function getProfile(id: string): FingerprintProfile | undefined { + return profiles.get(id); +} + +export function listProfiles(): Array<{ id: string; name: string }> { + return Array.from(profiles.values()).map(({ id, name }) => ({ id, name })); +} + +export { desktopChrome, desktopWindows, desktopMac };