GithubHelp home page GithubHelp logo

tuyendinhit / puppeteer-detection-100-percent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from digitalhurricane-io/puppeteer-detection-100-percent

0.0 0.0 0.0 26 KB

How to detect puppeteer with 100% accuracy

JavaScript 69.98% HTML 30.02%

puppeteer-detection-100-percent's Introduction

Detect Puppeteer With 100% Accuracy

This is an example of how to detect puppeteer with 100% accuracy.

By replacing a native browser function which puppeteer uses, in this case, document.querySelector, we can create an error to detect the script being run.

You can see this line: https://github.com/puppeteer/puppeteer/blob/7eab7f8dd9838489432882bedee5a9d3df66aa2c/src/ExecutionContext.ts#L24

The script name that puppeteer runs is called puppeteer_evaluation_script

export const EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__';

By throwing an error and checking for this script name, puppeteer can be detected with 100% accuracy.

As far as I know, I am the first to report on this.

In order to prevent this, you need to fork the library, and change the name of the script ("puppeteer_evaluation_script") to something else.

How to use this demo

Run the public folder using a local server, this server will do the trick https://www.npmjs.com/package/http-server

Install deps with yarn.

Run with "yarn start"

When puppeteer types in the text box, it will be detected. The word "yes" will be displayed.

When you visit the liveserver page manually in your normal browser, and type in the text box, it will still say "no"

puppeteer-detection-100-percent's People

Contributors

digitalhurricane-io avatar

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.