kxBypass Shortlinks Bypasser

Bypass annoying shortlinks and get to your destination!

// ==UserScript==
// @name         kxBypass Shortlinks Bypasser
// @namespace    https://discord.gg/pqEBSTqdxV
// @version      v1.5
// @description  Bypass annoying shortlinks and get to your destination!
// @author       awaitlol.
// @match        https://bstlar.com/*
// @match        https://lootlinks.co/*
// @match        https://loot-links.com/*
// @match        https://loot-link.com/*
// @match        https://linksloot.net/*
// @match        https://lootdest.com/*
// @match        https://lootlink.org/*
// @match        https://lootdest.info/*
// @match        https://lootdest.org/*
// @match        https://links-loot.com/*
// @match        https://rekonise.com/*
// @match        https://mboost.me/*
// @icon         https://i.pinimg.com/736x/aa/2a/e5/aa2ae567da2c40ac6834a44abbb9e9ff.jpg
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    "use strict";

    const modalHTML = `
        <div id="kxBypass-modal">
            <div id="kxBypass-modal-content">
                <img src="https://i.pinimg.com/736x/aa/2a/e5/aa2ae567da2c40ac6834a44abbb9e9ff.jpg" id="kxBypass-logo">
                <h1>kxBypass Development</h1>
                <p>Bypass Successful! Here is your link:</p>
                <input type="text" id="kxBypass-link" value="" readonly>
                <button id="kxBypass-redirect">Redirect</button>
                <button id="kxBypass-close">✕</button>
            </div>
        </div>
    `;

    const overlayHTML = `
        <div id="kxBypass-overlay">
            <div id="kxBypass-content">
                <img src="https://i.pinimg.com/736x/aa/2a/e5/aa2ae567da2c40ac6834a44abbb9e9ff.jpg" id="kxBypass-logo">
                <div id="kxBypass-text">
                    <h1>kxBypass Lootlinks Bypasser!</h1>
                    <p>Please wait, bypassing...</p>
                    <div id="kxBypass-timer">
                        <div id="kxBypass-time-left">Estimated time: <span id="kxBypass-seconds">40</span>s</div>
                        <div class="kxBypass-progress-bar">
                            <div class="kxBypass-progress"></div>
                        </div>
                    </div>
                    <div id="kxBypass-logs"></div>
                    <button id="kxBypass-redirect" disabled>Waiting...</button>
                    <a href="https://discord.gg/pqEBSTqdxV" class="kxBypass-invite">Join our Discord</a>
                </div>
            </div>
        </div>
    `;

    const styleCSS = `
        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

        #kxBypass-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 10000;
            font-family: 'Poppins', sans-serif;
        }

        #kxBypass-modal-content {
            background: #fff;
            padding: 20px;
            border-radius: 12px;
            text-align: center;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            max-width: 400px;
            width: 100%;
            position: relative;
        }

        #kxBypass-logo {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            margin-bottom: 10px;
        }

        #kxBypass-modal-content h1 {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 10px;
            color: #333;
        }

        #kxBypass-modal-content p {
            font-size: 14px;
            color: #666;
            margin-bottom: 15px;
        }

        #kxBypass-link {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 6px;
            text-align: center;
            font-size: 14px;
            color: #333;
            margin-bottom: 15px;
        }

        #kxBypass-modal-content button {
            width: 100%;
            padding: 10px;
            margin-top: 5px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            transition: 0.3s ease;
        }

        #kxBypass-redirect {
            background: #3498db;
            color: #fff;
        }

        #kxBypass-redirect:hover {
            background: #2980b9;
        }

        #kxBypass-overlay {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: 100vh !important;
            background: rgba(255, 255, 255, 0.95) !important;
            display: flex !important;
            justify-content: center !important;
            align-items: center !important;
            z-index: 2147483647 !important;
            font-family: 'Poppins', sans-serif !important;
            animation: fadeIn 0.5s ease-in-out !important;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        #kxBypass-content {
            display: flex !important;
            align-items: center !important;
            gap: 15px !important;
            max-width: 80% !important;
            background: white !important;
            padding: 20px !important;
            border-radius: 10px !important;
            box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2) !important;
        }

        #kxBypass-text h1 {
            font-size: 18px !important;
            font-weight: 600 !important;
            margin: 0 !important;
            color: #333 !important;
        }

        #kxBypass-text p {
            font-size: 14px !important;
            margin: 5px 0 !important;
            color: #666 !important;
        }

        #kxBypass-timer {
            margin: 10px 0;
            width: 100%;
        }

        #kxBypass-time-left {
            font-size: 13px;
            color: #555;
            margin-bottom: 5px;
            text-align: center;
        }

        #kxBypass-time-left span {
            font-weight: 600;
            color: #3498db;
        }

        .kxBypass-progress-bar {
            height: 4px;
            background: #e0e0e0;
            border-radius: 2px;
            overflow: hidden;
        }

        .kxBypass-progress {
            height: 100%;
            width: 100%;
            background: #3498db;
            border-radius: 2px;
            transition: width 1s linear;
        }

        #kxBypass-logs {
            max-height: 100px !important;
            overflow-y: auto !important;
            font-size: 12px !important;
            padding: 5px !important;
            background: #f4f4f4 !important;
            border-radius: 5px !important;
            width: 100% !important;
            margin-bottom: 10px !important;
        }

        #kxBypass-overlay #kxBypass-redirect {
            background: #3498db !important;
            color: white !important;
            border: none !important;
            padding: 10px 20px !important;
            border-radius: 5px !important;
            cursor: pointer !important;
            font-size: 14px !important;
            font-weight: 600 !important;
            transition: background 0.2s ease-in-out !important;
        }

        #kxBypass-overlay #kxBypass-redirect:disabled {
            background: #999 !important;
            cursor: not-allowed !important;
        }

        #kxBypass-overlay #kxBypass-redirect:not(:disabled):hover {
            background: #2980b9 !important;
        }

        .kxBypass-invite {
            font-size: 14px !important;
            color: #3498db !important;
            text-decoration: none !important;
            font-weight: 600 !important;
        }

        .kxBypass-invite:hover {
            text-decoration: underline !important;
        }
    `;

    function showBypassModal(link) {
        const modalContainer = document.createElement("div");
        modalContainer.innerHTML = modalHTML;
        document.body.appendChild(modalContainer);

        const linkInput = document.getElementById("kxBypass-link");
        if (linkInput) linkInput.value = link;

        document.getElementById("kxBypass-redirect").addEventListener("click", () => {
            window.location.href = link;
        });

        document.getElementById("kxBypass-close").addEventListener("click", () => {
            document.getElementById("kxBypass-modal").remove();
        });
    }

    function hasCloudflare() {
        const pageText = document.body.innerText || "";
        const pageHTML = document.documentElement.innerHTML;
        return pageText.includes("Just a moment") || pageHTML.includes("Just a moment");
    }

    function handleBstlar() {
        if (hasCloudflare()) return;

        const path = new URL(window.location.href).pathname.substring(1);

        fetch(`https://bstlar.com/api/link?url=${path}`, {
            headers: {
                "accept": "application/json, text/plain, */*",
                "accept-language": "en-US,en;q=0.9",
                "authorization": "null",
                "Referer": window.location.href,
                "Referrer-Policy": "same-origin"
            },
            method: "GET"
        })
        .then(response => response.json())
        .then(data => {
            if (data.tasks && data.tasks.length > 0) {
                const linkId = data.tasks[0].link_id;
                return fetch("https://bstlar.com/api/link-completed", {
                    headers: {
                        "accept": "application/json, text/plain, */*",
                        "content-type": "application/json;charset=UTF-8",
                        "authorization": "null",
                        "Referer": window.location.href,
                        "Referrer-Policy": "same-origin"
                    },
                    body: JSON.stringify({ link_id: linkId }),
                    method: "POST"
                });
            }
            throw new Error("No tasks found in response!");
        })
        .then(response => response.text())
        .then(finalLink => showBypassModal(finalLink))
        .catch(console.error);
    }

    function handleLootlinks() {
        alert("KxBypass Lootlinks [Expect Bugs]")

        const originalFetch = window.fetch;
        window.fetch = async function(...args) {
            const [resource] = args;
            const url = typeof resource === 'string' ? resource : resource.url;

            if (url.includes('/tc')) {
                try {
                    const response = await originalFetch(...args);
                    const data = await response.clone().json();

                    if (Array.isArray(data) && data.length > 0) {
                        const { urid, task_id, action_pixel_url, session_id } = data[0];
                        const shard = parseInt(urid.slice(-5)) % 3;

                        const ws = new WebSocket(`wss://${shard}.${INCENTIVE_SERVER_DOMAIN}/c?uid=${urid}&cat=${task_id}&key=${KEY}&session_id=${session_id}&is_loot=1&tid=${TID}`);

                        ws.onopen = () => setInterval(() => ws.send('0'), 1000);

                        ws.onmessage = e => {
                            if (e.data.startsWith('r:')) {
                                const encodedString = e.data.slice(2);
                                try {
                                    const destinationUrl = decodeURI(encodedString);
                                    showBypassResult(destinationUrl);
                                } catch (err) {
                                    console.error('Decryption error:', err);
                                    showErrorUI('Failed to decrypt the URL');
                                }
                            }
                        };

                        navigator.sendBeacon(`https://${shard}.${INCENTIVE_SERVER_DOMAIN}/st?uid=${urid}&cat=${task_id}`);
                        fetch(`https:${action_pixel_url}`);
                        fetch(`https://${INCENTIVE_SYNCER_DOMAIN}/td?ac=auto_complete&urid=${urid}&cat=${task_id}&tid=${TID}`);
                    }

                    return response;
                } catch (err) {
                    console.error('Bypass error:', err);
                    showErrorUI('Bypass failed - please try again');
                    return originalFetch(...args);
                }
            }

            return originalFetch(...args);
        };

        window.open = () => null;

        setTimeout(() => {
            document.open();
            document.write("");
            document.close();
            createBypassUI();
        }, 4000);

        function decodeURI(encodedString, prefixLength = 5) {
            let decodedString = '';
            const base64Decoded = atob(encodedString);
            const prefix = base64Decoded.substring(0, prefixLength);
            const encodedPortion = base64Decoded.substring(prefixLength);

            for (let i = 0; i < encodedPortion.length; i++) {
                const encodedChar = encodedPortion.charCodeAt(i);
                const prefixChar = prefix.charCodeAt(i % prefix.length);
                const decodedChar = encodedChar ^ prefixChar;
                decodedString += String.fromCharCode(decodedChar);
            }

            return decodedString;
        }

        function createBypassUI() {
            const overlay = document.createElement('div');
            overlay.id = 'kxBypass-overlay';
            overlay.style.cssText = `
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.95);
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                z-index: 999999;
                color: white;
                font-family: 'Poppins', sans-serif;
            `;
            overlay.innerHTML = `
                <div style="font-size: 24px; margin-bottom: 20px;">Bypassing Lootlinks...</div>
                <div style="width: 50px; height: 50px; border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%; animation: spin 1s linear infinite;"></div>
                <div style="margin-top: 20px; font-size: 16px;">This may take up to 60 seconds</div>
            `;
            document.body.appendChild(overlay);

            const style = document.createElement('style');
            style.textContent = `@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }`;
            document.head.appendChild(style);
        }

        function showBypassResult(destinationUrl) {
            let overlay = document.getElementById('kxBypass-overlay');
            if (!overlay) {
                createBypassUI();
                overlay = document.getElementById('kxBypass-overlay');
            }

            overlay.innerHTML = `
                <div style="font-size: 24px; margin-bottom: 20px;">Bypass Successful!</div>
                <div style="font-size: 16px; margin-bottom: 20px; word-break: break-all; max-width: 80%;">${destinationUrl}</div>
                <button style="padding: 10px 20px; background: #3498db; color: white; border: none; border-radius: 5px; cursor: pointer;">Continue to Link</button>
            `;
            overlay.querySelector('button').onclick = () => {
                window.location.href = destinationUrl;
            };
        }

        function showErrorUI(message) {
            let overlay = document.getElementById('kxBypass-overlay');
            if (!overlay) {
                createBypassUI();
                overlay = document.getElementById('kxBypass-overlay');
            }

            overlay.innerHTML = `
                <div style="font-size: 24px; margin-bottom: 20px; color: #e74c3c;">Error Occurred</div>
                <div style="font-size: 16px; margin-bottom: 20px;">${message}</div>
                <div style="font-size: 14px; color: #aaa;">Check console for details</div>
            `;
        }
    }

    function handleRekonise() {
        if (hasCloudflare()) return;

        fetch(`https://api.rekonise.com/social-unlocks${location.pathname}/unlock`, {
            headers: {
                "accept": "application/json, text/plain, */*",
                "content-type": "application/json;charset=UTF-8",
                "authorization": "null",
                "Referer": window.location.href,
                "Referrer-Policy": "same-origin"
            },
            method: "GET"
        })
.then(response => response.json())
.then(data => {
    const responseText = JSON.stringify(data);
    const urlMatch = responseText.match(/(https?:\/\/[^\s"]+)/);
    const foundUrl = urlMatch ? urlMatch[0] : null;

    if (foundUrl) {
        showBypassModal(foundUrl);
    } else {
        showBypassModal("Error, please join Discord Server in the Greasyfork script.");
    }
})
.catch(console.error);
    }

    function handleMboost() {

        const pageContent = document.documentElement.outerHTML;
        const targetUrlMatches = [...pageContent.matchAll(/"targeturl\\":\\"(https?:\/\/[^\\"]+)/g)];

        targetUrlMatches.forEach((match, index) => {
            const url = match[1];
            showBypassModal(url);
        });

        if (targetUrlMatches.length === 0) {
            showBypassModal('Could not find destination! Please join our Discord.');
        }

            }

    const style = document.createElement('style');
    style.textContent = styleCSS;
    document.head.appendChild(style);

    if (window.location.href.includes("bstlar.com")) handleBstlar();
    else if (window.location.href.includes("loot")) handleLootlinks();
    else if (window.location.href.includes("rekonise.com/")) handleRekonise();
    else if (window.location.href.includes("mboost.me/")) handleMboost()
})();