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
Metadata
Release files for tgnet 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tgnet-0.2.1.tar.gz | 7.6 kB | Without provenance | Details for tgnet-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tgnet-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for tgnet-0.2.1-py3-none-any.whl |
Total release size: 18.2 kB
Release files / tgnet-0.2.1.tar.gz
| Download URL | tgnet-0.2.1.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22423d2f60e7dc7ff00aebd5a77d3ebccb4cadcf723d7935e4e9b01aa6c44c58
|
|
BLAKE2b-256 checksum How to use checksums |
82d24831cb695e0bb13cf7c397c408016cae591ac095e9c58a3f9347c1f280e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.4 CPython/3.14.2 Linux/6.17.12-300.fc43.x86_64
|
Release files / tgnet-0.2.1-py3-none-any.whl
| Download URL | tgnet-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b46a4f658e1ff26d8bd0660b96d6d626f2466302e57d3b601dc25d6b7bae313
|
|
BLAKE2b-256 checksum How to use checksums |
b1195163c969042e44cd96b10f8900740a661823f3d1bb6f9b19208ff8116f4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.4 CPython/3.14.2 Linux/6.17.12-300.fc43.x86_64
|
Security for tgnet 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.