CloudFlare Challenge Optimized

Automates solving Cloudflare Challenges with optimal performance and maintainability

目前為 2024-05-16 提交的版本,檢視 最新版本

// ==UserScript==
// @name         CloudFlare Challenge Optimized
// @version      0.2
// @description  Automates solving Cloudflare Challenges with optimal performance and maintainability
// @author       AstralRift
// @namespace    https://gf.qytechs.cn/users/1300060
// @match        https://challenges.cloudflare.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function attemptChallenge() {
        const targets = [
            "#cf-stage > div.ctp-checkbox-container > label > span",
            "input[value='Verify you are human']",
            ".ctp-checkbox-label"
        ];

        for (let selector of targets) {
            const element = document.querySelector(selector);
            if (element) {
                element.click();
                return true;
            }
        }
        return false;
    }

    function setupObserver() {
        const observer = new MutationObserver(mutations => {
            if (attemptChallenge()) {
                observer.disconnect();
            }
        });

        observer.observe(document.body, { childList: true, subtree: true });
    }

    function setupInterval() {
        const intervalId = setInterval(() => {
            if (attemptChallenge()) {
                clearInterval(intervalId);
            }
        }, 2000);

        setTimeout(() => {
            clearInterval(intervalId);
            observer.disconnect();
        }, 60000);
    }

    function handleChallenge() {
        if (!attemptChallenge()) {
            setupObserver();
            setupInterval();
        }
    }

    handleChallenge();
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址