Anti Captcha Solver

Auto-solve captcha

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

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

// ==/UserScript==

(() => {

    "use strict";

    let C = { i: 1e4, p: 300, s: 16, t: 300, r: 4, x: 3, h: "outline:3px solid #4CAF50; box-shadow:0 0 8px #4CAF50; border-radius:4px; transition:.3s", m: "outline:3px solid #FF9800; box-shadow:0 0 8px #FF9800" };

    let Y = 0;

    const D = m => new Promise(r => setTimeout(r, m));

    const W = async (s, t = 2e4) => {
        for (let b = Date.now(); Date.now() - b < t; await D(C.p)) {
            let e = document.querySelector(s);
            if (e) return e;
        }
        throw 0;
    };

    const G = i => {
        if (!i.complete || !i.naturalWidth) return null;
        let c = document.createElement("canvas");
        c.width = c.height = C.s;
        let x = c.getContext("2d");
        x.drawImage(i, 0, 0, C.s, C.s);
        return x.getImageData(0, 0, C.s, C.s).data;
    };

    const M = (a, b) => {
        if (!a || !b || a.length !== b.length) return Infinity;
        let d = 0;
        for (let i = 0; i < a.length; i += 4)
            d +=
                Math.abs(a[i] - b[i]) +
                Math.abs(a[i + 1] - b[i + 2]) * 1.2 +
                Math.abs(a[i + 2] - b[i + 1]) * .8;
        return d;
    };

    const E = () => {
        let f = document.querySelector('div[data-id="anticap-feedback"].error');
        return f && f.textContent.includes("Wrong selection")
            && (setTimeout(() => location.reload(), 1e3), true);
    };

    const A = () => {
        let c = document.querySelector('input[data-id="anticap-checkbox"]');
        try {
            return c && (
                c.disabled = false,
                c.checked = true,
                c.dispatchEvent(new Event("change", { bubbles: true })),
                c.dispatchEvent(new Event("input", { bubbles: true })),
                true
            );
        } catch {
            return false;
        }
    };

    const H = (t, m) =>
        t.forEach(e => e.style.cssText += m ? C.m : C.h);

    const F = (p, g) => {
        let r = [];
        for (let i of g) {
            let d = G(i);
            d && (i._ = M(p, d), r.push(i));
        }
        r.sort((a, b) => a._ - b._);
        if (!r.length) return [];
        let b = r[0]._;
        return r.filter(i => Math.abs(i._ - b) <= C.t);
    };

    const S = async () => {
        try {
            if (E()) return;

            for (let i = 0, o = false; i < C.r && !o; i++)
                await D(C.i), o = A();

            let p = await W(".anticap-preview");
            await W(".anticap-grid img");

            let d = G(p);
            if (!d) return location.reload();

            let g = [...document.querySelectorAll(".anticap-grid img")];
            let m = F(d, g);

            if (!m.length)
                return await D(1e4),
                       Y++ < C.x ? S() : location.reload();

            H(m, m.length > 1);

            let v = m.find(i => i.offsetParent);
            v && v.click();

        } catch {}
    };

    setTimeout(() => {
        let c = document.querySelector('input[data-id="anticap-checkbox"]');
        c && (
            c.disabled = false,
            c.checked = true,
            c.dispatchEvent(new MouseEvent("click", { bubbles: true }))
        );
    }, 3e3);

    document.readyState === "loading"
        ? document.addEventListener("DOMContentLoaded", S)
        : S();

})();