MCaptcha Auto-Solver (OnlyFaucet)

Auto-solves mCaptcha

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         MCaptcha Auto-Solver (OnlyFaucet)
// @namespace    http://tampermonkey.net/
// @version      1.3
// @author       Shnethan
// @description  Auto-solves mCaptcha
// @match        https://onlyfaucet.com/faucet/*
// @icon         https://www.solflare.com/tkn_lnd_pg_assets/favicons/favicon.ico
// @license      © Shnethan
// @grant        none
// @run-at       document-idle
// ==/UserScript==
 
         /*
                 * Copyright (c) 2026 Shnethan . All rights reserved.
         */

(async function() {

    'use strict';

    const w = s => new Promise(r => {
        let e = document.querySelector(s);
        if (e) return r(e);
        new MutationObserver((_, o) => {
            if (e = document.querySelector(s)) { o.disconnect(); r(e); }
        }).observe(document.body, { childList: true, subtree: true });
    });

    try {
        (await w('#mcaptcha-checkbox-box')).click();
        const c = await w('#mcaptcha-canvas');
        await new Promise(r => setTimeout(r, 1e3));

        const t = c.getContext('2d'), u = c.width / 5, a = [];
        for (let i = 0; i < 5; i++) {
            const d = t.getImageData(~~(i * u + u / 2 - 5), ~~(c.height / 2 - 5), 10, 10).data;
            let n1 = 0, n2 = 0, n3 = 0;
            for (let j = 0; j < d.length; j += 4) { n1 += d[j]; n2 += d[j + 1]; n3 += d[j + 2]; }
            a.push([n1, n2, n3]);
        }

        let m = -1, k = 0;
        for (let i = 0; i < 5; i++) {
            let l = 0;
            for (let j = 0; j < 5; j++) if (i !== j) l += Math.abs(a[i][0] - a[j][0]) + Math.abs(a[i][1] - a[j][1]) + Math.abs(a[i][2] - a[j][2]);
            if (l > m) { m = l; k = i; }
        }

        const e = document.getElementById('mcaptcha-indicator');
        if (e) { e.style.left = k * 20 + '%'; e.style.display = 'block'; }

        await new Promise(r => setTimeout(r, 4e3));

        const g = c.getBoundingClientRect();
        c.dispatchEvent(new MouseEvent('click', {
            clientX: g.left + k * g.width / 5 + g.width / 10,
            clientY: g.top + g.height / 2,
            bubbles: 1, cancelable: 1
        }));

        const q = await w('#mcaptcha-confirm-btn');
        if (q) {
            q.dispatchEvent(new PointerEvent('pointerdown', { bubbles: 1 }));
            setTimeout(() => q.click(), 150);
        }
    } catch (e) {}
})();