Skip to main content

Check if phone numbers are connected to Telegram accounts.

Project description

telegram-phone-number-checker

Python tool/script to check if phone numbers are connected to Telegram accounts. Retrieving username, name, and IDs where available.

Installation

PyPI - Version

You can install this tool directly from the official pypi release.

pip install telegram-phone-number-checker

You can also install it and run it directly from github as a script.

git clone https://github.com/bellingcat/telegram-phone-number-checker
cd telegram-phone-number-checker
pip install -r requirements.txt
python telegram-phone-number-checker/main.py

Requirements

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 at 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=

If you don't create this file, you can also provide these 3 values when calling the tool, or even be prompted for them interactively.

Usage

The tool accepts a comma-separated list of phone numbers to check, you can pass this when you call the tool, or interactively.

See the examples below:

# single phone number
telegram-phone-number-checker --phone-numbers +1234567890

# multiple phone numbers
telegram-phone-number-checker --phone-numbers +1234567890,+9876543210,+111111111

# interactive version, you will be prompted for the phone-numbers
telegram-phone-number-checker

# overwrite the telegram API keys in .env (or if no .env is found)
telegram-phone-number-checker --api-id YOUR_API_KEY --api-hash YOUR_API_HASH --api-phone-number YOUR_PHONE_NUMBER --phone-numbers +1234567890

The result will be written to the console but also written as JSON to a results.json file, you can write it to another file by adding --output your_filename.json to the command.

For each phone number, you can expect the following possible responses:

  1. If available, you will receive the Telegram Username, Name, and ID that are connected with this number.
  2. 'no username detected'. This means that it looks like the number was used to create a Telegram account but the user did not choose a Telegram Username. It is optional to create a Username on Telegram.
  3. 'ERROR: no response, the user does not exist or has blocked contact adding.': There can be several reasons for this response. Either the phone number has not been used to create a Telegram account. Or: The phone number is connected to a Telegram account but the user has restricted the option to find him/her via the phone number.
  4. Or: another error occurred.

Development

This section describes how to install the project in order to run it locally, for example if you want to build new features.

# clone the code
git clone https://github.com/bellingcat/telegram-phone-number-checker

# move into the project's folder
cd telegram-phone-number-checker

This project uses poetry to manage dependencies. You can install dependencies via poetry, or use the up-to-date requirements.txt file.

# with poetry
poetry install

# with pip
pip install -r requirements.txt

You can then run it with any of these:

# with poetry
poetry run python3 telegram_phone_number_checker/main.py

# with pip installation
python3 telegram_phone_number_checker/main.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telegram_phone_number_checker-1.0.7.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file telegram_phone_number_checker-1.0.7.tar.gz.

File metadata

File hashes

Hashes for telegram_phone_number_checker-1.0.7.tar.gz
Algorithm Hash digest
SHA256 e4adecc9a2e34c69e6a9d86818959cea560b0d8d15315cc8ff8fd5bbff58a780
MD5 5a705a0d4f7fec4165daf36516cf6d21
BLAKE2b-256 74f5401660be1953ae26fb1b4ca5326f7443d78e5cdde648edcbaa08c1c3fbad

See more details on using hashes here.

File details

Details for the file telegram_phone_number_checker-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for telegram_phone_number_checker-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2ac3907400da8091d2ca9789171cf62df6a8321b878f8f2146050ee78df9b8f7
MD5 dcca8eb1694e8b79d00f2b5be814cbbd
BLAKE2b-256 6d28bb72196b17dad940a2c63a18411bc7d3387f61e8708626de0685b5304451

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page