Skip to content

Instantly share code, notes, and snippets.

@mb6ockatf
Created June 25, 2024 19:57
Show Gist options
  • Save mb6ockatf/9dc34999dc748855eead1bd834b88945 to your computer and use it in GitHub Desktop.
Save mb6ockatf/9dc34999dc748855eead1bd834b88945 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from requests import post
from itertools import permutations
from string import ascii_lowercase, digits
import sys
from telethon import TelegramClient
from telethon.tl.functions.users import GetFullUserRequest
import asyncio
async def check_uname(username, client):
try:
temp = await client(GetFullUserRequest(username))
# print(f'Username "{username}" is already taken')
return
except Exception as e: # Заменяем на общее исключение
print(f'Username "{username}" is free!')
return
async def main():
api_id = "" # замени на свой
api_hash = "" # замени на свой
client = TelegramClient('bot', api_id, api_hash)
await client.connect()
data = ascii_lowercase
for attempt in permutations(data, r=4):
r = "c" + "".join(attempt)
async with client:
await check_uname(r, client)
if __name__ == '__main__': # Исправляем условие на вход в точку входа
asyncio.run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment