Skip to content
/ tgnet Public
forked from RuslanUC/tgnet

Deserializes/serializes Telegram tgnet.dat format. Can be used to extract/replace authKey and dcId.

License

Notifications You must be signed in to change notification settings

kslm1/tgnet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tgnet

Deserializes/serializes Telegram tgnet.dat format. Can be used to extract/replace authKey and dcId.

This is fork of batreller/telegram_android_session_converter with support of serialization and zero dependencies.

To convert the session all you need is just tgnet.dat file from the root directory of your telegram app on the phone, it's located at /data/data/org.telegram.messenger.web (or another package name, if you're using an unofficial client), it can be extracted using ADB (Android Debug Bridge).

Usage

from tgnet import Tgnet

tgnet_path = input("tgnet.dat path: ")

tgnet = Tgnet(tgnet_path)
current_dc = tgnet.current_datacenter
auth_key = current_dc.get_auth_key("perm")

print(f"Current dc id: {current_dc.id}")
print(f"Auth key (hex): {auth_key.hex() if auth_key is not None else None}")

# Current dc id: 2
# Auth key (hex): '72a9808fb4a9e51e6ca57259714c14fa83546fc9d56fcb9d7de77c59fa13b6d6...'

Running tests

pytest -s -x --disable-warnings --cov=tgnet/ test.py

About

Deserializes/serializes Telegram tgnet.dat format. Can be used to extract/replace authKey and dcId.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%