@xkwdstore/agent 2.0.1 → 2.0.3
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/README.md +251 -244
- package/package.json +54 -54
- package/src/actions/comment.js +137 -137
- package/src/actions/dbc.js +149 -149
- package/src/actions/follow.js +82 -82
- package/src/actions/helpers.js +753 -753
- package/src/actions/index.js +94 -94
- package/src/actions/like.js +244 -244
- package/src/actions/session.js +1610 -1610
- package/src/actions/tweet.js +90 -90
- package/src/challengeCodec.js +31 -31
- package/src/chromeDetector.js +154 -154
- package/src/cli.js +664 -528
- package/src/configStore.js +97 -97
- package/src/deviceKeyStore.js +947 -700
- package/src/enrollmentClient.js +588 -445
- package/src/fingerprint.js +261 -261
- package/src/fingerprintStore.js +125 -125
- package/src/leaseClient.js +84 -84
- package/src/processLock.js +148 -148
- package/src/profilePath.js +1116 -1116
- package/src/proxyEgress.js +338 -338
- package/src/proxyPolicy.js +76 -76
- package/src/secretStore.js +132 -132
- package/src/sessionHandler.js +618 -452
- package/src/stealth.js +1250 -1250
- package/src/wsClient.js +233 -233
package/src/fingerprint.js
CHANGED
|
@@ -1,262 +1,262 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Per-account fingerprint generator.
|
|
5
|
-
*
|
|
6
|
-
* Generates deterministic-but-unique fingerprint profiles from an accountId,
|
|
7
|
-
* so each of the 100+ accounts gets a distinct, internally-consistent
|
|
8
|
-
* fingerprint (WebGL vendor/renderer, canvas noise seed, hardware concurrency,
|
|
9
|
-
* device memory, screen resolution, etc.) instead of all sharing the same one.
|
|
10
|
-
*
|
|
11
|
-
* The fingerprint is deterministic: the same accountId always yields the same
|
|
12
|
-
* profile, so cookies/sessions remain consistent across restarts.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const crypto = require('crypto');
|
|
16
|
-
|
|
17
|
-
// ── Realistic GPU profiles (vendor, renderer) ────────────────────────────────
|
|
18
|
-
// Using common real-world GPU strings so accounts don't stand out.
|
|
19
|
-
// Larger pool (16 entries) so 100+ accounts spread across more buckets.
|
|
20
|
-
const GPU_PROFILES = [
|
|
21
|
-
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) UHD Graphics 630 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
22
|
-
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) UHD Graphics 770 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
23
|
-
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) Iris(R) Xe Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
24
|
-
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
25
|
-
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) HD Graphics 4600 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
26
|
-
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) HD Graphics 530 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
27
|
-
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) HD Graphics 620 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
28
|
-
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1060 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
29
|
-
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1650 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
30
|
-
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1660 Ti Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
31
|
-
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
32
|
-
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
33
|
-
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce RTX 4060 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
34
|
-
{ vendor: 'Google Inc. (AMD)', renderer: 'ANGLE (AMD, AMD Radeon(TM) Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
35
|
-
{ vendor: 'Google Inc. (AMD)', renderer: 'ANGLE (AMD, AMD Radeon RX 580 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
36
|
-
{ vendor: 'Google Inc. (AMD)', renderer: 'ANGLE (AMD, AMD Radeon(TM) Vega 8 Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
37
|
-
{ vendor: 'Google Inc. (AMD)', renderer: 'ANGLE (AMD, AMD Radeon RX 6600 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
// ── Screen resolutions (desktop) ─────────────────────────────────────────────
|
|
41
|
-
const SCREEN_RESOLUTIONS = [
|
|
42
|
-
{ width: 1920, height: 1080 },
|
|
43
|
-
{ width: 2560, height: 1440 },
|
|
44
|
-
{ width: 1536, height: 864 },
|
|
45
|
-
{ width: 1440, height: 900 },
|
|
46
|
-
{ width: 1366, height: 768 },
|
|
47
|
-
{ width: 1280, height: 720 },
|
|
48
|
-
{ width: 1600, height: 900 },
|
|
49
|
-
{ width: 1680, height: 1050 },
|
|
50
|
-
{ width: 1360, height: 768 },
|
|
51
|
-
{ width: 1280, height: 800 },
|
|
52
|
-
{ width: 1280, height: 1024 },
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
// ── Hardware concurrency values ──────────────────────────────────────────────
|
|
56
|
-
const HARDWARE_CONCURRENCIES = [4, 4, 6, 6, 8, 8, 8, 12, 12, 16, 16, 20];
|
|
57
|
-
|
|
58
|
-
// ── Device memory values (GB) ────────────────────────────────────────────────
|
|
59
|
-
const DEVICE_MEMORIES = [4, 4, 8, 8, 8, 16, 16, 32];
|
|
60
|
-
|
|
61
|
-
// ── Locale → languages mapping ───────────────────────────────────────────────
|
|
62
|
-
const LOCALE_LANGUAGES = {
|
|
63
|
-
'en-US': ['en-US', 'en'],
|
|
64
|
-
'en-GB': ['en-GB', 'en'],
|
|
65
|
-
'ar-SA': ['ar-SA', 'ar', 'en-US', 'en'],
|
|
66
|
-
'ar': ['ar', 'en-US', 'en'],
|
|
67
|
-
'fr-FR': ['fr-FR', 'fr', 'en-US', 'en'],
|
|
68
|
-
'de-DE': ['de-DE', 'de', 'en-US', 'en'],
|
|
69
|
-
'es-ES': ['es-ES', 'es', 'en-US', 'en'],
|
|
70
|
-
'tr-TR': ['tr-TR', 'tr', 'en-US', 'en'],
|
|
71
|
-
'ru-RU': ['ru-RU', 'ru', 'en-US', 'en'],
|
|
72
|
-
'pt-BR': ['pt-BR', 'pt', 'en-US', 'en'],
|
|
73
|
-
'id-ID': ['id-ID', 'id', 'en-US', 'en'],
|
|
74
|
-
'ja-JP': ['ja-JP', 'ja', 'en-US', 'en'],
|
|
75
|
-
'ko-KR': ['ko-KR', 'ko', 'en-US', 'en'],
|
|
76
|
-
'zh-CN': ['zh-CN', 'zh', 'en-US', 'en'],
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// ── Locale → timezone mapping ────────────────────────────────────────────────
|
|
80
|
-
const LOCALE_TIMEZONES = {
|
|
81
|
-
'en-US': 'America/New_York',
|
|
82
|
-
'en-GB': 'Europe/London',
|
|
83
|
-
'ar-SA': 'Asia/Riyadh',
|
|
84
|
-
'ar': 'Asia/Riyadh',
|
|
85
|
-
'fr-FR': 'Europe/Paris',
|
|
86
|
-
'de-DE': 'Europe/Berlin',
|
|
87
|
-
'es-ES': 'Europe/Madrid',
|
|
88
|
-
'tr-TR': 'Europe/Istanbul',
|
|
89
|
-
'ru-RU': 'Europe/Moscow',
|
|
90
|
-
'pt-BR': 'America/Sao_Paulo',
|
|
91
|
-
'id-ID': 'Asia/Jakarta',
|
|
92
|
-
'ja-JP': 'Asia/Tokyo',
|
|
93
|
-
'ko-KR': 'Asia/Seoul',
|
|
94
|
-
'zh-CN': 'Asia/Shanghai',
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// ── Chrome User-Agent strings (realistic, per-account) ──────────────────────
|
|
98
|
-
// Chrome on Windows is the most common browser — using it makes accounts
|
|
99
|
-
// blend in with real users. {ver} is replaced with a recent Chrome version.
|
|
100
|
-
const CHROME_UAS = [
|
|
101
|
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
102
|
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
103
|
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
104
|
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
105
|
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
106
|
-
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
// Recent Chrome versions (rotated per-account for diversity)
|
|
110
|
-
const CHROME_VERSIONS = ['140', '141', '142', '143', '144', '145', '146', '147', '148', '149'];
|
|
111
|
-
|
|
112
|
-
// ── Network connection profiles (effectiveType, downlink, rtt) ───────────────
|
|
113
|
-
const CONNECTION_PROFILES = [
|
|
114
|
-
{ effectiveType: '4g', downlink: 10, rtt: 50 },
|
|
115
|
-
{ effectiveType: '4g', downlink: 8.5, rtt: 100 },
|
|
116
|
-
{ effectiveType: '4g', downlink: 5.6, rtt: 150 },
|
|
117
|
-
{ effectiveType: '4g', downlink: 15, rtt: 30 },
|
|
118
|
-
{ effectiveType: '4g', downlink: 7.2, rtt: 80 },
|
|
119
|
-
];
|
|
120
|
-
|
|
121
|
-
// ── Battery profiles (level, charging) ───────────────────────────────────────
|
|
122
|
-
const BATTERY_PROFILES = [
|
|
123
|
-
{ level: 0.85, charging: true },
|
|
124
|
-
{ level: 0.62, charging: false },
|
|
125
|
-
{ level: 0.41, charging: false },
|
|
126
|
-
{ level: 0.93, charging: true },
|
|
127
|
-
{ level: 0.27, charging: false },
|
|
128
|
-
{ level: 0.78, charging: true },
|
|
129
|
-
];
|
|
130
|
-
|
|
131
|
-
// ── Media device counts (microphones, cameras, speakers) ─────────────────────
|
|
132
|
-
const MEDIA_DEVICE_COUNTS = [
|
|
133
|
-
{ audioinput: 1, audiooutput: 2, videoinput: 1 },
|
|
134
|
-
{ audioinput: 1, audiooutput: 1, videoinput: 0 },
|
|
135
|
-
{ audioinput: 2, audiooutput: 2, videoinput: 1 },
|
|
136
|
-
{ audioinput: 1, audiooutput: 1, videoinput: 1 },
|
|
137
|
-
{ audioinput: 0, audiooutput: 1, videoinput: 0 },
|
|
138
|
-
{ audioinput: 1, audiooutput: 2, videoinput: 0 },
|
|
139
|
-
{ audioinput: 2, audiooutput: 2, videoinput: 2 },
|
|
140
|
-
{ audioinput: 1, audiooutput: 2, videoinput: 2 },
|
|
141
|
-
];
|
|
142
|
-
|
|
143
|
-
// ── Deterministic PRNG from accountId ────────────────────────────────────────
|
|
144
|
-
function seededRandom(accountId) {
|
|
145
|
-
const hash = crypto.createHash('sha256').update(String(accountId)).digest();
|
|
146
|
-
let seed = hash.readUInt32BE(0);
|
|
147
|
-
return function () {
|
|
148
|
-
// xorshift32
|
|
149
|
-
seed ^= seed << 13;
|
|
150
|
-
seed ^= seed >>> 17;
|
|
151
|
-
seed ^= seed << 5;
|
|
152
|
-
return ((seed >>> 0) / 0xFFFFFFFF);
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function pick(rng, arr) {
|
|
157
|
-
return arr[Math.floor(rng() * arr.length)];
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Generate a full fingerprint profile for an account.
|
|
162
|
-
* @param {string} accountId - The account ID (deterministic seed)
|
|
163
|
-
* @param {object} options - { mobileView, locale, userAgent }
|
|
164
|
-
* @returns {object} Fingerprint profile
|
|
165
|
-
*/
|
|
166
|
-
function generateFingerprint(accountId, options = {}) {
|
|
167
|
-
const rng = seededRandom(accountId);
|
|
168
|
-
|
|
169
|
-
const gpu = pick(rng, GPU_PROFILES);
|
|
170
|
-
const screen = options.mobileView
|
|
171
|
-
? { width: 390, height: 844 }
|
|
172
|
-
: pick(rng, SCREEN_RESOLUTIONS);
|
|
173
|
-
const hardwareConcurrency = pick(rng, HARDWARE_CONCURRENCIES);
|
|
174
|
-
const deviceMemory = pick(rng, DEVICE_MEMORIES);
|
|
175
|
-
|
|
176
|
-
const locale = options.locale || 'en-US';
|
|
177
|
-
const languages = LOCALE_LANGUAGES[locale] || ['en-US', 'en'];
|
|
178
|
-
const timezone = options.timezone || LOCALE_TIMEZONES[locale] || 'America/New_York';
|
|
179
|
-
|
|
180
|
-
// Per-account Chrome User-Agent — use a recent Chrome version
|
|
181
|
-
const chromeVersion = options.chromeVersion || pick(rng, CHROME_VERSIONS);
|
|
182
|
-
const uaTemplate = pick(rng, CHROME_UAS);
|
|
183
|
-
const userAgent = options.userAgent || uaTemplate.replace(/\{ver\}/g, chromeVersion);
|
|
184
|
-
|
|
185
|
-
// Canvas noise seed — a small random offset applied to pixel data
|
|
186
|
-
const canvasNoiseSeed = Math.floor(rng() * 1000);
|
|
187
|
-
|
|
188
|
-
// AudioContext noise — tiny float perturbation
|
|
189
|
-
const audioNoiseSeed = rng() * 0.0001;
|
|
190
|
-
|
|
191
|
-
// Network connection profile
|
|
192
|
-
const connection = pick(rng, CONNECTION_PROFILES);
|
|
193
|
-
|
|
194
|
-
// Battery profile
|
|
195
|
-
const battery = pick(rng, BATTERY_PROFILES);
|
|
196
|
-
|
|
197
|
-
// Media devices
|
|
198
|
-
const mediaDevices = pick(rng, MEDIA_DEVICE_COUNTS);
|
|
199
|
-
|
|
200
|
-
// Performance.now() jitter (microseconds)
|
|
201
|
-
const perfJitter = Math.floor(rng() * 100) + 10;
|
|
202
|
-
|
|
203
|
-
// devicePixelRatio — realistic Windows values, deterministic per account.
|
|
204
|
-
// Hardcoding 1 across all accounts was itself a fingerprint signal.
|
|
205
|
-
const DEVICE_PIXEL_RATIOS = [1, 1, 1.25, 1.25, 1.5, 1.5, 1.75, 2];
|
|
206
|
-
const devicePixelRatio = options.devicePixelRatio || pick(rng, DEVICE_PIXEL_RATIOS);
|
|
207
|
-
|
|
208
|
-
// Platform based on UA
|
|
209
|
-
const ua = userAgent.toLowerCase();
|
|
210
|
-
let platform = 'Win32';
|
|
211
|
-
let userAgentDataPlatform = 'Windows';
|
|
212
|
-
let oscpu = ''; // Chrome doesn't have navigator.oscpu (Firefox-only)
|
|
213
|
-
if (ua.includes('mac')) {
|
|
214
|
-
platform = 'MacIntel';
|
|
215
|
-
userAgentDataPlatform = 'macOS';
|
|
216
|
-
oscpu = '';
|
|
217
|
-
} else if (ua.includes('linux')) {
|
|
218
|
-
platform = 'Linux x86_64';
|
|
219
|
-
userAgentDataPlatform = 'Linux';
|
|
220
|
-
oscpu = '';
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Chrome doesn't have navigator.buildID (Firefox-only)
|
|
224
|
-
const buildID = '';
|
|
225
|
-
|
|
226
|
-
// Chrome Sec-CH-UA client hints (used for anti-detection)
|
|
227
|
-
const secChUa = `"Chromium";v="${chromeVersion}", "Google Chrome";v="${chromeVersion}", "Not.A/Brand";v="99"`;
|
|
228
|
-
const secChUaMobile = '?0';
|
|
229
|
-
const secChUaPlatform = `"${userAgentDataPlatform}"`;
|
|
230
|
-
|
|
231
|
-
return {
|
|
232
|
-
gpu,
|
|
233
|
-
screen,
|
|
234
|
-
hardwareConcurrency,
|
|
235
|
-
deviceMemory,
|
|
236
|
-
languages,
|
|
237
|
-
locale,
|
|
238
|
-
timezone,
|
|
239
|
-
userAgent,
|
|
240
|
-
platform,
|
|
241
|
-
userAgentDataPlatform,
|
|
242
|
-
oscpu,
|
|
243
|
-
buildID,
|
|
244
|
-
canvasNoiseSeed,
|
|
245
|
-
audioNoiseSeed,
|
|
246
|
-
connection,
|
|
247
|
-
battery,
|
|
248
|
-
mediaDevices,
|
|
249
|
-
perfJitter,
|
|
250
|
-
devicePixelRatio,
|
|
251
|
-
// Chrome-specific fields
|
|
252
|
-
secChUa,
|
|
253
|
-
secChUaMobile,
|
|
254
|
-
secChUaPlatform,
|
|
255
|
-
chromeVersion,
|
|
256
|
-
isChrome: true,
|
|
257
|
-
// Mobile vs desktop
|
|
258
|
-
isMobile: !!options.mobileView,
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Per-account fingerprint generator.
|
|
5
|
+
*
|
|
6
|
+
* Generates deterministic-but-unique fingerprint profiles from an accountId,
|
|
7
|
+
* so each of the 100+ accounts gets a distinct, internally-consistent
|
|
8
|
+
* fingerprint (WebGL vendor/renderer, canvas noise seed, hardware concurrency,
|
|
9
|
+
* device memory, screen resolution, etc.) instead of all sharing the same one.
|
|
10
|
+
*
|
|
11
|
+
* The fingerprint is deterministic: the same accountId always yields the same
|
|
12
|
+
* profile, so cookies/sessions remain consistent across restarts.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const crypto = require('crypto');
|
|
16
|
+
|
|
17
|
+
// ── Realistic GPU profiles (vendor, renderer) ────────────────────────────────
|
|
18
|
+
// Using common real-world GPU strings so accounts don't stand out.
|
|
19
|
+
// Larger pool (16 entries) so 100+ accounts spread across more buckets.
|
|
20
|
+
const GPU_PROFILES = [
|
|
21
|
+
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) UHD Graphics 630 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
22
|
+
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) UHD Graphics 770 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
23
|
+
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) Iris(R) Xe Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
24
|
+
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
25
|
+
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) HD Graphics 4600 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
26
|
+
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) HD Graphics 530 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
27
|
+
{ vendor: 'Google Inc. (Intel)', renderer: 'ANGLE (Intel, Intel(R) HD Graphics 620 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
28
|
+
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1060 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
29
|
+
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1650 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
30
|
+
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1660 Ti Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
31
|
+
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
32
|
+
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
33
|
+
{ vendor: 'Google Inc. (NVIDIA)', renderer: 'ANGLE (NVIDIA, NVIDIA GeForce RTX 4060 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
34
|
+
{ vendor: 'Google Inc. (AMD)', renderer: 'ANGLE (AMD, AMD Radeon(TM) Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
35
|
+
{ vendor: 'Google Inc. (AMD)', renderer: 'ANGLE (AMD, AMD Radeon RX 580 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
36
|
+
{ vendor: 'Google Inc. (AMD)', renderer: 'ANGLE (AMD, AMD Radeon(TM) Vega 8 Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
37
|
+
{ vendor: 'Google Inc. (AMD)', renderer: 'ANGLE (AMD, AMD Radeon RX 6600 Direct3D11 vs_5_0 ps_5_0, D3D11)' },
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
// ── Screen resolutions (desktop) ─────────────────────────────────────────────
|
|
41
|
+
const SCREEN_RESOLUTIONS = [
|
|
42
|
+
{ width: 1920, height: 1080 },
|
|
43
|
+
{ width: 2560, height: 1440 },
|
|
44
|
+
{ width: 1536, height: 864 },
|
|
45
|
+
{ width: 1440, height: 900 },
|
|
46
|
+
{ width: 1366, height: 768 },
|
|
47
|
+
{ width: 1280, height: 720 },
|
|
48
|
+
{ width: 1600, height: 900 },
|
|
49
|
+
{ width: 1680, height: 1050 },
|
|
50
|
+
{ width: 1360, height: 768 },
|
|
51
|
+
{ width: 1280, height: 800 },
|
|
52
|
+
{ width: 1280, height: 1024 },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
// ── Hardware concurrency values ──────────────────────────────────────────────
|
|
56
|
+
const HARDWARE_CONCURRENCIES = [4, 4, 6, 6, 8, 8, 8, 12, 12, 16, 16, 20];
|
|
57
|
+
|
|
58
|
+
// ── Device memory values (GB) ────────────────────────────────────────────────
|
|
59
|
+
const DEVICE_MEMORIES = [4, 4, 8, 8, 8, 16, 16, 32];
|
|
60
|
+
|
|
61
|
+
// ── Locale → languages mapping ───────────────────────────────────────────────
|
|
62
|
+
const LOCALE_LANGUAGES = {
|
|
63
|
+
'en-US': ['en-US', 'en'],
|
|
64
|
+
'en-GB': ['en-GB', 'en'],
|
|
65
|
+
'ar-SA': ['ar-SA', 'ar', 'en-US', 'en'],
|
|
66
|
+
'ar': ['ar', 'en-US', 'en'],
|
|
67
|
+
'fr-FR': ['fr-FR', 'fr', 'en-US', 'en'],
|
|
68
|
+
'de-DE': ['de-DE', 'de', 'en-US', 'en'],
|
|
69
|
+
'es-ES': ['es-ES', 'es', 'en-US', 'en'],
|
|
70
|
+
'tr-TR': ['tr-TR', 'tr', 'en-US', 'en'],
|
|
71
|
+
'ru-RU': ['ru-RU', 'ru', 'en-US', 'en'],
|
|
72
|
+
'pt-BR': ['pt-BR', 'pt', 'en-US', 'en'],
|
|
73
|
+
'id-ID': ['id-ID', 'id', 'en-US', 'en'],
|
|
74
|
+
'ja-JP': ['ja-JP', 'ja', 'en-US', 'en'],
|
|
75
|
+
'ko-KR': ['ko-KR', 'ko', 'en-US', 'en'],
|
|
76
|
+
'zh-CN': ['zh-CN', 'zh', 'en-US', 'en'],
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// ── Locale → timezone mapping ────────────────────────────────────────────────
|
|
80
|
+
const LOCALE_TIMEZONES = {
|
|
81
|
+
'en-US': 'America/New_York',
|
|
82
|
+
'en-GB': 'Europe/London',
|
|
83
|
+
'ar-SA': 'Asia/Riyadh',
|
|
84
|
+
'ar': 'Asia/Riyadh',
|
|
85
|
+
'fr-FR': 'Europe/Paris',
|
|
86
|
+
'de-DE': 'Europe/Berlin',
|
|
87
|
+
'es-ES': 'Europe/Madrid',
|
|
88
|
+
'tr-TR': 'Europe/Istanbul',
|
|
89
|
+
'ru-RU': 'Europe/Moscow',
|
|
90
|
+
'pt-BR': 'America/Sao_Paulo',
|
|
91
|
+
'id-ID': 'Asia/Jakarta',
|
|
92
|
+
'ja-JP': 'Asia/Tokyo',
|
|
93
|
+
'ko-KR': 'Asia/Seoul',
|
|
94
|
+
'zh-CN': 'Asia/Shanghai',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// ── Chrome User-Agent strings (realistic, per-account) ──────────────────────
|
|
98
|
+
// Chrome on Windows is the most common browser — using it makes accounts
|
|
99
|
+
// blend in with real users. {ver} is replaced with a recent Chrome version.
|
|
100
|
+
const CHROME_UAS = [
|
|
101
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
102
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
103
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
104
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
105
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
106
|
+
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver}.0.0.0 Safari/537.36',
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
// Recent Chrome versions (rotated per-account for diversity)
|
|
110
|
+
const CHROME_VERSIONS = ['140', '141', '142', '143', '144', '145', '146', '147', '148', '149'];
|
|
111
|
+
|
|
112
|
+
// ── Network connection profiles (effectiveType, downlink, rtt) ───────────────
|
|
113
|
+
const CONNECTION_PROFILES = [
|
|
114
|
+
{ effectiveType: '4g', downlink: 10, rtt: 50 },
|
|
115
|
+
{ effectiveType: '4g', downlink: 8.5, rtt: 100 },
|
|
116
|
+
{ effectiveType: '4g', downlink: 5.6, rtt: 150 },
|
|
117
|
+
{ effectiveType: '4g', downlink: 15, rtt: 30 },
|
|
118
|
+
{ effectiveType: '4g', downlink: 7.2, rtt: 80 },
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
// ── Battery profiles (level, charging) ───────────────────────────────────────
|
|
122
|
+
const BATTERY_PROFILES = [
|
|
123
|
+
{ level: 0.85, charging: true },
|
|
124
|
+
{ level: 0.62, charging: false },
|
|
125
|
+
{ level: 0.41, charging: false },
|
|
126
|
+
{ level: 0.93, charging: true },
|
|
127
|
+
{ level: 0.27, charging: false },
|
|
128
|
+
{ level: 0.78, charging: true },
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
// ── Media device counts (microphones, cameras, speakers) ─────────────────────
|
|
132
|
+
const MEDIA_DEVICE_COUNTS = [
|
|
133
|
+
{ audioinput: 1, audiooutput: 2, videoinput: 1 },
|
|
134
|
+
{ audioinput: 1, audiooutput: 1, videoinput: 0 },
|
|
135
|
+
{ audioinput: 2, audiooutput: 2, videoinput: 1 },
|
|
136
|
+
{ audioinput: 1, audiooutput: 1, videoinput: 1 },
|
|
137
|
+
{ audioinput: 0, audiooutput: 1, videoinput: 0 },
|
|
138
|
+
{ audioinput: 1, audiooutput: 2, videoinput: 0 },
|
|
139
|
+
{ audioinput: 2, audiooutput: 2, videoinput: 2 },
|
|
140
|
+
{ audioinput: 1, audiooutput: 2, videoinput: 2 },
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
// ── Deterministic PRNG from accountId ────────────────────────────────────────
|
|
144
|
+
function seededRandom(accountId) {
|
|
145
|
+
const hash = crypto.createHash('sha256').update(String(accountId)).digest();
|
|
146
|
+
let seed = hash.readUInt32BE(0);
|
|
147
|
+
return function () {
|
|
148
|
+
// xorshift32
|
|
149
|
+
seed ^= seed << 13;
|
|
150
|
+
seed ^= seed >>> 17;
|
|
151
|
+
seed ^= seed << 5;
|
|
152
|
+
return ((seed >>> 0) / 0xFFFFFFFF);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function pick(rng, arr) {
|
|
157
|
+
return arr[Math.floor(rng() * arr.length)];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Generate a full fingerprint profile for an account.
|
|
162
|
+
* @param {string} accountId - The account ID (deterministic seed)
|
|
163
|
+
* @param {object} options - { mobileView, locale, userAgent }
|
|
164
|
+
* @returns {object} Fingerprint profile
|
|
165
|
+
*/
|
|
166
|
+
function generateFingerprint(accountId, options = {}) {
|
|
167
|
+
const rng = seededRandom(accountId);
|
|
168
|
+
|
|
169
|
+
const gpu = pick(rng, GPU_PROFILES);
|
|
170
|
+
const screen = options.mobileView
|
|
171
|
+
? { width: 390, height: 844 }
|
|
172
|
+
: pick(rng, SCREEN_RESOLUTIONS);
|
|
173
|
+
const hardwareConcurrency = pick(rng, HARDWARE_CONCURRENCIES);
|
|
174
|
+
const deviceMemory = pick(rng, DEVICE_MEMORIES);
|
|
175
|
+
|
|
176
|
+
const locale = options.locale || 'en-US';
|
|
177
|
+
const languages = LOCALE_LANGUAGES[locale] || ['en-US', 'en'];
|
|
178
|
+
const timezone = options.timezone || LOCALE_TIMEZONES[locale] || 'America/New_York';
|
|
179
|
+
|
|
180
|
+
// Per-account Chrome User-Agent — use a recent Chrome version
|
|
181
|
+
const chromeVersion = options.chromeVersion || pick(rng, CHROME_VERSIONS);
|
|
182
|
+
const uaTemplate = pick(rng, CHROME_UAS);
|
|
183
|
+
const userAgent = options.userAgent || uaTemplate.replace(/\{ver\}/g, chromeVersion);
|
|
184
|
+
|
|
185
|
+
// Canvas noise seed — a small random offset applied to pixel data
|
|
186
|
+
const canvasNoiseSeed = Math.floor(rng() * 1000);
|
|
187
|
+
|
|
188
|
+
// AudioContext noise — tiny float perturbation
|
|
189
|
+
const audioNoiseSeed = rng() * 0.0001;
|
|
190
|
+
|
|
191
|
+
// Network connection profile
|
|
192
|
+
const connection = pick(rng, CONNECTION_PROFILES);
|
|
193
|
+
|
|
194
|
+
// Battery profile
|
|
195
|
+
const battery = pick(rng, BATTERY_PROFILES);
|
|
196
|
+
|
|
197
|
+
// Media devices
|
|
198
|
+
const mediaDevices = pick(rng, MEDIA_DEVICE_COUNTS);
|
|
199
|
+
|
|
200
|
+
// Performance.now() jitter (microseconds)
|
|
201
|
+
const perfJitter = Math.floor(rng() * 100) + 10;
|
|
202
|
+
|
|
203
|
+
// devicePixelRatio — realistic Windows values, deterministic per account.
|
|
204
|
+
// Hardcoding 1 across all accounts was itself a fingerprint signal.
|
|
205
|
+
const DEVICE_PIXEL_RATIOS = [1, 1, 1.25, 1.25, 1.5, 1.5, 1.75, 2];
|
|
206
|
+
const devicePixelRatio = options.devicePixelRatio || pick(rng, DEVICE_PIXEL_RATIOS);
|
|
207
|
+
|
|
208
|
+
// Platform based on UA
|
|
209
|
+
const ua = userAgent.toLowerCase();
|
|
210
|
+
let platform = 'Win32';
|
|
211
|
+
let userAgentDataPlatform = 'Windows';
|
|
212
|
+
let oscpu = ''; // Chrome doesn't have navigator.oscpu (Firefox-only)
|
|
213
|
+
if (ua.includes('mac')) {
|
|
214
|
+
platform = 'MacIntel';
|
|
215
|
+
userAgentDataPlatform = 'macOS';
|
|
216
|
+
oscpu = '';
|
|
217
|
+
} else if (ua.includes('linux')) {
|
|
218
|
+
platform = 'Linux x86_64';
|
|
219
|
+
userAgentDataPlatform = 'Linux';
|
|
220
|
+
oscpu = '';
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Chrome doesn't have navigator.buildID (Firefox-only)
|
|
224
|
+
const buildID = '';
|
|
225
|
+
|
|
226
|
+
// Chrome Sec-CH-UA client hints (used for anti-detection)
|
|
227
|
+
const secChUa = `"Chromium";v="${chromeVersion}", "Google Chrome";v="${chromeVersion}", "Not.A/Brand";v="99"`;
|
|
228
|
+
const secChUaMobile = '?0';
|
|
229
|
+
const secChUaPlatform = `"${userAgentDataPlatform}"`;
|
|
230
|
+
|
|
231
|
+
return {
|
|
232
|
+
gpu,
|
|
233
|
+
screen,
|
|
234
|
+
hardwareConcurrency,
|
|
235
|
+
deviceMemory,
|
|
236
|
+
languages,
|
|
237
|
+
locale,
|
|
238
|
+
timezone,
|
|
239
|
+
userAgent,
|
|
240
|
+
platform,
|
|
241
|
+
userAgentDataPlatform,
|
|
242
|
+
oscpu,
|
|
243
|
+
buildID,
|
|
244
|
+
canvasNoiseSeed,
|
|
245
|
+
audioNoiseSeed,
|
|
246
|
+
connection,
|
|
247
|
+
battery,
|
|
248
|
+
mediaDevices,
|
|
249
|
+
perfJitter,
|
|
250
|
+
devicePixelRatio,
|
|
251
|
+
// Chrome-specific fields
|
|
252
|
+
secChUa,
|
|
253
|
+
secChUaMobile,
|
|
254
|
+
secChUaPlatform,
|
|
255
|
+
chromeVersion,
|
|
256
|
+
isChrome: true,
|
|
257
|
+
// Mobile vs desktop
|
|
258
|
+
isMobile: !!options.mobileView,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
262
|
module.exports = { generateFingerprint };
|