ππ Peek at other's Telegram username, taking it over once it is released. ππ
Python 3.7 or up is required.
The telethon library is used.
pip3 install telethon
Use the image on dockerhub.
docker pull hyperbola/telegram-id-pretender:1
1
,1.0
,1.0.1
A running is an attempt to take over the username; therefore the script should be used with cron.
Following command tries to update username to fzhong
. You need an API key to use the script. You can generate one here.
# python
TG_API_ID=<api_id> TG_API_HASH=<api_hash> python3 main.py fzhong
# docker
docker run [-it]\
-e TG_API_ID=<api_id> \
-e TG_API_HASH=<api_hash>
hyperbola/telegram-id-pretender:1 fzhong
The script should ask your login.
Warning You should answer your mobile phone number in international format. For Taiwanese, use
+8869xxxxxxxxx
instead of09xxxxxxxx
.
The script asks your login interactively. To do automatic login, you can -s <session-file>
to save and restore the login session.
# python
TG_API_ID=<api_id> TG_API_HASH=<api_hash> python3 main.py -s /path/to/session/file fzhong
# docker
docker run [-it] \
-v /path/to/session:/session \
-e TG_API_ID=<api_id> \
-e TG_API_HASH=<api_hash> \
hyperbola/telegram-id-pretender:1 -s /session fzhong
If session file is specified, the script tries to read session token from the file and uses it to login; otherwise if session file does not exist, or if session token is invalid, the script prompts your login and then saves the updated token to session file so that it can perform automatic login in the next run. Keep session file secret since it contains sensitive data.
If the script is not running interactively, the session file must be specified. Otherwise the script fails without asking your login.
Since telegram requires 2FA login and this action must be performed on the spot, there is no support automatic login by setting username and password.
--id
PATH: read telegram api id from this file--hash
PATH: read telegram api hash from this file-s
,--session
PATH: read login token from this file-v
,--verbose
: verbosity level; should be0
,1
or2
; default to1
-D
,--no-prompt
: do not ask login even in interactive shell
Following environment variables make effects. Noted that these variables refer to value directly, but not path to the value.
TG_API_ID
: telegram api id; overrides--id
optionTG_API_HASH
: telegram api hash; overrides--hash
optionTG_SESSION
: login session; overrides--session
option
Verbosity can be set to either 0, 1, or 2 by -v
flag. Control which message should be sent to your Saved Messages
channel in your telegram account.
0
: do not send any message1
: send critical messages only2
: send all messages
0
: successfully took the desired username20
: desired username is occupied21
: desired username is invalid22
: desired username is already owned by you30
: failed to login87
: failed for flood1
: failed for any other reason