This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathTG_User_Finder.py
46 lines (42 loc) · 1.54 KB
/
TG_User_Finder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/local/bin/python3
# coded by:swagkarna
from telethon import TelegramClient, events, sync
from telethon.tl.types import InputPhoneContact
from telethon import functions, types
def check(phone_number, usr):
try:
contact = InputPhoneContact(client_id = 0, phone = phone_number, first_name="__test__", last_name="__last_test__")
contacts = client(functions.contacts.ImportContactsRequest([contact]))
username = contacts.to_dict()['users'][0]['username']
return username
dell = client(functions.contacts.DeleteContactsRequest(id=[username]))
except:
res = "__err__"
return res
def list_checker():
list_file = input("List of numbers: ")
usr = input("Username Target: ")
list = open(list_file, 'r').read().splitlines()
for num in list:
try:
ress = check(num, usr)
if ress == '__err__':
print ("Number: {} <{}>".format(num, "ERROR!"))
elif ress.lower() == usr.lower():
f = open("hit.txt", "a")
f.write(ress+":"+num)
f.close()
print ("Number: {} <{}>".format(num, "OK:)"))
break
else:
print ("Null")
except:
print ("Null")
if __name__ == '__main__':
phone = 'Your TG Number'
client = TelegramClient(phone, API ID, 'API Hash')
client.connect()
if not client.is_user_authorized():
client.send_code_request(phone)
client.sign_in(phone, input('Enter the code: '))
list_checker()