Last active
May 13, 2024 15:30
-
-
Save stek29/8a7ac0e673818917525ec4031d77a713 to your computer and use it in GitHub Desktop.
Extract Telegram messages from db_sqlite PostBox – made for Telegram for macOS, but should work with Telegram for iOS
I see that passcode is not discussed here. If the user sets passcode, will it affect the generation of the key and the decryption of the final sqlite?
@fr0zenrain local passcode is used instead of no-matter-key, if it’s set. This is different from 2FA password set on servers.
I’m not sure about iOS App digit passcode though.
I wonder, is there a way to get tempkey on Windows?
@yunasc what do you mean? there's only telegram desktop for windows, and it has no local database
It has an encrypted sqlite DB. I'm using Unigram client which uses tdlib which has local database.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@stek29 @chazer
This is awesome!
I followed the instructions and managed to get a 90Mb "plaintext.db" file, and the instruction:
con = sqlite3.connect('plaintext.db')
does connect to the DB, But it crashes when trying to access any of the tables. For example:
OperationalError Traceback (most recent call last)
Input In [31], in <cell line: 1>()
----> 1 for idx, msg in get_all_messages(f=lambda idx: idx.timestamp > 1443989880):
2 if MessageFlags.Incoming in msg['flags'] and 'web versions of Telegram' in msg['text']:
3 print_message(idx, msg)
Input In [9], in get_all_messages(f, decode)
2 cur = con.cursor()
3 try:
----> 4 cur.execute("SELECT key, value FROM t7 ORDER BY key")
5 for key, value in cur:
6 idx = MessageIndex.from_bytes(key)
OperationalError: no such table: t7
Any ideas?