Skip to main content

Serializer and deserializer for mobile telegram session

Project description

AndroidTelePorter

pypi package

Serializer and deserializer for mobile telegram session

Table of Contents

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

pip install AndroidTelePorter

Usage

Converting existing mobile session into other format

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

androidteleporter-1.2.0.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

androidteleporter-1.2.0-py3-none-any.whl (47.3 kB view details)

Uploaded Python 3

File details

Details for the file androidteleporter-1.2.0.tar.gz.

File metadata

  • Download URL: androidteleporter-1.2.0.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for androidteleporter-1.2.0.tar.gz
Algorithm Hash digest
SHA256 961eaad9f9c670162d54016fa7716107c45b330f6a3c46cfbc0535f1dbe97831
MD5 03f598f54641a592a29b6ae372dd9b06
BLAKE2b-256 9a2c1d23eb3cd023599c5a230d38c9bbc197f41816fee9a4913e63f58954d15e

See more details on using hashes here.

File details

Details for the file androidteleporter-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for androidteleporter-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7dff3ef24fabcc28dd33791c1ddb2eb06828864954337838eb52fffc26490406
MD5 e6ec93f7af6f0b76595b1c3e0844cd2c
BLAKE2b-256 4c75ae334a38101c78fc2d06dccb7a5182cdd3c2ccfba7ca09019e69a2c851ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page