Anti Captcha Solver

Auto-solve captcha

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Anti Captcha Solver
// @namespace    Anti Captcha Auto Solver
// @version      1.3
// @description  Auto-solve captcha
// @author       Shnethan
// @match        https://freeltc.online/*
// @icon         https://elixirforum.com/uploads/default/optimized/1X/4310e7de671d4920800063776e9b1f6dc268c692_2_32x32.ico
// @license      GPL-3.0-or-later
// @run-at       document-end
// @grant        none

// ==/UserScript==

(function() {
    'use strict';

    setTimeout(() => {
        const c = document.querySelector('input[data-id="anticap-checkbox"]');
        if (!c) return;
        c.disabled = false;
        c.checked  = true;
        c.dispatchEvent(new MouseEvent('click', { bubbles: true }));
    }, 1500);

    const s = ms => new Promise(r => setTimeout(r, ms));

    const w = async sel => {
        while (!document.querySelector(sel)) await s(300);
        return document.querySelector(sel);
    };

    const h = img => {
        const c = document.createElement('canvas');
        c.width = c.height = 16;
        const x = c.getContext('2d');
        x.drawImage(img, 0, 0, 16, 16);
        const d = x.getImageData(0, 0, 16, 16).data;
        return [...d].filter((_, i) => i % 4 !== 3);
    };

    const dist = (a, b) => a.reduce((sum, v, i) => sum + Math.abs(v - b[i]), 0);

    (async () => {
        try {
            const err = document.querySelector('div[data-id="anticap-feedback"].error');
            if (err && err.textContent.includes('Wrong selection. Try again.')) {
                // location.reload();
                return;
            }

            const p = await w('.anticap-preview');
            await w('.anticap-grid img');

            const i = [...document.querySelectorAll('.anticap-grid img')];
            const t = h(p);

            let b, sc = Infinity;

            for (const x of i) {
                const v = dist(t, h(x));
                if (v < sc) sc = v, b = x;
            }

            if (!b) return;

            b.style.outline = '1px solid #2196F3';

            await s(5000);
            b.click();

        } catch (e) {}
    })();

})();