From 4c81ee337cc404eea48d12ad8f6062eba63e24eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D1=83=D0=BA=D0=B0?= <164436043+ghluka@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:45:45 -0500 Subject: [PATCH] Colour + bug fixes + removed broken checkers --- src/checkers/beacons-ai.py | 37 ------------------------------------- src/checkers/gitlab.py | 25 ------------------------- src/checkers/instagram.py | 28 ---------------------------- src/checkers/lichess.py | 2 +- src/checkers/roblox.py | 2 +- src/checkers/x.py | 28 ---------------------------- src/main.py | 14 ++++++++------ src/requirements.txt | 3 ++- src/utils/output.py | 13 ++++++++++++- src/utils/prompts.py | 13 +++++++++---- src/utils/proxies.py | 3 ++- 11 files changed, 35 insertions(+), 133 deletions(-) delete mode 100644 src/checkers/beacons-ai.py delete mode 100644 src/checkers/gitlab.py delete mode 100644 src/checkers/instagram.py delete mode 100644 src/checkers/x.py diff --git a/src/checkers/beacons-ai.py b/src/checkers/beacons-ai.py deleted file mode 100644 index 20380f9..0000000 --- a/src/checkers/beacons-ai.py +++ /dev/null @@ -1,37 +0,0 @@ -"""https://beacons.ai/ -""" -import time - -import httpx -from httpx._models import Response - -from base.checker import BaseChecker - - -class Checker(BaseChecker): - ENDPOINT = "https://account.beacons.ai/api/user_profile" - - @BaseChecker.check.register - def _(self, username:str, proxies:str="") -> str|None: - proxies = self.get_proxy(proxies) - - if len(username) > 30: - return None - elif username.startswith(".") or username.endswith(".") or ".." in username: - return None - elif "__" in username: - return None - elif not all(c.isalnum() and c.isascii() or c in "_." for c in username): - return None - - headers = {"X-Beacons-Application-Viewed": "web", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0"} - payload = {"new_username": username, "action": "is_username_taken"} - - r = Response(429) - while r.status_code == 429: - with httpx.Client(verify=False, proxies=proxies) as client: - r = client.post(self.ENDPOINT, json=payload, headers=headers) - if r.status_code == 429: - time.sleep(self.RATELIMIT_TIMEOUT) - - return username if r.json()["username_taken"] is False else None diff --git a/src/checkers/gitlab.py b/src/checkers/gitlab.py deleted file mode 100644 index 87d9c18..0000000 --- a/src/checkers/gitlab.py +++ /dev/null @@ -1,25 +0,0 @@ -"""https://gitlab.com/ -""" -import time - -import httpx -from httpx._models import Response - -from base.checker import BaseChecker - - -class Checker(BaseChecker): - ENDPOINT = "https://gitlab.com/users/" - - @BaseChecker.check.register - def _(self, username:str, proxies:str="") -> str|None: - proxies = self.get_proxy(proxies) - - r = Response(429) - while r.status_code == 429: - with httpx.Client(verify=False, proxies=proxies) as client: - r = client.get(f"{self.ENDPOINT}{username}/exists") - if r.status_code == 429: - time.sleep(self.RATELIMIT_TIMEOUT) - - return username if r.json()["exists"] is False else None diff --git a/src/checkers/instagram.py b/src/checkers/instagram.py deleted file mode 100644 index b9138ff..0000000 --- a/src/checkers/instagram.py +++ /dev/null @@ -1,28 +0,0 @@ -"""https://instagram.com/ -""" -import time - -import httpx -from httpx._models import Response - -from base.checker import BaseChecker - - -class Checker(BaseChecker): - ENDPOINT = "https://www.instagram.com/api/v1/web/accounts/web_create_ajax/attempt/" - - @BaseChecker.check.register - def _(self, username:str, proxies:str="") -> str|None: - proxies = self.get_proxy(proxies) - - headers = {"X-CSRFToken": "en"} - payload = {"email": "", "username": username, "first_name": "", "opt_into_one_tap": False} - - r = Response(429) - while r.status_code == 429: - with httpx.Client(verify=False, proxies=proxies) as client: - r = client.post(self.ENDPOINT, data=payload, headers=headers) - if r.status_code == 429: - time.sleep(self.RATELIMIT_TIMEOUT) - - return username if not "\"username\": [{\"message\": " in r.text else None diff --git a/src/checkers/lichess.py b/src/checkers/lichess.py index e4b432d..d9cad35 100644 --- a/src/checkers/lichess.py +++ b/src/checkers/lichess.py @@ -24,4 +24,4 @@ def _(self, username:str, proxies:str="") -> str|None: if r.status_code == 429: time.sleep(self.RATELIMIT_TIMEOUT) - return username if r.json() is False else None + return username if r.text == "false" else None diff --git a/src/checkers/roblox.py b/src/checkers/roblox.py index 88988e6..d0fcb1e 100644 --- a/src/checkers/roblox.py +++ b/src/checkers/roblox.py @@ -22,4 +22,4 @@ def _(self, username:str, proxies:str="") -> str|None: if r.status_code == 429: time.sleep(self.RATELIMIT_TIMEOUT) - return username if r.json()['code'] == 0 else None + return username if r.json().get('code') == 0 else None diff --git a/src/checkers/x.py b/src/checkers/x.py deleted file mode 100644 index 3d2d0da..0000000 --- a/src/checkers/x.py +++ /dev/null @@ -1,28 +0,0 @@ -"""https://x.com/ -""" -import time - -import httpx -from httpx._models import Response - -from base.checker import BaseChecker - - -class Checker(BaseChecker): - ENDPOINT = "https://api.twitter.com/i/users/username_available.json?username=" - - @BaseChecker.check.register - def _(self, username:str, proxies:str="") -> str|None: - proxies = self.get_proxy(proxies) - - r = Response(429) - while r.status_code == 429: - with httpx.Client(verify=False, proxies=proxies) as client: - r = client.get(f"{self.ENDPOINT}{username}") - if r.status_code == 429: - time.sleep(self.RATELIMIT_TIMEOUT) - elif not r.json().get("valid"): - r = Response(429) # API failed to respond, retry. - - #print(r.json()) - return username if r.json()["valid"] else None diff --git a/src/main.py b/src/main.py index 3c924f3..1b3c6b1 100644 --- a/src/main.py +++ b/src/main.py @@ -5,6 +5,8 @@ import pathlib import time +from colorama import Fore + from utils.checkers import get_checker, path from utils.output import clear, title from utils.prompts import bool_input, select_checker, select_file @@ -19,20 +21,20 @@ def main(): try: # Service selector checker_name = select_checker() - print(f"\nSelected {checker_name.capitalize()}.") + print(f"\nSelected {Fore.CYAN}{checker_name.capitalize()}{Fore.RESET}.") checker = get_checker(checker_name) # Username list selector - print("\nSelect your usernames list.") + print(f"\n{Fore.BLUE}>{Fore.RESET} Select your usernames list.") usernames = select_file() - print(f"Selected {len(usernames)} usernames from list.") + print(f"Selected {Fore.CYAN}{len(usernames)}{Fore.RESET} usernames from list.") # Proxy selector proxies = [] if bool_input("\nUse proxies?", False): - print("Select your proxy list.") + print(f"{Fore.BLUE}>{Fore.RESET} Select your proxy list.") proxies = select_file() - print(f"Loaded {len(proxies)} proxies.") + print(f"Loaded {Fore.CYAN}{len(proxies)}{Fore.RESET} proxies.") # Get hits print("\nStarting...") @@ -44,7 +46,7 @@ def main(): hits.remove(None) elapsed = time.perf_counter() - start - print(f"Done! Took {elapsed:.2f}s") + print(f"{Fore.CYAN}Done!{Fore.RESET} Took {elapsed:.2f}s") # Save hits pathlib.Path(f"{path}/hits").mkdir(exist_ok=True) diff --git a/src/requirements.txt b/src/requirements.txt index 7922838..f9a67ac 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -1 +1,2 @@ -httpx \ No newline at end of file +httpx +colorama \ No newline at end of file diff --git a/src/utils/output.py b/src/utils/output.py index 383e437..29ff959 100644 --- a/src/utils/output.py +++ b/src/utils/output.py @@ -2,6 +2,8 @@ """ import os +from colorama import Fore + def clear() -> None: """Clears screen""" @@ -11,12 +13,15 @@ def clear() -> None: def title() -> None: """Outputs title as ASCII art""" print( + Fore.CYAN + \ " ██ ██ █████ ██████ \n" \ " ██ ██ ██ ██ ██ \n" \ " ██ ██ ███████ ██ \n" \ " ██ ██ ██ ██ ██ \n" \ " ██████ ██ ██ ██████ \n" \ - "Username Availability Checker" + "\n" + + Fore.BLUE + \ + "Username Availability Checker" + "\n" \ + + Fore.RESET ) @@ -30,3 +35,9 @@ def print_columns(values:list, columns:int=3, start:str="", end:str="\n") -> Non out += f"\n{start}" if i % columns == 0 else " " print(out, end=end) + + +if __name__ == "__main__": + clear() + title() + print_columns(["a", "b", "c", "d", "e", "F", "g", "H"]) diff --git a/src/utils/prompts.py b/src/utils/prompts.py index 5d1eef6..8063bd0 100644 --- a/src/utils/prompts.py +++ b/src/utils/prompts.py @@ -3,6 +3,8 @@ import tkinter as tk from tkinter import filedialog +from colorama import Fore + from utils.checkers import get_checkers, path from utils.output import print_columns @@ -17,10 +19,10 @@ def select_checker() -> str: print(f"Checkers ({len(checkers)}):") print_columns(checkers, start=" ", end="\n") - name = input("Which checker do you want to use: ") + name = input(f"{Fore.BLUE}>{Fore.RESET} Which checker do you want to use: ") while name.capitalize() not in checkers: - print(" Invalid checker! Try again.\n") - name = input("Which checker do you want to use: ") + print(f"{Fore.RED}Invalid checker! Try again.{Fore.RESET}\n") + name = input(f"{Fore.BLUE}>{Fore.RESET} Which checker do you want to use: ") return name @@ -42,7 +44,10 @@ def select_file() -> str: def bool_input(input_prompt:str, default:bool=True) -> bool: """Prompts user for a bool.""" - input_str:str = input(input_prompt + f" ({'Y/n' if default else 'y/N'}): ") + input_str = "\n" if input_prompt.startswith("\n") else "" + input_prompt = input_prompt.lstrip("\n") + input_str += f"{Fore.BLUE}>{Fore.RESET} {input_prompt} ({'Y/n' if default else 'y/N'}): " + input_str = input(input_str) if input_str.lower().startswith("y"): return True diff --git a/src/utils/proxies.py b/src/utils/proxies.py index 18f752b..a168b94 100644 --- a/src/utils/proxies.py +++ b/src/utils/proxies.py @@ -1,6 +1,7 @@ """Proxy utils. """ import httpx +from colorama import Fore def test_proxy(proxy:str) -> bool: @@ -23,7 +24,7 @@ def get_proxy(proxies:list) -> dict: if test_proxy(proxy): return {"http://":f"{proxy}", "https://":f"{proxy}"} - print("No valid proxy in your provided list! Make sure you're using HTTP proxies and not SOCK5.") + print(f"{Fore.RED}No valid proxy in your provided list! Make sure you're using HTTP proxies and not SOCK5.{Fore.RESET}") exit(1)