├── bot.py ├── config.json ├── cookies.txt ├── message.txt └── proxies.txt /bot.py: -------------------------------------------------------------------------------- 1 | import httpx 2 | import asyncio 3 | import os 4 | from os import system 5 | import sys 6 | import itertools 7 | import time 8 | import traceback 9 | import json 10 | 11 | import os 12 | import time 13 | import requests 14 | import subprocess 15 | import tkinter 16 | from tkinter import messagebox 17 | import sys 18 | import hashlib 19 | 20 | with open('config.json', 'r', encoding='utf-8') as f: 21 | config = json.load(f) 22 | speed = config['threads'] 23 | 24 | 25 | class InvalidCookie(Exception): 26 | 27 | def __init__(self, error, cookie): 28 | print(f"{error}\n Found Invalid Cookie: {cookie}") 29 | 30 | 31 | class InvalidToken(Exception): 32 | 33 | def __init__(self, error, token, cookie): 34 | print(f"{error}\n Found Invalid Token: {token}\n Cookie: {cookie}") 35 | 36 | 37 | class BadProxy(Exception): 38 | 39 | def __init__(self, error, proxy): 40 | print(f"{error}\n Found Bad Proxy: {proxy}") 41 | 42 | 43 | class UnknownError(Exception): 44 | 45 | def __init__(self, error, location): 46 | print(f"Uncountered Unknown Error in {location}: {error}") 47 | 48 | 49 | def loadMessage(): 50 | while True: 51 | try: 52 | messagePath = os.path.join(os.path.dirname( 53 | os.path.abspath(__file__)), "message.txt") 54 | with open(messagePath, "r") as messageFile: 55 | return messageFile.read() 56 | except Exception as error: 57 | if isinstance(error, FileNotFoundError): 58 | input("message.txt not found. Press Enter to try again.") 59 | continue 60 | else: 61 | raise UnknownError(error, "loadMessage") 62 | 63 | 64 | async def loadCookies(loop): 65 | cookieQueue = asyncio.Queue(loop=loop) 66 | cookiesPath = os.path.join(os.path.dirname( 67 | os.path.abspath(__file__)), "cookies.txt") 68 | while True: 69 | try: 70 | with open(cookiesPath, "r") as cookiesFile: 71 | for line in cookiesFile.readlines(): 72 | await cookieQueue.put(line.split("_")[-1].strip()) 73 | break 74 | except Exception as error: 75 | if isinstance(error, FileNotFoundError): 76 | input("cookies.txt not found. Press Enter to try again.") 77 | continue 78 | else: 79 | raise UnknownError(error, "loadCookies") 80 | await cookieQueue.put(None) 81 | return cookieQueue 82 | 83 | 84 | def loadProxies(): 85 | proxies = [] 86 | proxiesPath = os.path.join(os.path.dirname( 87 | os.path.abspath(__file__)), "proxies.txt") 88 | while True: 89 | try: 90 | with open(proxiesPath, "r") as proxiesFile: 91 | for line in proxiesFile.readlines(): 92 | proxies.append(line.strip()) 93 | except Exception as error: 94 | if isinstance(error, FileNotFoundError): 95 | input("proxies.txt not found. Press Enter to try again.") 96 | continue 97 | else: 98 | raise UnknownError(error, "loadProxies") 99 | return proxies 100 | 101 | 102 | async def getCSRFToken(securityCookie, proxy): 103 | while True: 104 | try: 105 | async with httpx.AsyncClient(proxies=proxy) as client: 106 | request = await client.post("https://auth.roblox.com/v1/logout", headers={"Cookie": securityCookie}) 107 | except Exception as error: 108 | raise BadProxy(error, proxy) 109 | 110 | try: 111 | return request.headers["x-csrf-token"] 112 | except: 113 | if request.status_code == 429: 114 | continue 115 | elif request.status_code == 401: 116 | raise InvalidCookie( 117 | "An invalid cookie was passed into getCSRFToken", securityCookie) 118 | else: 119 | print( 120 | f"Encountered unknown error in getCSRFToken: {request.status_code} {f'Status Code: {request.status_code}' if request.status_code != None else ''}") 121 | 122 | 123 | async def grabID(securityCookie, proxy): 124 | # https://www.roblox.com/game/GetCurrentUser.ashx 125 | while True: 126 | try: 127 | async with httpx.AsyncClient(proxies=proxy) as client: 128 | request = await client.get("http://www.roblox.com/game/GetCurrentUser.ashx", headers={"Cookie": securityCookie}, timeout=15) 129 | except Exception as error: 130 | print("First error") 131 | print(repr(error)) 132 | traceback.print_exc() 133 | print(error) 134 | print(request) 135 | print(request.text) 136 | print(request.status_code) 137 | raise UnknownError(error, "grabID") 138 | if request.status_code == 403 or request.text == "null": 139 | print("Invalid Cookie test") 140 | raise InvalidCookie("Invalid Cookie in grabID", securityCookie) 141 | elif request.status_code == 429: 142 | print("429 test") 143 | continue 144 | else: 145 | return request.text 146 | 147 | 148 | # async def grabFriends(id, securityCookie, csrfToken): 149 | # friendsList = [] 150 | # while True: 151 | # try: 152 | # async with httpx.AsyncClient() as client: 153 | # request = await client.get(f"https://friends.roblox.com/v1/users/{id}/friends", headers={"Cookie": securityCookie, "X-CSRF-TOKEN": csrfToken}) 154 | # except Exception as error: 155 | # raise UnknownError(error, "grabFriends") 156 | 157 | # try: 158 | # for user in request.json()["data"]: 159 | # friendsList.append(user["id"]) 160 | # except Exception as error: 161 | # if request.status_code == 429: 162 | # continue 163 | # raise UnknownError(error, "grabFriends") 164 | 165 | # return friendsList 166 | 167 | async def gatherData(mainQueue, cookieQueue): 168 | while True: 169 | cookie = await cookieQueue.get() 170 | if cookie == None: 171 | await mainQueue.put(None) 172 | return 173 | 174 | cookie = ".ROBLOSECURITY=_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_" + cookie 175 | 176 | userDataDict = {} 177 | userDataDict["cookie"] = cookie 178 | 179 | global proxyList 180 | proxy = proxyList[0] 181 | del proxyList[0] 182 | proxyList.append(proxy) 183 | proxy = {"all://": f"http://{proxy}"} 184 | userDataDict["proxy"] = proxy 185 | print(proxy) 186 | 187 | try: 188 | id = await grabID(cookie, proxy) 189 | except: 190 | print("Continued grabID") 191 | continue 192 | userDataDict["id"] = id 193 | 194 | try: 195 | token = await getCSRFToken(cookie, proxy) 196 | except: 197 | print("continued csrf") 198 | continue 199 | 200 | userDataDict["token"] = token 201 | 202 | try: 203 | conversationsList = await grabConversations(cookie, token, proxy) 204 | except: 205 | print("Continued conversations") 206 | continue 207 | if conversationsList == []: 208 | continue 209 | userDataDict["conversations"] = conversationsList 210 | 211 | print(f"Added {userDataDict['id']}") 212 | await mainQueue.put(userDataDict) 213 | 214 | 215 | async def grabConversations(securityCookie, csrfToken, proxy): 216 | conversations = [] 217 | page = 1 218 | while True: 219 | try: 220 | async with httpx.AsyncClient(proxies=proxy) as client: 221 | request = await client.get(f"https://chat.roblox.com/v2/get-user-conversations?pageNumber={page}&pageSize=1000", headers={"Cookie": securityCookie, "X-CSRF-TOKEN": csrfToken}) 222 | except Exception as error: 223 | raise UnknownError(error, "grabConversations") 224 | 225 | try: 226 | for conversation in request.json(): 227 | conversations.append(conversation["id"]) 228 | page += 1 229 | except Exception as error: 230 | if request.status_code == 429: 231 | continue 232 | elif request.status_code == 401: 233 | raise InvalidToken("", csrfToken, securityCookie) 234 | else: 235 | print(error) 236 | print(request.text) 237 | raise UnknownError(error, "grabConversations") 238 | 239 | if request.json() == []: 240 | return conversations 241 | 242 | # async def createConversation(user, securityCookie, csrfToken): 243 | # while True: 244 | # try: 245 | # async with httpx.AsyncClient() as client: 246 | # request = await client.post("http://chat.roblox.com/v2/start-one-to-one-conversation", params={"participantUserId": int(user)}, headers={"Cookie": securityCookie, "X-CSRF-TOKEN": csrfToken}) 247 | # except Exception as error: 248 | # raise UnknownError(error, "createConversation") 249 | 250 | # try: 251 | # reqJson = request.json() 252 | # print(reqJson) 253 | # return reqJson["conversation"]["id"] 254 | # except Exception as error: 255 | # if request.status_code == 429: 256 | # continue 257 | # print(request.status_code) 258 | # raise UnknownError(error, "createConversation") 259 | 260 | 261 | async def sendMessage(conversationID, securityCookie, csrfToken, message, proxy): 262 | while True: 263 | try: 264 | async with httpx.AsyncClient(proxies=proxy) as client: 265 | request = await client.post("https://chat.roblox.com/v2/send-message", data={"message": message, "conversationId": conversationID}, headers={"Cookie": securityCookie, "X-CSRF-TOKEN": csrfToken}) 266 | except Exception as error: 267 | raise UnknownError(error, "sendMessage") 268 | 269 | if request.status_code == 200: 270 | if request.json()["statusMessage"] == "Content was moderated. Message not sent.": 271 | print('Message was moderated. Trying again.') 272 | else: 273 | print(f"Successfully sent message {sent}") 274 | return 275 | elif request.status_code == 429: 276 | continue 277 | elif request.status_code == 401: 278 | raise InvalidCookie("", securityCookie) 279 | elif request.status_code == 403: 280 | raise InvalidToken("", csrfToken, securityCookie) 281 | print(request.status_code) 282 | print(request.text) 283 | raise UnknownError( 284 | f"Unknown response code {request.status_code}", "sendMessage") 285 | 286 | 287 | async def messageFriends(mainQueue, message, updateTask): 288 | global sent 289 | global toSend 290 | while True: 291 | userDataDict = await mainQueue.get() 292 | toSend += len(userDataDict["conversations"]) 293 | if userDataDict == None: 294 | updateTask.cancel() 295 | return 296 | print(f"Grabbed {userDataDict['id']}") 297 | for conversationID in userDataDict["conversations"]: 298 | try: 299 | await sendMessage(conversationID, userDataDict["cookie"], userDataDict["token"], message, userDataDict["proxy"]) 300 | sent += 1 301 | toSend -= 1 302 | except Exception as error: 303 | continue 304 | 305 | 306 | async def updateTitle(mainQueue): 307 | while True: 308 | await asyncio.sleep(.25) 309 | try: 310 | system( 311 | "title " + f"Account Queue: {mainQueue.qsize()} - Message Queue: {toSend} - Sent: {sent}") 312 | except Exception as error: 313 | print(error) 314 | 315 | 316 | async def main(loop): 317 | message = loadMessage() 318 | global proxyList 319 | proxyList = loadProxies() 320 | try: 321 | cookieQueue = await loadCookies(loop) 322 | except Exception as error: 323 | raise(error) 324 | 325 | mainQueue = asyncio.Queue(loop=loop, maxsize=3*int(speed)) 326 | global sent 327 | global toSend 328 | sent = 0 329 | toSend = 0 330 | 331 | tasks = [] 332 | 333 | updateTask = asyncio.Task(updateTitle(mainQueue)) 334 | 335 | for i in range(int(speed)): 336 | tasks.append(asyncio.Task(gatherData(mainQueue, cookieQueue))) 337 | tasks.append(asyncio.Task(messageFriends( 338 | mainQueue, message, updateTask))) 339 | tasks.append(updateTask) 340 | await asyncio.wait(tasks) 341 | 342 | if __name__ == "__main__": 343 | loop = asyncio.get_event_loop() 344 | loop.run_until_complete(main(loop)) 345 | loop.close() 346 | print("All Operations Completed.") 347 | input("Press enter to exit.") 348 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "threads":"200" 3 | } 4 | -------------------------------------------------------------------------------- /cookies.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /message.txt: -------------------------------------------------------------------------------- 1 | join the dispord .gg/acier 2 | -------------------------------------------------------------------------------- /proxies.txt: -------------------------------------------------------------------------------- 1 | http/s proxies here 2 | --------------------------------------------------------------------------------