𝓓𝓮𝓵𝓽𝓪 𝓑𝔂𝓹𝓪𝓼𝓼

Bypasses Delta

// ==UserScript==
// @name         𝓓𝓮𝓵𝓽𝓪 𝓑𝔂𝓹𝓪𝓼𝓼
// @homepageURL  https://discord.gg/yYmCZdg9
// @description  Bypasses Delta
// @author       🅐_🅠
// @version      1
// @run-at       document-start
// @match        https://plato-gateway-static.pages.dev/b
// @match        https://gateway.platoboost.com/cdn-cgi/trace?url=*
// @match        https://gateway.platoboost.com/a/8?id=*
// @match        https://gateway.platoboost.com/a/*?id=*
// @match        https://gateway.platoboost.com/*
// @match        https://gateway.platoboost.com/a/2569?id=*
// @match        https://loot-link.com/s?*
// @match        https://loot-links.com/s?*
// @match        https://lootlink.org/s?*
// @match        https://lootlinks.co/s?*
// @match        https://lootdest.info/s?*
// @match        https://lootdest.org/s?*
// @match        https://lootdest.com/s?*
// @match        https://links-loot.com/s?*
// @match        https://linksloot.net/s?*
// @match        https://*/recaptcha/*
// @match        https://*.hcaptcha.com/*hcaptcha-challenge*
// @match        https://*.hcaptcha.com/*checkbox*
// @match        https://*.hcaptcha.com/*captcha*
// @grant        GM_xmlhttpRequest
// @grant        GM_setClipboard
// @grant        GM_notification
// @grant        GM_openInTab
// @connect      api-gateway.platoboost.com
// @connect      raw.githubusercontent.com
// @license      A_Q
// @namespace https://greasyfork.org/en/users/1381513
// ==/UserScript==
(function() {
    'use strict';

    const apiBaseUrl = 'https://api-gateway.platoboost.com';

    // Add a style tag with CSS for animation
    const style = document.createElement('style');
    style.innerHTML = `
        @keyframes slideIn {
            0% { transform: translateY(-50px); opacity: 0; }
            100% { transform: translateY(0); opacity: 1; }
        }
        @keyframes slideOut {
            0% { transform: translateY(0); opacity: 1; }
            100% { transform: translateY(-50px); opacity: 0; }
        }
        #message {
            position: fixed;
            top: 10px;
            right: 10px;
            padding: 10px;
            background: rgba(0, 0, 0, 0.8);
            color: #fff;
            border-radius: 5px;
            z-index: 9999;
            display: none;
        }
        #message.show {
            display: block;
            animation: slideIn 0.5s, slideOut 0.5s 2.5s;
        }
    `;
    document.head.appendChild(style);

    function showMessage(message) {
        let messageBox = document.getElementById('message');
        if (!messageBox) {
            messageBox = document.createElement('div');
            messageBox.id = 'message';
            document.body.appendChild(messageBox);
        }
        messageBox.textContent = message;
        messageBox.classList.add('show');
        setTimeout(() => {
            messageBox.classList.remove('show');
        }, 3000); // Duration of the animation
    }

    function copyToClipboard(text) {
        GM_setClipboard(text);
        showMessage(`Key copied to clipboard: ${text}`);
        console.log('Key copied to clipboard:', text); // Log to console for debugging
    }
  
    function extractKey(text) {
        const keyPattern = /KEY_[a-f0-9]+/g;
        const match = text.match(keyPattern);
        if (match) {
            copyToClipboard(match[0]); // Copy the first matched key
        } else {
            console.log('No key found in the response:', text);
        }
    }

    function apiRequest(path, method, body) {
        return new Promise((resolve, reject) => {
            GM_xmlhttpRequest({
                method: method,
                url: `${apiBaseUrl}${path}`,
                data: JSON.stringify(body),
                headers: {
                    Accept: "application/json",
                    "Content-Type": "application/json",
                },
                onload: function(response) {
                    try {
                        resolve(JSON.parse(response.responseText));
                    } catch (e) {
                        console.error('Error parsing API response:', e);
                        reject(e);
                    }
                },
                onerror: function(error) {
                    console.error('API Request Error:', error);
                    reject(error);
                }
            });
        });
    }

    async function getCaptchaSolution(type) {
        let res = "";
        while (!res) {
            showMessage("Please solve the captcha.");
            try {
                res = eval(type).getResponse();
            } catch (e) {
                console.error('Error getting captcha response:', e);
            }
            await new Promise(resolve => setTimeout(resolve, 250));
        }
        return res;
    }

    function bypassAdLink(link) {
        let adUrl = new URL(link);
        adUrl = adUrl.searchParams.get("r");
        return atob(adUrl);
    }

    async function delta() {
        let e = new URL(window.location.href).searchParams.get("id");
        let t = await (await fetch(`${apiBaseUrl}/v1/authenticators/8/${e}`)).json();

        if (t.key) {
            copyToClipboard(t.key);
            return;
        }

        let a = new URL(window.location.href).searchParams.get("tk");

        if (a) {
            await new Promise(resolve => setTimeout(resolve, 3260));
            let response = await (await fetch(`${apiBaseUrl}/v1/sessions/auth/8/${e}/${a}`, {
                method: "PUT"
            })).json();
            window.location.assign(response.redirect);
        } else {
            let o = t.captcha;
            let n = await fetch(`${apiBaseUrl}/v1/sessions/auth/8/${e}`, {
                method: "POST",
                headers: {
                    "Content-Type": "application/json"
                },
                body: JSON.stringify({
                    captcha: o ? await getCaptchaSolution("turnstile") : "",
                    type: o ? "Turnstile" : ""
                })
            });

            n = await n.json();
            await new Promise(resolve => setTimeout(resolve, 1000));

            let s = decodeURIComponent(n.redirect);
            let i = new URL(s).searchParams.get("r");
            let c = atob(i);

            window.location.assign(c);
        }
    }

    async function initBypass() {
        let url = new URL(window.location.href);
        let path = url.pathname;
        let id = url.searchParams.get("id");

        const platoboostApiRoutes = {
            init: () => apiRequest(`/v1/authenticators/${path.split("/")[2]}/${id}`, "GET"),
            checkpoint: (token) => apiRequest(`/v1/sessions/auth/${path.split("/")[2]}/${id}/${token}`, "PUT"),
            start: (data) => apiRequest(`/v1/sessions/auth/${path.split("/")[2]}/${id}`, "POST", data),
            challenge: (data) => apiRequest(`/v1/challenge/release/${path.split("/")[2]}/${id}`, "POST", data),
        };

        if (path === "/b") {
            let urlToBypass;
            while (!urlToBypass) {
                urlToBypass = prompt("Please enter your Delta or Hydrogen link to bypass:");
            }
            window.location.replace(`https://gateway.platoboost.com/cdn-cgi/trace?url=${encodeURIComponent(urlToBypass)}&data=${encodeURIComponent(document.documentElement.innerHTML)}`);
            return; // Exit after redirect
        }
      
      // If `tk` is present, handle the session authentication
    if (tk) {
        await sleep(2300); // 2.3-second sleep duration
        try {
            const response = await fetch(`https://api-gateway.platoboost.com/v1/sessions/auth/8/${id}/${tk}`, {
                method: "PUT"
            }).then(res => res.json());

            // Redirect if successful
            if (response.redirect) {
                window.location.assign(response.redirect);
            }
            return; // Exit after handling tk
        } catch (err) {
            console.error("Error during session auth:", err);
        }
    }

        if (path === "/cdn-cgi/trace") {
            let urlToBypass = url.searchParams.get("url");
            urlToBypass = new URL(urlToBypass);
            history.replaceState({}, "", urlToBypass.pathname + urlToBypass.search);
            document.documentElement.innerHTML = url.searchParams.get("data");
            let scriptUrl = document.querySelector("script").src;
            scriptUrl = new URL(scriptUrl);
            scriptUrl = scriptUrl.pathname;
            eval('import(document.querySelector("script").src)');
            return; // Exit after processing
        }

        let initData = await platoboostApiRoutes.init();
        if (initData.key) {
            copyToClipboard(initData.key);
            return;
        }

        let response = await platoboostApiRoutes.start({
            captcha: await getCaptchaSolution("turnstile"),
            type: "Turnstile",
        });

        if (response?.message === "please complete a security check.") {
            document.querySelector("#turnstile")?.remove();
            await platoboostApiRoutes.challenge({
                captcha: await getCaptchaSolution("hcaptcha"),
                type: "hCaptcha",
            });
            window.location.reload();
            return;
        }

        document.querySelector("button")?.remove();

        let bypassedUrl, token;
        const numCheckpoints = path === "/a/2569" ? 2 : (path === "/a/8" ? 1 : 0);

        for (let i = 1; i <= numCheckpoints; i++) {
            showMessage(`Bypassed ${i} of ${numCheckpoints} checkpoints`);
            await new Promise(resolve => setTimeout(resolve, 4000));
            try {
                bypassedUrl = bypassAdLink(response.redirect);
                token = new URL(bypassedUrl).searchParams.get("tk");
                response = await platoboostApiRoutes.checkpoint(token);
            } catch (e) {
                console.error('Error bypassing checkpoint:', e);
                showMessage('Error bypassing checkpoint. Check console for details.');
                return;
            }
        }

        // Extract key from the final response
        extractKey(response.redirect);
        window.location.replace(response.redirect);
    }

    // Run Delta function for specific URL
    if (window.location.href.includes("gateway.platoboost.com/a/8")) {
        delta();
    } else {
        initBypass();
    }
})();