-
-
Notifications
You must be signed in to change notification settings - Fork 405
Expand file tree
/
Copy pathfingerprints.py
More file actions
481 lines (452 loc) · 15.2 KB
/
Copy pathfingerprints.py
File metadata and controls
481 lines (452 loc) · 15.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
"""Example fingerprint profiles for pydoll's ``Tab.apply_fingerprint()``.
Three self-contained, internally consistent profiles: one Android (mobile), one
Windows desktop and one macOS desktop. Each aligns User-Agent / navigator /
Client Hints / WebGL / screen / fonts / locale so the browser tells one coherent
story.
Two rules keep a profile undetectable:
1. The Chrome MAJOR in the User-Agent must match the real Chrome binary you
drive. The network-layer fingerprint (TLS JA3/JA4, HTTP/2 SETTINGS) comes from
the actual browser and is NOT spoofable, so a UA claiming a different major
than the binary is itself an inconsistency. Bump ``CHROME_*`` when you upgrade
Chrome (these target Chrome 145).
2. The locale/timezone/geolocation must match the geography of your egress IP (or
proxy). The ``Accept-Language`` header (built from ``locale``) is sent on every
request and cross-referenced against the IP's country by anti-abuse systems
(e.g. Google) — a US-English browser on a Brazilian IP gets blocked. The
Windows and macOS profiles here are a US identity (pair them with a US proxy);
the Android profile is a Brazilian identity.
UA reduction: ``navigator.userAgent`` only exposes ``Chrome/MAJOR.0.0.0``; the
full build (e.g. ``145.0.7632.75``) lives only in ``Sec-CH-UA-Full-Version-List``.
The full build is kept in the UA constants here as the source of truth and is
reduced automatically for ``navigator.userAgent``.
"""
from pydoll.protocol.fingerprint.types import (
AudioFingerprint,
FingerprintConfig,
FontFingerprint,
GeolocationFingerprint,
HardwareFingerprint,
LocaleFingerprint,
MediaDevicesFingerprint,
MediaFeaturesFingerprint,
NavigatorFingerprint,
NetworkConnectionFingerprint,
PermissionsFingerprint,
ScreenFingerprint,
SpeechFingerprint,
SpeechVoice,
WebGLProfile,
)
CHROME_MOBILE = '145.0.7632.45'
CHROME_DESKTOP = '151.0.7827.201'
UA_ANDROID = (
'Mozilla/5.0 (Linux; Android 10; K) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
f'Chrome/{CHROME_MOBILE} Mobile Safari/537.36'
)
UA_WINDOWS = (
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
f'Chrome/{CHROME_DESKTOP} Safari/537.36'
)
UA_MAC = (
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
f'Chrome/{CHROME_DESKTOP} Safari/537.36'
)
APP_ANDROID = UA_ANDROID[len('Mozilla/') :]
APP_WINDOWS = UA_WINDOWS[len('Mozilla/') :]
APP_MAC = UA_MAC[len('Mozilla/') :]
US_LOCALE = LocaleFingerprint(languages=['en-US', 'en'])
BR_LOCALE = LocaleFingerprint(languages=['pt-BR', 'pt', 'en-US', 'en'])
NEW_YORK_GEO = GeolocationFingerprint(latitude=40.7128, longitude=-74.0060, accuracy=100.0)
SAO_PAULO_GEO = GeolocationFingerprint(latitude=-23.5505, longitude=-46.6333, accuracy=100.0)
DESKTOP_EXTENSIONS = [
'ANGLE_instanced_arrays',
'EXT_blend_minmax',
'EXT_color_buffer_half_float',
'EXT_float_blend',
'EXT_frag_depth',
'EXT_shader_texture_lod',
'EXT_texture_compression_bptc',
'EXT_texture_compression_rgtc',
'EXT_texture_filter_anisotropic',
'EXT_sRGB',
'KHR_parallel_shader_compile',
'OES_element_index_uint',
'OES_fbo_render_mipmap',
'OES_standard_derivatives',
'OES_texture_float',
'OES_texture_float_linear',
'OES_texture_half_float',
'OES_texture_half_float_linear',
'OES_vertex_array_object',
'WEBGL_color_buffer_float',
'WEBGL_compressed_texture_s3tc',
'WEBGL_compressed_texture_s3tc_srgb',
'WEBGL_debug_renderer_info',
'WEBGL_depth_texture',
'WEBGL_draw_buffers',
'WEBGL_lose_context',
'WEBGL_multi_draw',
]
MOBILE_EXTENSIONS = [
'ANGLE_instanced_arrays',
'EXT_blend_minmax',
'EXT_color_buffer_half_float',
'EXT_float_blend',
'EXT_frag_depth',
'EXT_shader_texture_lod',
'EXT_texture_filter_anisotropic',
'EXT_sRGB',
'KHR_parallel_shader_compile',
'OES_element_index_uint',
'OES_fbo_render_mipmap',
'OES_standard_derivatives',
'OES_texture_float',
'OES_texture_float_linear',
'OES_texture_half_float',
'OES_texture_half_float_linear',
'OES_vertex_array_object',
'WEBGL_color_buffer_float',
'WEBGL_compressed_texture_astc',
'WEBGL_compressed_texture_etc',
'WEBGL_compressed_texture_etc1',
'WEBGL_debug_renderer_info',
'WEBGL_depth_texture',
'WEBGL_draw_buffers',
'WEBGL_lose_context',
'WEBGL_multi_draw',
]
DESKTOP_WEBGL2_EXTENSIONS = [
'EXT_color_buffer_float',
'EXT_color_buffer_half_float',
'EXT_float_blend',
'EXT_texture_compression_bptc',
'EXT_texture_compression_rgtc',
'EXT_texture_filter_anisotropic',
'EXT_texture_norm16',
'KHR_parallel_shader_compile',
'OES_draw_buffers_indexed',
'OES_texture_float_linear',
'WEBGL_clip_cull_distance',
'WEBGL_compressed_texture_s3tc',
'WEBGL_compressed_texture_s3tc_srgb',
'WEBGL_debug_renderer_info',
'WEBGL_lose_context',
'WEBGL_multi_draw',
'WEBGL_provoking_vertex',
]
MOBILE_WEBGL2_EXTENSIONS = [
'EXT_color_buffer_float',
'EXT_color_buffer_half_float',
'EXT_float_blend',
'EXT_texture_filter_anisotropic',
'EXT_texture_norm16',
'KHR_parallel_shader_compile',
'OES_draw_buffers_indexed',
'OES_texture_float_linear',
'WEBGL_compressed_texture_astc',
'WEBGL_compressed_texture_etc',
'WEBGL_debug_renderer_info',
'WEBGL_lose_context',
'WEBGL_multi_draw',
]
SHADER_PRECISION_DEFAULT = {
'vertex': {
'highFloat': [127, 127, 23],
'mediumFloat': [15, 15, 10],
'lowFloat': [15, 15, 10],
'highInt': [31, 30, 0],
'mediumInt': [15, 14, 0],
'lowInt': [15, 14, 0],
},
'fragment': {
'highFloat': [127, 127, 23],
'mediumFloat': [15, 15, 10],
'lowFloat': [15, 15, 10],
'highInt': [31, 30, 0],
'mediumInt': [15, 14, 0],
'lowInt': [15, 14, 0],
},
}
SPEECH_WINDOWS = SpeechFingerprint(
voices=[
SpeechVoice(
name='Microsoft David - English (United States)', lang='en-US', local_service=True
),
SpeechVoice(
name='Microsoft Zira - English (United States)', lang='en-US', local_service=True
),
SpeechVoice(name='Google US English', lang='en-US', local_service=False),
]
)
SPEECH_MAC = SpeechFingerprint(
voices=[
SpeechVoice(name='Samantha', lang='en-US', local_service=True),
SpeechVoice(name='Alex', lang='en-US', local_service=True),
SpeechVoice(name='Google US English', lang='en-US', local_service=False),
]
)
SPEECH_ANDROID = SpeechFingerprint(
voices=[
SpeechVoice(
name='Android Speech Recognition and Synthesis from Google en-us-x-sfg-local',
lang='en_US',
local_service=True,
),
SpeechVoice(
name='Android Speech Recognition and Synthesis from Google en-us-x-sfg-network',
lang='en_US',
local_service=False,
),
]
)
DESKTOP_NETWORK = NetworkConnectionFingerprint(
effective_type='4g',
downlink=10.0,
rtt=50,
save_data=False,
)
MOBILE_NETWORK = NetworkConnectionFingerprint(
effective_type='4g',
downlink=5.0,
rtt=100,
save_data=False,
)
WINDOWS_FONTS = FontFingerprint(
available_fonts=[
'Arial',
'Arial Black',
'Calibri',
'Cambria',
'Comic Sans MS',
'Consolas',
'Courier New',
'Georgia',
'Impact',
'Lucida Console',
'Microsoft Sans Serif',
'Palatino Linotype',
'Segoe UI',
'Tahoma',
'Times New Roman',
'Trebuchet MS',
'Verdana',
]
)
MAC_FONTS = FontFingerprint(
available_fonts=[
'Arial',
'Arial Black',
'Comic Sans MS',
'Courier New',
'Georgia',
'Helvetica',
'Helvetica Neue',
'Impact',
'Lucida Grande',
'Menlo',
'Monaco',
'Palatino',
'SF Pro Display',
'SF Pro Text',
'Tahoma',
'Times New Roman',
'Trebuchet MS',
'Verdana',
]
)
ANDROID_FONTS = FontFingerprint(
available_fonts=[
'Roboto',
'Noto Sans',
'Noto Color Emoji',
'Droid Sans',
'Droid Sans Mono',
'Courier New',
]
)
DESKTOP_PERMISSIONS = PermissionsFingerprint(
overrides={
'notifications': 'denied',
'geolocation': 'prompt',
'camera': 'prompt',
'microphone': 'prompt',
}
)
ANDROID_PERMISSIONS = PermissionsFingerprint(
overrides={
'notifications': 'prompt',
'geolocation': 'prompt',
'camera': 'prompt',
'microphone': 'prompt',
}
)
FINGERPRINTS: dict[str, FingerprintConfig] = {
# Android (mobile) — Brazilian identity (pair with a Brazilian egress IP).
'android_s24_ultra_sao_paulo': FingerprintConfig(
user_agent=UA_ANDROID,
navigator=NavigatorFingerprint(
platform='Linux armv81',
vendor='Google Inc.',
app_version=APP_ANDROID,
pdf_viewer_enabled=False,
),
webgl=WebGLProfile(
vendor='Qualcomm',
renderer='Adreno (TM) 750',
max_texture_size=16384,
max_renderbuffer_size=16384,
max_viewport_dims=[16384, 16384],
max_vertex_attribs=32,
max_vertex_uniform_vectors=256,
max_fragment_uniform_vectors=224,
max_texture_image_units=16,
max_vertex_texture_image_units=16,
max_combined_texture_image_units=32,
aliased_line_width_range=[1, 1],
aliased_point_size_range=[1, 1024],
supported_extensions=MOBILE_EXTENSIONS,
webgl2_extensions=MOBILE_WEBGL2_EXTENSIONS,
shader_precision_formats=SHADER_PRECISION_DEFAULT,
),
screen=ScreenFingerprint(
width=384,
height=832,
avail_width=384,
avail_height=832,
outer_width=384,
outer_height=784,
inner_width=384,
inner_height=728,
color_depth=24,
pixel_depth=24,
device_pixel_ratio=3.75,
orientation_type='portrait-primary',
orientation_angle=0,
),
hardware=HardwareFingerprint(hardware_concurrency=8, device_memory=8, max_touch_points=10),
geolocation=SAO_PAULO_GEO,
timezone='America/Sao_Paulo',
locale=BR_LOCALE,
media_devices=MediaDevicesFingerprint(audio_inputs=1, audio_outputs=1, video_inputs=1),
audio=AudioFingerprint(sample_rate=48000, max_channel_count=2),
speech=SPEECH_ANDROID,
network_connection=MOBILE_NETWORK,
fonts=ANDROID_FONTS,
media_features=MediaFeaturesFingerprint(color_gamut='p3'),
permissions=ANDROID_PERMISSIONS,
),
# Windows desktop — US identity (pair with a US egress IP / proxy).
'windows11_rtx3060_nyc': FingerprintConfig(
user_agent=UA_WINDOWS,
navigator=NavigatorFingerprint(
platform='Win32',
vendor='Google Inc.',
app_version=APP_WINDOWS,
pdf_viewer_enabled=True,
),
webgl=WebGLProfile(
vendor='Google Inc. (NVIDIA)',
renderer='ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0, D3D11)',
max_texture_size=32768,
max_renderbuffer_size=32768,
max_viewport_dims=[32768, 32768],
max_vertex_attribs=16,
max_vertex_uniform_vectors=4096,
max_fragment_uniform_vectors=1024,
max_texture_image_units=32,
max_vertex_texture_image_units=32,
max_combined_texture_image_units=192,
aliased_line_width_range=[1, 1],
aliased_point_size_range=[1, 1024],
supported_extensions=DESKTOP_EXTENSIONS,
webgl2_extensions=DESKTOP_WEBGL2_EXTENSIONS,
shader_precision_formats=SHADER_PRECISION_DEFAULT,
),
screen=ScreenFingerprint(
width=1920,
height=1080,
avail_width=1920,
avail_height=1040,
avail_top=0, # Windows taskbar sits at the bottom
avail_left=0,
outer_width=1920,
outer_height=1040,
inner_width=1903,
inner_height=969,
color_depth=24,
pixel_depth=24,
device_pixel_ratio=1.0,
orientation_type='landscape-primary',
orientation_angle=0,
),
hardware=HardwareFingerprint(hardware_concurrency=12, device_memory=8, max_touch_points=0),
geolocation=NEW_YORK_GEO,
timezone='America/New_York',
locale=US_LOCALE,
media_devices=MediaDevicesFingerprint(audio_inputs=1, audio_outputs=1, video_inputs=1),
audio=AudioFingerprint(sample_rate=48000, max_channel_count=2),
speech=SPEECH_WINDOWS,
network_connection=DESKTOP_NETWORK,
fonts=WINDOWS_FONTS,
media_features=MediaFeaturesFingerprint(color_gamut='srgb'),
permissions=DESKTOP_PERMISSIONS,
),
# macOS desktop — US identity (pair with a US egress IP / proxy).
'macos_m3_new_york': FingerprintConfig(
user_agent=UA_MAC,
navigator=NavigatorFingerprint(
platform='MacIntel',
vendor='Google Inc.',
app_version=APP_MAC,
pdf_viewer_enabled=True,
),
webgl=WebGLProfile(
vendor='Google Inc. (Apple)',
renderer='ANGLE (Apple, ANGLE Metal Renderer: Apple M3, Unspecified Version)',
max_texture_size=16384,
max_renderbuffer_size=16384,
max_viewport_dims=[16384, 16384],
max_vertex_attribs=16,
max_vertex_uniform_vectors=1024,
max_fragment_uniform_vectors=1024,
max_texture_image_units=16,
max_vertex_texture_image_units=16,
max_combined_texture_image_units=32,
aliased_line_width_range=[1, 1],
aliased_point_size_range=[1, 511],
shader_precision_formats=SHADER_PRECISION_DEFAULT,
),
screen=ScreenFingerprint(
width=1440,
height=900,
avail_width=1440,
avail_height=860,
avail_top=25, # macOS menu bar at the top; remainder (15) is the dock
avail_left=0,
outer_width=1440,
outer_height=860,
inner_width=1440,
inner_height=785,
color_depth=24,
pixel_depth=24,
device_pixel_ratio=2.0,
orientation_type='landscape-primary',
orientation_angle=0,
),
hardware=HardwareFingerprint(hardware_concurrency=8, device_memory=8, max_touch_points=0),
geolocation=NEW_YORK_GEO,
timezone='America/New_York',
locale=US_LOCALE,
media_devices=MediaDevicesFingerprint(audio_inputs=1, audio_outputs=2, video_inputs=1),
audio=AudioFingerprint(sample_rate=44100, max_channel_count=2),
speech=SPEECH_MAC,
network_connection=DESKTOP_NETWORK,
fonts=MAC_FONTS,
media_features=MediaFeaturesFingerprint(color_gamut='p3'),
permissions=DESKTOP_PERMISSIONS,
),
}
DEFAULT_FINGERPRINT = FINGERPRINTS['windows11_rtx3060_nyc']