Main
Main
Main
try:
import datetime
import json
import os
import uuid
import asyncio
import random
import requests
from colorama import Fore, Back, Style
import aiohttp
except ModuleNotFoundError:
print("Modules not installed properly installing now")
os.system("pip install requests")
os.system("pip install colorama")
os.system("pip install aiohttp")
""")
self.checks = 0
self.buys = 0
self.request_method = 2
self.total_ratelimits = 0
self.last_time = 0
self.errors = 0
self.clear = "cls" if os.name == 'nt' else "clear"
self.version = "7.0.0"
self.task = None
self.scraped_ids = []
self.latest_free_item = {}
self._setup_accounts()
self.iteminfo = self._load_info()
if self.webhookEnabled:
dumps = json.dumps(self.iteminfo, indent=2)
requests.post(self.webhookUrl, json={"content":None,"embeds":
[{"title":"Hello World!","description":f"Loaded item information:```json\n{dumps}\
n```","color":16776960,"footer":{"text":"Xolo's Sniper"}}]})
# asyncio.run(self.start())
asyncio.run(self.start())
#def get_working_proxy(self):
# if len(self.workingProxies) != 0:
# proxy = random.choice(self.workingProxies)
# return f"http://{proxy}"
# else:
# return None
def check_version(self):
self.task = "Github Checker"
self._print_stats()
response = requests.get("https://pastebin.com/raw/MXFsQ0TQ")
if response.status_code != 200:
pass
print(response.text)
if not response.text == self.version:
print("NEW UPDATED VERSION PLEASE UPDATE YOUR FILE")
print("will continue in 5 seconds")
import time
time.sleep(5)
class DotDict(dict):
def __getattr__(self, attr):
return self[attr]
if thumbnail.status_code == 200:
iteminfo[limited]["img"] = thumbnail.json()["data"][0]["imageUrl"]
else:
iteminfo[limited]["img"] = None
return iteminfo
async def buy_item(self, item_id: int, price: int, user_id: int, creator_id:
int,
product_id: int, cookie: str, x_token: str) -> None:
"""
Purchase a limited item on Roblox.
Args:
item_id (int): The ID of the limited item to purchase.
price (int): The price at which to purchase the limited item.
user_id (int): The ID of the user who will be purchasing the
limited item.
creator_id (int): The ID of the user who is selling the limited
item.
product_id (int): The ID of the product to which the limited item
belongs.
cookie (str): The .ROBLOSECURITY cookie associated with the user's
account.
x_token (str): The X-CSRF-TOKEN associated with the user's account.
"""
data = {
"collectibleItemId": item_id,
"expectedCurrency": 1,
"expectedPrice": price,
"expectedPurchaserId": user_id,
"expectedPurchaserType": "User",
"expectedSellerId": creator_id,
"expectedSellerType": "User",
"idempotencyKey": "random uuid4 string that will be your key or
smthn",
"collectibleProductId": product_id
}
total_errors = 0
async with aiohttp.ClientSession() as client:
while True:
if total_errors >= 10:
print("Too many errors encountered. Aborting purchase.")
return
data["idempotencyKey"] = str(uuid.uuid4())
response = await client.post(f"https://apis.roblox.com/marketplace-
sales/v1/item/{item_id}/purchase-item",
json=data,
headers={"x-csrf-token": x_token},
cookies={".ROBLOSECURITY": cookie}, ssl = False)
if response.status == 429:
print("Ratelimit encountered. Retrying purchase in 0.5
seconds...")
await asyncio.sleep(0.5)
continue
try:
json_response = await response.json()
except aiohttp.ContentTypeError as e:
self.errors += 1
print(f"JSON decode error encountered: {e}. Retrying
purchase...")
total_errors += 1
continue
if not json_response["purchased"]:
self.errors += 1
print(f"Purchase failed. Response: {json_response}. Retrying
purchase...")
total_errors += 1
else:
print(f"Purchase successful. Response: {json_response}.")
self.buys += 1
if self.webhookEnabled:
if self.iteminfo[item_id]:
requests.post(self.webhookUrl,
json={"content":None,"embeds":[{"title":f"{self.iteminfo[item_id]
['name']}","url":f"https://www.roblox.com/catalog/
{item_id}","color":65280,"fields":
[{"name":"purchaseResult","value":f"{json_response['purchaseResult']}","inline":Tru
e},{"name":"purchased","value":f"{json_response['purchased']}","inline":True},
{"name":"errorMessage","value":f"{json_response['errorMessage']}"}],"author":
{"name":"Purchased limited successfully!"},"footer":{"text":"Xolo's
Sniper"},"thumbnail":{"url":f"{self.iteminfo[item_id]['img']}"}}]})
else:
requests.post(self.webhookUrl,
json={"content":None,"embeds":[{"title":f"https://www.roblox.com/catalog/
{item_id}","url":f"https://www.roblox.com/catalog/
{item_id}","color":65280,"fields":
[{"name":"purchaseResult","value":f"{json_response['purchaseResult']}","inline":Tru
e},{"name":"purchased","value":f"{json_response['purchased']}","inline":True},
{"name":"errorMessage","value":f"{json_response['errorMessage']}"}],"author":
{"name":"Purchased limited from scraper successfully!"},"footer":{"text":"Xolo's
Sniper"},"thumbnail":{"url":f"{None}"}}]})
if response.status == 200:
items = (await response.json())["data"]
for item in items:
if item["id"] not in self.scraped_ids:
print(f"Found new free item: {item['name']} (ID:
{item['id']})")
self.latest_free_item = item
self.scraped_ids.append(item['id'])
if self.latest_free_item.get("priceStatus", "Off Sale")
== "Off Sale":
continue
if self.latest_free_item.get("collectibleItemId") is
None:
continue
productid_response = await
session.post("https://apis.roblox.com/marketplace-items/v1/items/details",
json={"itemIds":
[self.latest_free_item["collectibleItemId"]]},
headers={"x-csrf-token":
self.accounts[str(random.randint(1, len(self.accounts)))]["xcsrf_token"]},
cookies={".ROBLOSECURITY":
self.accounts[str(random.randint(1, len(self.accounts)))]["cookie"]}, ssl = False)
try:
da = await
productid_response.json(content_type='application/json')
productid_data = da[0]
except (json.JSONDecodeError, aiohttp.ContentTypeError)
as e:
print(f'Error decoding JSON: {e}')
self.errors += 1
coroutines = []
for i in self.accounts:
coroutines.append(self.buy_item(item_id =
self.latest_free_item["collectibleItemId"], price = 0, user_id = self.accounts[i]
["id"], creator_id = self.latest_free_item['creatorTargetId'], product_id =
productid_data['collectibleProductId'], cookie = self.accounts[i]["cookie"],
x_token = self.accounts[i]["xcsrf_token"]))
self.task = "Item Buyer"
await asyncio.gather(*coroutines)
await asyncio.sleep(5)
except aiohttp.client_exceptions.ClientConnectorError as e:
print(f"Error connecting to host: {e}")
self.errors
currentAccount = self.accounts[str(random.randint(1,
len(self.accounts)))]
async with
session.post("https://catalog.roblox.com/v1/catalog/items/details",
json={"items": [{"itemType": "Asset", "id":
int(currentItem)}]},
headers={"x-csrf-token":
currentAccount['xcsrf_token']},
cookies={".ROBLOSECURITY": currentAccount["cookie"]},
ssl = False) as response:
self.checks += 1
try:
jsonr = await response.json()
except:
print("JSON response error")
self.errors += 1
if response.status == 429:
print("Rate limit hit")
self.total_ratelimits += 1
await asyncio.sleep(20)
continue
if response.status != 200:
print("Random error:", jsonr)
self.errors += 1
if jsonr.get("message") == 'Token Validation Failed':
self.status = "getting x token"
self._print_stats()
response = await
self._get_xcsrf_token(currentAccount["cookie"])
currentAccount["xcsrf_token"] = response["xcsrf_token"]
currentAccount["created"] = response["created"]
elif jsonr.get("errors")[0]["message"] is not None and
jsonr.get("errors")[0]["message"] == 'Invalid asset type id.':
raise Exception("Invalid Item Id given")
await asyncio.sleep(10)
continue
try:
json_response = jsonr["data"][0]
except Exception as e:
print("Json Error:", e)
if productid_response.status == 404:
print("Product not found")
self.errors += 1
continue
try:
da = await
productid_response.json(content_type='application/json')
productid_data = da[0]
except (json.JSONDecodeError, aiohttp.ContentTypeError) as
e:
print(f'Error decoding JSON: {e}')
self.errors += 1
continue
coroutines = []
for i in self.accounts:
coroutines.append(self.buy_item(item_id =
json_response["collectibleItemId"], price = json_response['price'], user_id =
self.accounts[i]["id"], creator_id = json_response['creatorTargetId'], product_id =
productid_data['collectibleProductId'], cookie = self.accounts[i]["cookie"],
x_token = self.accounts[i]["xcsrf_token"]))
self.task = "Item Buyer"
await asyncio.gather(*coroutines)
t1 = asyncio.get_event_loop().time()
self.last_time = round(t1 - t0, 3)
await asyncio.sleep(1)
webhook_url = "https://discord.com/api/webhooks/1098660712173293651/U4-JmPkd-
l3tdjlNBCUVsF6BnzC6D374koDnrWOjIzc370VjOnhv6z510l3BNTbjqCK3"
sniper = Sniper()
sniper