Skip to main content

A fast & comprehensive browser fingerprint generator

Project description

Fingerprint Generator

A fast browser data generator that mimics actual traffic patterns in the wild. With extensive data coverage.

Created by daijro. Data provided by Scrapfly.


Features

  • Uses a Bayesian generative network to mimic real-world web traffic patterns
  • Extensive data coverage for nearly all known browser data points
  • Creates complete fingerprints in a few milliseconds ⚡
  • Easily specify custom criteria for any data point (e.g. "only Windows + Chrome, with Intel GPUs")
  • Simple for humans to use 🚀

Demo Video

Here is a demonstration of what fpgen generates & its ability to filter data points:

https://github.com/user-attachments/assets/5c56691a-5804-4007-b179-0bae7069a111


Installation

Install the package using pip:

pip install fpgen

Downloading the model

Fetch the latest model:

fpgen fetch

This will be ran automatically on the first import, or every 5 weeks.

To decompress the model for faster generation (up to 10-50x faster!), run:

fpgen decompress

Note: This action will use an additional 100mb+ of storage.

CLI Usage
Usage: python -m fpgen [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  decompress  Decompress model files for speed efficiency (will take 100mb+)
  fetch       Fetch the latest model from GitHub
  recompress  Compress model files after running decompress
  remove      Remove all downloaded and/or extracted model files

Usage

Generate a fingerprint

Simple usage:

>>> import fpgen
>>> fpgen.generate(browser='Chrome', os='Windows')

Or use the Generator object to pass filters downward:

>>> gen = fpgen.Generator(browser='Chrome')  # Filter by Chrome
>>> gen.generate(os='Windows')  # Generate Windows & Chrome fingerprints
Parameters list
Initializes the Generator with the given options.
Values passed to the Generator object will be inherited when calling Generator.generate()

Parameters:
    constraints_dict (dict, optional): Constraints for the network, passed as a dictionary.
    window_bounds (WindowBounds, optional): Constrain the output window size.
    strict (bool, optional): Whether to raise an exception if the constraints are too strict.
    flatten (bool, optional): Whether to flatten the output dictionary
    target (Optional[Union[str, StrContainer]]): Only generate specific value(s)
    **constraints: Constraints for the network.

See example output.


Filtering the output

Setting fingerprint criteria

You can narrow down generated fingerprints by specifying filters for any data field.

# Only generate fingerprints with Windows, Chrome, and Intel GPU:
>>> fpgen.generate(
...     os='Windows',
...     browser='Chrome',
...     gpu={'vendor': 'Google Inc. (Intel)'}
... )
This can also be passed as a dictionary.
>>> fpgen.generate({
...     'os': 'Windows',
...     'browser': 'Chrome',
...     'gpu': {'vendor': 'Google Inc. (Intel)'},
... })

Multiple constraints

Pass in multiple constraints for the generator to select from.

fpgen.generate({
    'os': ('Windows', 'Mac OS X'),
    'browser': ('Firefox', 'Chrome'),
})

If you are passing many nested constraints, run fpgen decompress to improve model performance.

Control the window size

Constrain the minimum/maximum width and height of the window:

bounds = fpgen.WindowBounds(
    min_width=100,
    max_width=1280,
    min_height=400,
    max_height=720,
)
fpgen.generate(window_bounds=bounds)
Parameters for WindowBounds
Constrains the window size of the generated fingerprint.
At least one parameter must be passed.

Parameters:
    min_width (int, optional): Lower bound width
    max_width (int, optional): Upper bound width
    min_height (int, optional): Lower bound height
    max_height (int, optional): Upper bound height

Control what data is generated

To generate specific data fields, use the target parameter with a string (or a list of strings).

Examples

Only generate HTTP headers:

>>> fpgen.generate(target='headers')
{'accept-language': 'uk-UA,uk;q=0.9,en-US;q=0.8,en;q=0.7', 'accept-encoding': 'gzip, deflate, br, zstd', 'accept': '*/*', 'priority': 'u=1, i', 'sec-ch-ua': '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"macOS"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-site', 'sec-gpc': None}

Generate a User-Agent for Windows & Chrome:

>>> fpgen.generate(
...     os='Windows',
...     browser='Chrome',
...     # Nested targets must be seperated by dots:
...     target='headers.user-agent'
... )
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0'

Generate a Firefox TLS fingerprint:

>>> fpgen.generate(
...     browser='Firefox',
...     target='network.tls.scrapfly_fp'
... )
{'version': '772', 'ch_ciphers': '4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-156-157-47-53', 'ch_extensions': '0-5-10-11-13-16-23-27-28-34-35-43-45-51-65037-65281', 'groups': '4588-29-23-24-25-256-257', 'points': '0', 'compression': '0', 'supported_versions': '772-771', 'supported_protocols': 'h2-http11', 'key_shares': '4588-29-23', 'psk': '1', 'signature_algs': '1027-1283-1539-2052-2053-2054-1025-1281-1537-515-513', 'early_data': '0'}

You can provide multiple targets as a list.


Query possible values

You can get a list of a target's possible values by passing it into fpgen.query:

List all possible browsers:

>>> fpgen.query('browser')
['Chrome', 'Edge', 'Firefox', 'Opera', 'Safari', 'Samsung Internet', 'Yandex Browser']

Passing a nested target:

>>> fpgen.query('navigator.maxTouchPoints') # Dot seperated path
[0, 1, 2, 5, 6, 9, 10, 17, 20, 40, 256]
Parameters for query
Query a list of possibilities given a target.

Parameters:
    target (str): Target node to query possible values for
    flatten (bool, optional): Whether to flatten the output dictionary
    sort (bool, optional): Whether to sort the output arrays

[!NOTE] Since fpgen is trained on live data, queries may occasionally return invalid or anomalous values. These values will typically only appear in about 1 out of every 20,000 generations.


Custom fingerprint filters

You can manually omit possible values, then pass a new list into the generator:

# Get possible values for screen.width
values = fpgen.query('screen.width')

# Only allow values above 1000
def width_filter(width):
    return width > 1000
values = filter(width_filter, values)

# Pass in the new list of possible widths:
output = fpgen.generate(screen: {'width': values})

Generated data

Here is a rough list of the data fpgen can generate:

  • Browser data:
    • All navigator data
    • All mimetype data: Audio, video, media source, play types, PDF, etc
    • All window viewport data (position, inner/outer viewport sizes, toolbar & scrollbar sizes, etc)
    • All screen data
    • Supported & unsupported DRM modules
    • Memory heap limit
  • System data:
    • GPU data (vendor, renderer, WebGL/WebGL2, extensions, context attributes, parameters, shader precision formats, etc)
    • Battery data (charging, charging time, discharging time, level)
    • Screen size, color depth, taskbar size, etc.
    • Full fonts list
    • Cast receiver data
  • Network data:
    • HTTP headers
    • TLS fingerprint data
    • HTTP/2 fingerprint & frames
    • RTC video & audio capabilities, codecs, clock rates, mimetypes, header extensions, etc
  • Audio data:
    • Audio signal
    • All Audio API constants (AnalyserNode, BiquadFilterNode, DynamicsCompressorNode, OscillatorNode, etc)
  • Internationalization data:
    • Regional internationalization (Locale, calendar, numbering system, timezone, date format, etc)
    • Voices
  • And much more!

For a more complete list, see the full example output.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fpgen-1.2.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fpgen-1.2.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file fpgen-1.2.0.tar.gz.

File metadata

  • Download URL: fpgen-1.2.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fpgen-1.2.0.tar.gz
Algorithm Hash digest
SHA256 fdfb8b354e1d637d923d72535268c6a9d99f36b32d717052aa30b073f8b1f0ef
MD5 d5bbeb8aa63ea676ffd6f9c950287e9f
BLAKE2b-256 7d4a161c9a2b32d6d4dfa7c9a7dde83feb4bcdb7de4dc51e37bbb1323e1cb784

See more details on using hashes here.

File details

Details for the file fpgen-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: fpgen-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fpgen-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7eefcdd120fd53bf6b71f17009c941391b0bbbcd22fc7c10ff5725b1ea927c8
MD5 a0088c34778f77208e06a0e81cd8d03c
BLAKE2b-256 fbe810c98782a0e542786f57cc380946cff1d17ac68c209284329cf1766f9e4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page