mirror of
https://github.com/bellingcat/telegram-phone-number-checker.git
synced 2026-06-07 19:08:31 +03:00
Move phone number to .env file
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.env
|
||||
*.session
|
||||
@@ -5,14 +5,15 @@ This script lets you check whether a specific phone number is connected to a Tel
|
||||
To run it, you need:
|
||||
|
||||
1. A Telegram account with an active phone number;
|
||||
2. Telegram 'API_ID' and 'API_HASH', which you can get by creating a developers account using this link: https://my.telegram.org/. Place these values in a .env file:
|
||||
2. Telegram 'API_ID' and 'API_HASH', which you can get by creating a developers account using this link: https://my.telegram.org/. Place these values in a .env file, along with the phone number of your Telegram account:
|
||||
|
||||
```
|
||||
API_ID=
|
||||
API_HASH=
|
||||
PHONE_NUMBER=
|
||||
```
|
||||
|
||||
Then, run the script: `python3 telegram-phone-validation.py --phone_number +15558675309`
|
||||
Then, run the script: `python3 telegram-phone-validation.py`
|
||||
|
||||
You can expect the following possible responses:
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ result = {}
|
||||
|
||||
API_ID = os.getenv('API_ID')
|
||||
API_HASH = os.getenv('API_HASH')
|
||||
PHONE_NUMBER = os.getenv('PHONE_NUMBER')
|
||||
|
||||
def get_names(phone_number):
|
||||
try:
|
||||
@@ -45,14 +46,13 @@ def user_validator():
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Check to see if a phone number is a valid Telegram account')
|
||||
parser.add_argument('--phone_number', dest='phone_number', action='store', help='Enter the phone number to check')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
client = TelegramClient(args.phone_number, API_ID, API_HASH)
|
||||
client = TelegramClient(PHONE_NUMBER, API_ID, API_HASH)
|
||||
client.connect()
|
||||
if not client.is_user_authorized():
|
||||
client.send_code_request(args.phone_number)
|
||||
client.sign_in(args.phone_number, input('Enter the code (sent on telegram): '))
|
||||
client.send_code_request(PHONE_NUMBER)
|
||||
client.sign_in(PHONE_NUMBER, input('Enter the code (sent on telegram): '))
|
||||
user_validator()
|
||||
print(result)
|
||||
|
||||
Reference in New Issue
Block a user