Name | tgnet JSON |
Version |
0.1.1
JSON |
| download |
home_page | |
Summary | Deserializes/serializes Telegram tgnet.dat format. Can be used to extract/replace authKey and dcId. |
upload_time | 2023-12-17 14:51:03 |
maintainer | |
docs_url | None |
author | RuslanUC |
requires_python | >=3.9,<4.0 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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](https://github.com/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
```python
>>> from tgnet import TGAndroidSession, NativeByteBuffer
>>> with open("tgnet.dat", "rb") as f:
... buf = NativeByteBuffer(f)
... tgdata = TGAndroidSession.deserialize(buf)
...
>>> currentDcId = tgdata.headers.currentDatacenterId
>>> currentDc = tgdata.datacenters[currentDcId - 1] # or tgdata.currentDc()
>>> print(currentDc.auth.authKeyPerm.hex())
'72a9808fb4a9e51e6ca57259714c14fa83546fc9d56fcb9d7de77c59fa13b6d6...'
```
### Running tests
```shell
pytest -s -x --disable-warnings --cov=tgnet/ test.py
```
Raw data
{
"_id": null,
"home_page": "",
"name": "tgnet",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "RuslanUC",
"author_email": "dev_ruslan_uc@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/02/a7/b6846a98a016152a8247bce6faa025b0345277d8871c5c89c4a04f4c9731/tgnet-0.1.1.tar.gz",
"platform": null,
"description": "# tgnet\nDeserializes/serializes Telegram tgnet.dat format.\nCan be used to extract/replace authKey and dcId.\n\n#### This is fork of [batreller/telegram_android_session_converter](https://github.com/batreller/telegram_android_session_converter) with support of serialization and zero dependencies.\n#### 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).\n\n## Usage\n```python\n>>> from tgnet import TGAndroidSession, NativeByteBuffer\n>>> with open(\"tgnet.dat\", \"rb\") as f:\n... buf = NativeByteBuffer(f)\n... tgdata = TGAndroidSession.deserialize(buf)\n...\n>>> currentDcId = tgdata.headers.currentDatacenterId\n>>> currentDc = tgdata.datacenters[currentDcId - 1] # or tgdata.currentDc()\n>>> print(currentDc.auth.authKeyPerm.hex())\n'72a9808fb4a9e51e6ca57259714c14fa83546fc9d56fcb9d7de77c59fa13b6d6...'\n```\n\n### Running tests\n```shell\npytest -s -x --disable-warnings --cov=tgnet/ test.py\n```",
"bugtrack_url": null,
"license": "",
"summary": "Deserializes/serializes Telegram tgnet.dat format. Can be used to extract/replace authKey and dcId.",
"version": "0.1.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "78c138bd0339864a3d5643b72953cf574942618341cf50a9b420a476f8cfbf19",
"md5": "d60d19a15a14b31e30ef3863bc732037",
"sha256": "4ae211e4ad6ce039cb9932669406096c0272220fdcce4dc9e5919c9380d5fbeb"
},
"downloads": -1,
"filename": "tgnet-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d60d19a15a14b31e30ef3863bc732037",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 7991,
"upload_time": "2023-12-17T14:51:02",
"upload_time_iso_8601": "2023-12-17T14:51:02.278528Z",
"url": "https://files.pythonhosted.org/packages/78/c1/38bd0339864a3d5643b72953cf574942618341cf50a9b420a476f8cfbf19/tgnet-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "02a7b6846a98a016152a8247bce6faa025b0345277d8871c5c89c4a04f4c9731",
"md5": "10f7e980e0dc70e2632d2c35f1baed35",
"sha256": "cf3f30fe403162041a8976410cc6efeb665a99661af9255571f01d3a199f1ae2"
},
"downloads": -1,
"filename": "tgnet-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "10f7e980e0dc70e2632d2c35f1baed35",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 10254,
"upload_time": "2023-12-17T14:51:03",
"upload_time_iso_8601": "2023-12-17T14:51:03.500302Z",
"url": "https://files.pythonhosted.org/packages/02/a7/b6846a98a016152a8247bce6faa025b0345277d8871c5c89c4a04f4c9731/tgnet-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-17 14:51:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tgnet"
}