import asyncio
import aiohttp
import random
import logging
from typing import List
from time import time
# 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
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}
try:
async with self.session.post(self.webhook_url, json=data, headers={"Content-Type": "application/json"}) as response:
if response.status != 204:
logging.error(f"Failed to send message to webhook: {response.status}")
except Exception as e:
logging.error(f"Webhook request exception: {e}")
def generate_usernames(self, length: int, count: int) -> List[str]:
usernames = []
characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
for _ in range(count):
username = ''.join(random.choice(characters) for _ in range(length))
usernames.append(username)
return usernames
async def check_usernames_for_length(self, length: int) -> List[str]:
usernames = self.generate_usernames(length, self.count)
available_usernames = []
for username in usernames:
if await self.is_username_available(username):
available_usernames.append(username)
message = f"Username '{username}' is available."
logging.info(message)
await self.send_to_webhook(message)
else:
logging.info(f"Username '{username}' is taken.")
await asyncio.sleep(0.1)
return available_usernames
async def check_usernames(self) -> 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)
all_available_usernames.extend(available_usernames)
return all_available_usernames
async def main(self) -> List[str]:
self.session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(limit=10)) # Limit the number of connections
start_time = time()
try:
await self.get_csrf_token()
available_usernames = await self.check_usernames()
total_time = time() - start_time
summary_message = (
f"All usernames checked.\n"
f"Available usernames: {available_usernames}\n"
f"Check out Lithos Creations to see more work of mine.\n"
f"https://[Log in to view URL]"
f"Total time taken: {total_time:.2f} seconds."
)
logging.info(summary_message)
await self.send_to_webhook(summary_message)
return available_usernames
finally:
await self.session.close()
def main_menu():
min_length = 3
max_length = 6
count = 100
webhook_url = "https://your-webhook-url-here"
while True:
print("Lithos User Cracker")
print("1. Start checking usernames")
print("2. Set webhook URL")
print("3. Set username length range")
print("4. Set number of usernames to check")
print("5. Exit")
choice = input("Enter your choice: ")
if choice == '1':
loop = asyncio.get_event_loop()
checker = UsernameChecker(min_length, max_length, count, webhook_url)
loop.run_until_complete(checker.main())
elif choice == '2':
webhook_url = input("Enter the webhook URL: ")
elif choice == '3':
min_length = int(input("Enter the minimum length of usernames: "))
max_length = int(input("Enter the maximum length of usernames: "))
elif choice == '4':
count = int(input("Enter the number of usernames to check: "))
elif choice == '5':
break
else:
print("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: