roblox message spammer in python
by 4444z - 12-13-2023, 03:01 AM
#1
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]
}
Reply
#2
good, but for discord will be nice lol
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is python the best programming language? Loki 29 6,295 10-12-2024, 08:40 PM
Last Post: .kels__
  The most annoying error in python. 4444z 6 1,132 02-05-2024, 10:57 AM
Last Post: incrediblehulk
  Where to learn Python, and what good methods? potatoisscaryman 4 990 02-04-2024, 05:17 PM
Last Post: wmtrader
Star Question About Roblox Lua metoma 1 813 01-15-2024, 06:05 AM
Last Post: RayenDelSid

Forum Jump:


Users browsing this thread: 1 Guest(s)