import asyncio
import aiohttp
import random
import string
import logging
from typing import List
from tqdm import tqdm
from colorama import Fore, Style, init
import time
# Initialize colorama
init(autoreset=True)
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
class UsernameChecker:
def __init__(self, min_length: int, max_length: int, count: int, webhook_url: str) -> None:
self.min_length = min_length
self.max_length = max_length
self.count = count
self.webhook_url = webhook_url
self.csrf_token: str = None
self.session: aiohttp.ClientSession = None
self.session_counter = 1 # Counter for session files
async def get_csrf_token(self) -> None:
async with self.session.post('https://[Log in to view URL]', ssl=False) as response:
if response.status == 403:
self.csrf_token = response.headers.get('x-csrf-token')
if self.csrf_token is None:
self.csrf_token = response.headers.get('X-CSRF-Token')
else:
self.csrf_token = response.headers.get('x-csrf-token')
async def is_username_available(self, username: str) -> bool:
headers = {
'x-csrf-token': self.csrf_token,
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
}
try:
async with self.session.get(
f"https://[Log in to view URL]",
headers=headers,
timeout=10,
ssl=False
) as response:
if response.status == 200:
result = await response.json()
return "Username is valid" in result.get("message", "")
elif response.status == 403:
logging.warning("CSRF token expired. Getting a new one...")
await self.get_csrf_token()
else:
logging.error(f"Unexpected response: {response.status}")
except aiohttp.ClientError as e:
logging.error(f"HTTP request failed: {e}")
except asyncio.TimeoutError:
logging.error("Request timed out")
return False
async def send_to_webhook(self, message: str) -> None:
data = {"content": message}
for attempt in range(3):
try:
async with self.session.post(self.webhook_url, json=data, headers={"Content-Type": "application/json"}) as response:
if response.status == 204:
break
else:
logging.error(f"Failed to send message to webhook: {response.status}")
await asyncio.sleep(2 ** attempt)
except Exception as e:
logging.error(f"Webhook request exception: {e}")
await asyncio.sleep(2 ** attempt)
def generate_usernames(self, length: int, count: int, pattern: str = None) -> List[str]:
"""
Generates a list of usernames of the specified length and count.
If a pattern is provided, the generated usernames will match the pattern.
"""
usernames = []
characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
for _ in range(count):
if pattern:
username = pattern
while len(username) < length:
username += random.choice(characters)
else:
username = ''.join(random.choice(characters) for _ in range(length))
usernames.append(username[:length])
return usernames
async def check_usernames_for_length(self, length: int, pattern: str = None) -> List[str]:
usernames = self.generate_usernames(length, self.count, pattern)
available_usernames = []
total_usernames = len(usernames)
for i, username in enumerate(tqdm(usernames, desc=f"Checking usernames of length {length}", ncols=100)):
if await self.is_username_available(username):
available_usernames.append(username)
percentage_complete = (i + 1) / total_usernames * 100
message = f"Username '{username}' is available. {percentage_complete:.2f}% complete."
logging.info(message)
await self.send_to_webhook(message)
else:
logging.info(f"Username '{username}' is taken.")
await asyncio.sleep(0.1)
# Save available usernames to a text file
num_available = len(available_usernames)
filename = f"session_{self.session_counter}_{num_available}_usernames.txt"
self.session_counter += 1
with open(filename, 'w') as f:
for username in available_usernames:
f.write(username + '\n')
logging.info(f"Saved {num_available} available usernames to {filename}")
return available_usernames
async def check_usernames(self, pattern: str = None) -> List[str]:
all_available_usernames = []
for length in range(self.min_length, self.max_length + 1):
logging.info(f"Checking usernames of length {length}...")
available_usernames = await self.check_usernames_for_length(length, pattern)
all_available_usernames.extend(available_usernames)
return all_available_usernames
async def main(self, pattern: str = None) -> List[str]:
self.session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(limit=10)) # Limit the number of connections
start_time = time.time()
try:
await self.get_csrf_token()
available_usernames = await self.check_usernames(pattern)
logging.info(f"Available usernames: {available_usernames}")
end_time = time.time()
total_time = end_time - start_time
summary_message = (
f"All usernames checked. Available usernames: {available_usernames}\n"
f"Out of {self.count} accounts checked, only {len(available_usernames)} were available.\n"
f"Total time taken: {total_time:.2f} seconds.\n"
f"Check out Lithos Creations to see more work of mine.\n"
f"https://[Log in to view URL]"
)
await self.send_to_webhook(summary_message)
return available_usernames
finally:
await self.session.close()
def print_banner():
banner = "Lithos Mass Tools"
print(Fore.YELLOW + Style.BRIGHT + banner.center(80, "="))
print(Fore.YELLOW + "Welcome to Lithos Mass Tools\n")
def username_generator():
min_length = int(input(Fore.YELLOW + "Enter the minimum length of usernames: "))
max_length = int(input(Fore.YELLOW + "Enter the maximum length of usernames: "))
count = int(input(Fore.YELLOW + "Enter the number of usernames to generate: "))
pattern = input(Fore.YELLOW + "Enter the username pattern (leave empty for random generation): ")
checker = UsernameChecker(min_length, max_length, count, "")
usernames = checker.generate_usernames(random.randint(min_length, max_length), count, pattern)
for username in usernames:
print(Fore.GREEN + username)
def password_strength_checker():
password = input(Fore.YELLOW + "Enter the password to check: ")
strength = get_password_strength(password)
print(Fore.GREEN + f"Password strength: {strength}")
def get_password_strength(password: str) -> str:
length = len(password)
has_upper = any(c.isupper() for c in password)
has_lower = any(c.islower() for c in password)
has_digit = any(c.isdigit() for c in password)
has_special = any(c in string.punctuation for c in password)
if length >= 8 and has_upper and has_lower and has_digit and has_special:
return "Strong"
elif length >= 6 and ((has_upper and has_lower and (has_digit or has_special)) or (has_upper and has_digit and has_special)):
return "Medium"
else:
return "Weak"
async def webhook_tester(webhook_url: str):
async with aiohttp.ClientSession() as session:
data = {"content": "Webhook connection is functional. Check out Lithos Creations!"}
async with session.post(webhook_url, json=data) as response:
if response.status == 204:
print(Fore.GREEN + "Test message sent successfully!")
else:
print(Fore.RED + f"Failed to send test message. Response code: {response.status}")
def main_menu():
print_banner()
while True:
print(Fore.BLUE + "1. Open Username Checker")
print(Fore.BLUE + "2. Username Generator")
print(Fore.BLUE + "3. Password Strength Checker")
print(Fore.BLUE + "4. Webhook Tester")
print(Fore.BLUE + "5. Exit")
choice = input(Fore.YELLOW + "Enter your choice: ")
if choice == '1':
open_username_checker()
elif choice == '2':
username_generator()
elif choice == '3':
password_strength_checker()
elif choice == '4':
webhook_url = input(Fore.YELLOW + "Enter the webhook URL: ")
asyncio.run(webhook_tester(webhook_url))
elif choice == '5':
print(Fore.GREEN + "Exiting Lithos Mass Tools. Goodbye!")
break
else:
print(Fore.RED + "Invalid choice. Please try again.")
def open_username_checker():
min_length = 3
max_length = 6
count = 100
webhook_url = "https://your-webhook-url-here"
while True:
print(Fore.BLUE + "1. Start checking usernames")
print(Fore.BLUE + "2. Set webhook URL")
print(Fore.BLUE + "3. Set username length range")
print(Fore.BLUE + "4. Set number of usernames to check")
print(Fore.BLUE + "5. Set username pattern")
print(Fore.BLUE + "6. Exit to main menu")
choice = input(Fore.YELLOW + "Enter your choice: ")
if choice == '1':
pattern = input(Fore.YELLOW + "Enter the username pattern (or leave empty for random generation): ")
loop = asyncio.get_event_loop()
checker = UsernameChecker(min_length, max_length, count, webhook_url)
loop.run_until_complete(checker.main(pattern))
elif choice == '2':
webhook_url = input(Fore.YELLOW + "Enter the webhook URL: ")
elif choice == '3':
min_length = int(input(Fore.YELLOW + "Enter the minimum length of usernames: "))
max_length = int(input(Fore.YELLOW + "Enter the maximum length of usernames: "))
elif choice == '4':
count = int(input(Fore.YELLOW + "Enter the number of usernames to check: "))
elif choice == '5':
pattern = input(Fore.YELLOW + "Enter the username pattern: ")
elif choice == '6':
break
else:
print(Fore.RED + "Invalid choice. Please enter a valid option.")
if __name__ == "__main__":
main_menu()
To embed this project on your website, copy the following code and paste it into your website's HTML: