AndroidTelePorter


NameAndroidTelePorter JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/batreller/AndroidTelePorter
SummarySerializer and deserializer for mobile telegram session
upload_time2024-09-08 16:25:12
maintainerNone
docs_urlNone
authorbatreller
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# AndroidTelePorter

[![pypi package](https://img.shields.io/pypi/v/AndroidTelePorter.svg)](https://pypi.python.org/pypi/AndroidTelePorter/)


Serializer and deserializer for mobile telegram session

## Table of Contents

- [Project Name](#project-name)
  - [Table of Contents](#table-of-contents)
  - [Description](#description)
  - [Installation](#installation)
  - [Usage](#usage)

## Description

This tool can be used to serialize and deserialize session on original Telegram client for Android phones.

It can extract any information stored in files/tgnet.dat and all needed information from shared_prefs/userconfing.xml

It also can deserialize existing session into object and convert it into other session formats (currently supported tdata, telethon and tgnet)

And you can serialize session manually into mobile tgnet format, all you need is just auth key, datacenter id and user id, it is minimum information needed for almost any session format

## Installation

You can easily set up this package as it is available on pypi by running the following command
```bash
pip install AndroidTelePorter
```

## Usage

#### Converting existing mobile session into other format
```python
from AndroidTelePorter import AndroidSession

# both tgnet.dat and userconfing.xml are stored in /data/data/org.telegram.messenger directory
# if you have more than 1 account you would need to use tgnet.dat from /files/account(account_number)/tgnet.dat
# and corresponding userconfig.xml file from /shared_prefs/userconfig(account_number).xml
session = AndroidSession.from_tgnet(
    tgnet_path=r'files\tgnet.dat',  # contains auth key and dc id
    userconfig_path=r'shared_prefs\userconfing.xml'  # contains user id
)

session.to_tgnet('converted/tgnet')  # will create all needed files right in directory that you specified
# or
session.to_tdata('converted/pc')  # will create another folder "tdata" inside directory that you specified
# or
session.to_telethon('converted/telethon.session')  # must end with .session
```

#### Creating mobile session from auth key, dc id and user id
```python
from AndroidTelePorter import AndroidSession

session = AndroidSession.from_manual(
    auth_key=bytes.fromhex('hex auth key'),
    dc_id=0,  # datacenter id (from 1 to 5)
    user_id=12345678  # telegram user id
)  # can be used to create any session (tgnet / tdata / telethon) from auth key, dc id and user id

session.to_tgnet('converted/tgnet')  # will create all needed files right in directory that you specified
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/batreller/AndroidTelePorter",
    "name": "AndroidTelePorter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "batreller",
    "author_email": "<batreller@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9d/39/ef96f2facdeb6b5d04bc673118686758906e842448aaf19bd00e4c62b27f/androidteleporter-1.1.1.tar.gz",
    "platform": null,
    "description": "\n# AndroidTelePorter\n\n[![pypi package](https://img.shields.io/pypi/v/AndroidTelePorter.svg)](https://pypi.python.org/pypi/AndroidTelePorter/)\n\n\nSerializer and deserializer for mobile telegram session\n\n## Table of Contents\n\n- [Project Name](#project-name)\n  - [Table of Contents](#table-of-contents)\n  - [Description](#description)\n  - [Installation](#installation)\n  - [Usage](#usage)\n\n## Description\n\nThis tool can be used to serialize and deserialize session on original Telegram client for Android phones.\n\nIt can extract any information stored in files/tgnet.dat and all needed information from shared_prefs/userconfing.xml\n\nIt also can deserialize existing session into object and convert it into other session formats (currently supported tdata, telethon and tgnet)\n\nAnd you can serialize session manually into mobile tgnet format, all you need is just auth key, datacenter id and user id, it is minimum information needed for almost any session format\n\n## Installation\n\nYou can easily set up this package as it is available on pypi by running the following command\n```bash\npip install AndroidTelePorter\n```\n\n## Usage\n\n#### Converting existing mobile session into other format\n```python\nfrom AndroidTelePorter import AndroidSession\n\n# both tgnet.dat and userconfing.xml are stored in /data/data/org.telegram.messenger directory\n# if you have more than 1 account you would need to use tgnet.dat from /files/account(account_number)/tgnet.dat\n# and corresponding userconfig.xml file from /shared_prefs/userconfig(account_number).xml\nsession = AndroidSession.from_tgnet(\n    tgnet_path=r'files\\tgnet.dat',  # contains auth key and dc id\n    userconfig_path=r'shared_prefs\\userconfing.xml'  # contains user id\n)\n\nsession.to_tgnet('converted/tgnet')  # will create all needed files right in directory that you specified\n# or\nsession.to_tdata('converted/pc')  # will create another folder \"tdata\" inside directory that you specified\n# or\nsession.to_telethon('converted/telethon.session')  # must end with .session\n```\n\n#### Creating mobile session from auth key, dc id and user id\n```python\nfrom AndroidTelePorter import AndroidSession\n\nsession = AndroidSession.from_manual(\n    auth_key=bytes.fromhex('hex auth key'),\n    dc_id=0,  # datacenter id (from 1 to 5)\n    user_id=12345678  # telegram user id\n)  # can be used to create any session (tgnet / tdata / telethon) from auth key, dc id and user id\n\nsession.to_tgnet('converted/tgnet')  # will create all needed files right in directory that you specified\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Serializer and deserializer for mobile telegram session",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://github.com/batreller/AndroidTelePorter"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce159687e012a6567a6e965d2a27f4f006920094d26a24efe693936c7bd6e6af",
                "md5": "0678d1a71272ce2ff1a372d7b9825b7b",
                "sha256": "89316b6a6aed2232fe10e83bf74b2a18ec18044a89740f7c11472490f7f5c187"
            },
            "downloads": -1,
            "filename": "AndroidTelePorter-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0678d1a71272ce2ff1a372d7b9825b7b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16279,
            "upload_time": "2024-09-08T16:25:11",
            "upload_time_iso_8601": "2024-09-08T16:25:11.956211Z",
            "url": "https://files.pythonhosted.org/packages/ce/15/9687e012a6567a6e965d2a27f4f006920094d26a24efe693936c7bd6e6af/AndroidTelePorter-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d39ef96f2facdeb6b5d04bc673118686758906e842448aaf19bd00e4c62b27f",
                "md5": "f644a6866d39dc5249a9fad9fef6b7a9",
                "sha256": "752076ca2bdc829379180899ce3cc6c52b28ea771f947c278177aa9454766829"
            },
            "downloads": -1,
            "filename": "androidteleporter-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f644a6866d39dc5249a9fad9fef6b7a9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 11753,
            "upload_time": "2024-09-08T16:25:12",
            "upload_time_iso_8601": "2024-09-08T16:25:12.950719Z",
            "url": "https://files.pythonhosted.org/packages/9d/39/ef96f2facdeb6b5d04bc673118686758906e842448aaf19bd00e4c62b27f/androidteleporter-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-08 16:25:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "batreller",
    "github_project": "AndroidTelePorter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "androidteleporter"
}
        
Elapsed time: 1.17983s