/pptr-hcaptcha-bypass

Small script to bypass hcaptcha with puppeteer

Primary LanguageJavaScript

Hcaptcha Bypass Puppeteer 🤖

âš  WARNING: this script does not currently work with new versions of Hcaptcha. The script is open source so you can use it to improve it, for example by putting another AI model :^)


âš™ How it works

The script uses Tensorflow and the Cocossd model to recognize the elements in the captcha images and then select them in the captcha

âš  CocoSSD AI model does not currently work with new versions of Hcaptcha, make your own one finds another


🛠 Installation

To make your browser less detectable use puppeteer-extra and puppeteer-extra-plugin-stealth in addition to the classic puppeteer

Commands :

npm install puppeteer puppeteer-extra
npm i puppeteer-extra-plugin-stealth

📦 Dependencies

🔗 NPM link :

Commands :

npm i @tensorflow/tfjs-node
npm i @tensorflow-models/coco-ssd
npm i unidecode
npm i phin

📚 Exemple

const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth')();
const hcaptcha = require('./hcap_module.js');

puppeteer.use(StealthPlugin);

puppeteer.launch({ 
    headless: false,
    //executablePath: '/usr/bin/chromium-browser', // Custom path of Chromium
    defaultViewport: null,
    ignoreHTTPSErrors: true,
    args: [
        '--disable-setuid-sandbox',
        '--no-sandbox',
        '--new-window',
        '--window-position=0,0',
        '--window-size=1600,900',
        '--disable-features=IsolateOrigins,site-per-process', // Important argument to get the contents of the captcha iframe
        '--ignore-certificate-errors',
    ],
    devtools: false,
}).then(async browser => {
        const pages = await browser.pages();
        const page = pages[0];

        await page.goto('https://accounts.hcaptcha.com/demo', {
            "waitUntil" : "networkidle0",
            timeout: 70000
        });

        await hcaptcha.resolve(page);
});

🎈 Have fun !