ReBreached Forums
roblox message spammer in python - Printable Version

+- ReBreached Forums (https://rebreached.vc)
+-- Forum: General (https://rebreached.vc/Forum-General)
+--- Forum: Programming (https://rebreached.vc/Forum-Programming)
+--- Thread: roblox message spammer in python (/Thread-roblox-message-spammer-in-python)



roblox message spammer in python - 4444z - 12-13-2023

Code:
# Roblox message spammer lol
import requests, json, random, time, itertools

class spammer:
    class DotDict(dict):
        def __getattr__(self, attr):
            if attr in self:
                return self[attr]
            else:
                raise AttributeError(f"'DotDict' object has no attribute '{attr}'")
        
    def __init__(self):
        self.config = self._config

    @property
    def _config(self) -> dict:
        with open("config.json") as f: return json.load(f)
    
    def _get_xcsrf_token(self, cookie) -> str:
        response = requests.post("https://accountsettings.roblox.com/v1/email", cookies={".ROBLOSECURITY": cookie})
        xcsrf_token = response.headers.get("x-csrf-token")
        if xcsrf_token is None:
            raise Exception("An error occurred while getting the X-CSRF-TOKEN. "
                            "Could be due to an invalid Roblox Cookie")
        return xcsrf_token
    
    @property
    def _setup_xcsrf_token(self) -> dict:
        accounts = {}
        for cookie in self.config["cookies"]:
            accounts[cookie] = {"x-csrf-token": self._get_xcsrf_token(cookie)}
        return accounts
    
    def start(self):
        self.total_checks = 0
        self.receivers = itertools.cycle(self.config["receivers"])
        self.cookies = itertools.cycle(self.config["cookies"])
        self.accounts = self._setup_xcsrf_token
        request = self.DotDict({})
        request.status_code = "NaN"
        while True:
            try:
                currentCookie = next(self.cookies)
                currentReceiver = next(self.receivers)
                
                request = requests.post("https://privatemessages.roblox.com/v1/messages/send", data={"subject": self.config["message"]["subject"], "body": self.config["message"]["body"], "recipientId": currentReceiver}, headers={"x-csrf-token": self.accounts[currentCookie]["x-csrf-token"]}, cookies={".ROBLOSECURITY": currentCookie})
                if request.status_code == 403:
                    self.accounts[currentCookie]["x-csrf-token"] = self._get_xcsrf_token(currentCookie)
                    continue
                
                if request.status_code == 429:
                    print("Ratelimit hit waiting extra 10 seconds")
                    time.sleep(10)
                    continue
                    
                    
                json_request = request.json()
                if request.status_code == 200:
                    self.total_checks += 1

            finally:
                print("Total Messages: ", self.total_checks, " Last status code: ", request.status_code)
                time.sleep(10 / len(self.config["cookies"]))
                

spammer().start()

config.json
Code:
{
    "message": {
        "subject": "Message brought to you by stpix",
        "body": "hola mi amigo"
    },
    "cookies": ["_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_REST-OF-ROBLOSECURITY-COOKIE"],
    "receivers": [user_id_1, user_id_2, user_id_3]
}



RE: roblox message spammer in python - An0nPr1v - 12-13-2023

good, but for discord will be nice lol