Skip to content

Persistent Fingerprints Using Files #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
34892002 opened this issue Apr 7, 2025 · 1 comment
Open

Persistent Fingerprints Using Files #30

34892002 opened this issue Apr 7, 2025 · 1 comment

Comments

@34892002
Copy link

34892002 commented Apr 7, 2025

Hi,
I need to save the generated fingerprint to a file such that I could load it back later to the browser.
Is there a way to dump and load the fingerprint to/from a file?

thanks.

@34892002
Copy link
Author

34892002 commented Apr 7, 2025

The code written like this is invalid.

if os.path.exists(fingerprint_path):
        with open(fingerprint_path, 'r', encoding='utf-8') as f:
            data = json.load(f)

        fingerprint = Fingerprint(
            screen=ScreenFingerprint(**data['screen']),
            navigator=NavigatorFingerprint(**data['navigator']),
            headers=data['headers'],
            videoCodecs=data['videoCodecs'],
            audioCodecs=data['audioCodecs'],
            pluginsData=data['pluginsData'],
            battery=data['battery'],
            videoCard=VideoCard(**data['videoCard']) if data.get('videoCard') else None,
            multimediaDevices=data['multimediaDevices'],
            fonts=data['fonts'],
            mockWebRTC=data.get('mockWebRTC', False),
            slim=data.get('slim', False)
        )
    else:
        fingerprint = fg.generate()
        fingerprint_dict = json.loads(fingerprint.dumps())
        with open(fingerprint_path, 'w', encoding='utf-8') as f:
            json.dump(fingerprint_dict, f, ensure_ascii=False, indent=4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant