Greasy Fork is available in English.

delta绕过

自动绕过验证码并解密重定向脚本

// ==UserScript==
// @name         delta绕过
// @namespace    http://tampermonkey.net/
// @version      2.6
// @description  自动绕过验证码并解密重定向脚本
// @author       47
// @match        https://gateway.platoboost.com/a/8?id=*
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==
(function() {
    'use strict';

    const urlParams = new URLSearchParams(window.location.search);
    const id = urlParams.get('id');
    const token = urlParams.get('tk');

    const decryptLootLink = (url) => {
        const encryptedData = new URL(url).searchParams.get('r') || new URL(url).searchParams.get('data');
        if (!encryptedData) return url;

        const decoded = atob(encryptedData);
        return decoded[0] === '{' && decoded[decoded.length - 1] === '}'
            ? JSON.parse(decoded).url || JSON.parse(decoded).link || decoded
            : decoded;
    };

    const fetchJson = (url, options = {}) => fetch(url, options).then(response => response.json());

    const delta = async () => {
        if (!document.hidden && document.title === 'Just a moment...') return;

        if (token) {
            await new Promise(resolve => setTimeout(resolve, 4300));
            const { redirect } = await fetchJson(`https://api-gateway.platoboost.com/v1/sessions/auth/8/${id}/${token}`, { method: 'PUT' });
            window.location.replace(decryptLootLink(redirect));
            return;
        }

        const { key, captcha } = await fetchJson(`https://api-gateway.platoboost.com/v1/authenticators/8/${id}`);
        if (key) return;

        const captchaResponse = captcha ? await new Promise(resolve => {
            const intervalId = setInterval(() => {
                const response = turnstile.getResponse();
                if (response) {
                    clearInterval(intervalId);
                    resolve(response);
                }
            }, 20);
        }) : "";

        const { redirect } = await fetchJson(`https://api-gateway.platoboost.com/v1/sessions/auth/8/${id}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({ captcha: captchaResponse, type: captcha ? "Turnstile" : "" })
        });

        window.location.replace(decryptLootLink(redirect));
    };

    delta();
})();