diff --git a/main.py b/main.py index f938804..5a31352 100644 --- a/main.py +++ b/main.py @@ -59,13 +59,13 @@ def log_output(self): output = "" for item in self.output_format.split(":"): if "token" in item and self.token: - output += self.token + ":" + output += f"{self.token}:" if "email" in item and self.email: - output += self.email + ":" + output += f"{self.email}:" if "pass" in item: - output += self.browser.faker.password + ":" + output += f"{self.browser.faker.password}:" if "proxy" in item and self.browser.proxy: - output += self.browser.proxy + ":" + output += f"{self.browser.proxy}:" # Remove last : output = output[:-1] @@ -102,7 +102,6 @@ async def generate_unclaimed(self): await self.page.click("[class *= 'checkbox']", timeout=10000) except Exception as e: self.logger.debug("No TOS Checkbox was detected") - pass await self.page.click('[class *= "gtm-click-class-register-button"]') # Solving Captcha @@ -174,7 +173,6 @@ async def generate_unclaimed(self): await self.close() - # Catch Exceptions and save output anyways except: self.logger.error(f"Catched Exception, trying to save Token anyways... \n Error: \n {traceback.format_exc()}") if self.output: @@ -213,7 +211,6 @@ async def generate_token(self): await tos_box.click() except Exception as e: self.logger.debug("No TOS Checkbox was detected") - pass await self.page.click('[type="submit"]') await self.page.solve_hcaptcha() @@ -269,7 +266,6 @@ async def generate_token(self): await self.close() - # Catch Exceptions and save output anyways except: self.logger.error(f"Catched Exception, trying to save Token anyways... \n Error: \n{traceback.format_exc()}") if self.output: @@ -329,7 +325,7 @@ async def main(): if email not in ("1", "2"): raise ValueError("Invalid Mode provided") else: - email = True if email == "1" else False + email = email == "1" else: email = False @@ -339,7 +335,7 @@ async def main(): if humanize not in ("1", "2"): raise ValueError("Invalid Mode provided") else: - humanize = True if humanize == "1" else False + humanize = humanize == "1" else: humanize = False @@ -349,9 +345,11 @@ async def main(): except: raise ValueError("Invalid ThreadAmount provided") - proxy_file = input("[Drag&Drop] - [Proxy File]\n" + - " Or Leave empty for Proxyless Mode\n" + " ").replace('"', "") - if proxy_file: + if proxy_file := input( + "[Drag&Drop] - [Proxy File]\n" + + " Or Leave empty for Proxyless Mode\n" + + " " + ).replace('"', ""): if not os.path.isfile(proxy_file): raise ValueError("Provided ProxyPath isnt a file!") proxies = open(proxy_file, 'r').readlines() diff --git a/modules/discord.py b/modules/discord.py index 8ce0310..e82e217 100644 --- a/modules/discord.py +++ b/modules/discord.py @@ -25,7 +25,7 @@ async def get_headers(self, payload): super_props = {"os": platform.system(), "browser":"Firefox", "release_channel":"stable", "client_version": self.browser.browser.version, "os_version": str(platform.version()), "os_arch": "x64" if platform.machine().endswith('64') else "x86", "system_locale": self.browser.faker.locale, "client_build_number": DISCORD_BUILD_NUM, "client_event_source": None} super_props = base64.b64encode(str(super_props).encode()).decode() - headers = { + return { "accept": "*/*", "accept-encoding": "gzip, deflate, br", "accept-language": "de,de-DE;q=0.9", @@ -42,7 +42,6 @@ async def get_headers(self, payload): "x-discord-locale": "en", "x-super-properties": super_props, } - return headers async def humanize_token(self): await self.page.goto("https://discord.com/channels/@me") @@ -122,7 +121,7 @@ async def humanize_token(self): return self.log_output() - self.logger.info(f"Set Bio and ProfilePic!") + self.logger.info("Set Bio and ProfilePic!") async def join_server(self): await self.page.goto("https://discord.com/channels/@me") diff --git a/modules/tempmail.py b/modules/tempmail.py index 455b159..55bb83f 100644 --- a/modules/tempmail.py +++ b/modules/tempmail.py @@ -16,34 +16,32 @@ class TempMail: The content of the request is a json string and is returned as a string object """ - def makeHTTPRequest(endpoint): + def makeHTTPRequest(self): headers = { "User-Agent": "TempMailPythonAPI/1.0", "Accept": "application/json" } try: - connection = httpx.get(BASE_URL + endpoint, headers=headers) + connection = httpx.get(BASE_URL + self, headers=headers) if connection.status_code >= 400: - raise Exception("HTTP Error: " + str(connection.status_code)) + raise Exception(f"HTTP Error: {str(connection.status_code)}") except Exception as e: print(e) return None - response = connection.text - - return response + return connection.text """ GenerateInbox will generate an inbox with an address and a token and returns an Inbox object > rush = False will generate a normal inbox with no rush (https://tempmail.lol/news/2022/08/03/introducing-rush-mode-for-tempmail/) """ - def generateInbox(rush=False): + def generateInbox(self): try: random_domain = random.choice(DOMAINS) s = TempMail.makeHTTPRequest(f"/generate/{random_domain}") except: - print("Website responded with: " + s) + print(f"Website responded with: {s}") data = json.loads(s) return Inbox(data["address"], data["token"]) @@ -51,8 +49,8 @@ def generateInbox(rush=False): getEmail gets the emails from an inbox object and returns a list of Email objects """ - def getEmails(inbox): - s = TempMail.makeHTTPRequest("/auth/" + inbox.token) + def getEmails(self): + s = TempMail.makeHTTPRequest(f"/auth/{self.token}") data = json.loads(s) # Raise an exception if the token is invalid @@ -62,14 +60,20 @@ def getEmails(inbox): # if no emails are found, return an empty list # else return a list of email - if data["email"] == None: + if data["email"] is None: return ["None"] else: - emails = [] - for email in data["email"]: - emails.append(Email( - email["from"], email["to"], email["subject"], email["body"], email["html"], email["date"])) - return emails + return [ + Email( + email["from"], + email["to"], + email["subject"], + email["body"], + email["html"], + email["date"], + ) + for email in data["email"] + ] class Email: def __init__(self, sender, recipient, subject, body, html, date): @@ -106,8 +110,7 @@ def date(self): return self._date def __repr__(self): - return ("Email (sender={}, recipient={}, subject={}, body={}, html={}, date={} )" - .format(self.sender, self.recipient, self.subject, self.body, self.html, self.date)) + return f"Email (sender={self.sender}, recipient={self.recipient}, subject={self.subject}, body={self.body}, html={self.html}, date={self.date} )" class Inbox: def __init__(self, address, token): @@ -124,5 +127,4 @@ def token(self): return self._token def __repr__(self): - return ("Inbox (address={}, token={} )" - .format(self.address, self.token)) \ No newline at end of file + return f"Inbox (address={self.address}, token={self.token} )" \ No newline at end of file