Skip to main content

tgback-x — a library for making Telegram account backups

Project description

TGBACK-X — a library for making Telegram account backups

Check out the GUI implementation - XQt!

TGBACK-X is a little library which you can utilize to create an encrypted backup of your Telegram account. If you've been around here before then you probably heard about my old project called TGBACK (without X). Actually, this library is an implementation revisit of the same concept with just about the same purpose.

The difference between the old TGBACK and X version (except completely different backup structure) is that this repository is strictly Python library for devs and doesn't have any App implementation (like Command line app that old TGBACK have). However most importantly, this version doesn't create any backup files (hence the X in name). Instead, it relies on the Providersthird-party services that we use to store encrypted backup data.

Idea behind:

  1. User type password or we generate random N (default 8) mnemonic words;
  2. We feed password to Scrypt (1GB from defaults), obtain Scrypt key;
  3. We make (hash) a unique KeyID from Scrypt key material;
  4. We ask for Telegram login credentials, log into account;
  5. We take account's session and construct a backup data;
  6. We encrypt backup data with one of Cryptography Protocol;
  7. We store the encrypted backup data on Provider server by KeyID.

In that way, User will be able to get Session only by typing secret Phrase. Obviously, this approach may impose some risks — anyone who will be able to type the same Phrase will obtain a full access to account. User should treat its Phrase like Bitcoin seed phrase and never use X version on a compromised Computer, e.g, with malwares / other programs that can record keyboard or screen.

Telegram session is no-special in TGBACK-X and can be killed at any time through Telegram Settings —> Devices or directly from backup data by itself. Disconnected Session is a useless pile of encoded bytes. If you feel that your Phrase may be compromised — destroy session immediately. You can always create a different one. Different backups keep different sessions, so they wouldn't be connected at all.

Default approach:

Default (and currently only one implemented here) Provider is a TelegramChannel. That is, we keep your encrypted Telegram data inside Telegram! The KeyID would be a Channel public link, and Backup data would be regular message. We utilize interesting Telegram feature — any public Telegram channel can be previewed in Browser without login. See this for example — is a backup that you can make with TelegramChannel. We fetch backup data (TelegramChannel use JSON_AES_CBC_UB64 crypto protocol) through http requests, decrypt and give Session to User.

Welcome, developers

I (hope I) made TGBACK-X library modular, so you can create your own Provider / Protocol classes. Currently there is no documentation, but I tried to describe everything in Docstrings. You can refer to them and check how default classes are implemented for basic understanding. While I don't think that there is any sense in adding new cryptography Protocol (JSON_AES_CBC_UB64 seems about enough), different Provider would be interesting to see.

Install

pip install tgback-x

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

tgback_x-1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

tgback_x-1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file tgback_x-1.0.tar.gz.

File metadata

  • Download URL: tgback_x-1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for tgback_x-1.0.tar.gz
Algorithm Hash digest
SHA256 b95b08cb81e0ae63e76cbeee9c437746f14b13b9674a6e48c755fdb60da1463f
MD5 d561776bccb3c025b1f210303307d674
BLAKE2b-256 264c0447b6d945ba352258662f54ac39023e182e59c3eee728d6759f292e769e

See more details on using hashes here.

File details

Details for the file tgback_x-1.0-py3-none-any.whl.

File metadata

  • Download URL: tgback_x-1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for tgback_x-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d74bedcd02deeb5aa5cc2cc29bba2f4b3aec8a43c4d71e3c7e2c3e9070f4b6c
MD5 4295eb257aa72a13cc48e5fe23fd18ab
BLAKE2b-256 bab5c742a83d60aff3d8b6202d0726e9e1f48d032935dc6e3ff2fe3f24dc1c0d

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