Code Monkey home page Code Monkey logo

playwright-afp's Introduction

playwright-afp

Stop websites fingerprinting your puppeteer browser instances.

This covers: Canvas Fingerprinting, WebGL Fingerprinting, AudioContext Fingerprinting, Font Fingerprinting

Installation

yarn add playwright-afp
# - or -
npm install playwright-afp

Usage

const { chromium } = require('playwright');
const protectIt = require('playwright-afp');

const browser = await chromium.launch();
const browserContext = await browser.newContext();
// For these options, all are optional, and you dont have to use them, 
// these are used just if you want to reuse a fingerprint
const options = {
        canvasRgba: [0, 0, 0, 0], //all these numbers can be from -5 to 5
        webglData: {
            3379: 32768, //16384, 32768
            3386: {
                0: 32768, // 8192, 16384, 32768
                1: 32768, // 8192, 16384, 32768
            },
            3410: 2, // 2, 4, 8, 16
            3411: 2, // 2, 4, 8, 16
            3412: 16, // 2, 4, 8, 16
            3413: 2, // 2, 4, 8, 16
            7938: "WebGL 1.0 (OpenGL Chromium)", // "WebGL 1.0", "WebGL 1.0 (OpenGL)", "WebGL 1.0 (OpenGL Chromium)"
            33901: {
                0: 1,
                1: 1, // 1, 1024, 2048, 4096, 8192
            },
            33902: {
                0: 1,
                1: 4096, // 1, 1024, 2048, 4096, 8192
            },
            34024: 32768, //16384, 32768
            34047: 8, // 2, 4, 8, 16
            34076: 16384, //16384, 32768
            34921: 16, // 2, 4, 8, 16
            34930: 16, // 2, 4, 8, 16
            35660: 2, // 2, 4, 8, 16
            35661: 32, // 16, 32, 64, 128, 256
            35724: "WebGL GLSL ES", // "WebGL", "WebGL GLSL", "WebGL GLSL ES", "WebGL GLSL ES (OpenGL Chromium)"
            36347: 4096, // 4096, 8192
            36349: 8192, // 1024, 2048, 4096, 8192
            37446: "HD Graphics", // "Graphics", "HD Graphics", "Intel(R) HD Graphics"
        },
        fontFingerprint: {
            noise: 1, // -1, 0, 1, 2
            sign: +1, // -1, +1
        },
        audioFingerprint: {
            getChannelDataIndexRandom: 0.7659530895341677, // all values of Math.random() can be used
            getChannelDataResultRandom: 0.7659530895341677, // all values of Math.random() can be used
            createAnalyserIndexRandom: 0.7659530895341677, // all values of Math.random() can be used
            createAnalyserResultRandom: 0.7659530895341677, // all values of Math.random() can be used
        },
        webRTCProtect: true //this option is used to disable or enable WebRTC disabling by destroying get user media
    };
// run this function on any page you want to protect, so pages loaded on 
// this page after this is done will be protected
const page = browser.newPage()
await protectIt(page, options)
// you can also protect the whole context by just running:
await protectIt(browserContext, options)

Go to https://webbrowsertools.com with your browser and check your fingerprints

Creator

Pavle Aleksic

License

This project is licensed under the terms of the MIT license.

playwright-afp's People

Contributors

pavlealeksic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

playwright-afp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.