Deserializes/serializes Telegram tgnet.dat format. Can be used to extract/replace authKey and dcId.
Project description
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.get_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tgnet-0.2.1.tar.gz
(7.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
tgnet-0.2.1-py3-none-any.whl
(10.6 kB
view details)
File details
Details for the file tgnet-0.2.1.tar.gz.
File metadata
- Download URL: tgnet-0.2.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.14.2 Linux/6.17.12-300.fc43.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22423d2f60e7dc7ff00aebd5a77d3ebccb4cadcf723d7935e4e9b01aa6c44c58
|
|
| MD5 |
227cb129c28a322fa7c3a51d5bbc7882
|
|
| BLAKE2b-256 |
82d24831cb695e0bb13cf7c397c408016cae591ac095e9c58a3f9347c1f280e4
|
File details
Details for the file tgnet-0.2.1-py3-none-any.whl.
File metadata
- Download URL: tgnet-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.14.2 Linux/6.17.12-300.fc43.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b46a4f658e1ff26d8bd0660b96d6d626f2466302e57d3b601dc25d6b7bae313
|
|
| MD5 |
44f123673889e54ae49d669172c6df11
|
|
| BLAKE2b-256 |
b1195163c969042e44cd96b10f8900740a661823f3d1bb6f9b19208ff8116f4a
|