-
-
Save stek29/8a7ac0e673818917525ec4031d77a713 to your computer and use it in GitHub Desktop.
It has an encrypted sqlite DB. I'm using Unigram client which uses tdlib which has local database.
You're lifesaver
saved my channel content from telegram who deleted it without warning and never responded to any of communication channels
By running the script above, I can only find one participant of the conversation.
When it is outgoing, there is no information about the sender.
When it is incoming, there is no information about the recipient.
It seems that the information of the owner of the phone is not available.
How to get the account details of the owner?
Does anyone know by any chance if there's a way to know if the auto-delete feature is enabled in a chat/conversation or not?
Woah, thanks for such great job! I tried another script and I can get list of peers for chats where are multiple users. Can I access personal chats too?
Anyway with this script I have an error when trying to find any message: long debug output and message "ValueError: 33 is not a valid TelegramMediaAction.Type". It fails on some enum. How can I fix that?
Also there's an error with calling murmur because of mmh3 update 5.0.0 - it fails with negative seed. As workaround you can install mmh3==4.1.0 worked for me.
But I don't know what to do with the error above
IOS not have .tempkeyEncrypted
file, is .tempkey
, and is 48 bytes not 64 bytes, code maybe not work. : (
message "ValueError: 33 is not a valid TelegramMediaAction.Type". It fails on some enum. How can I fix that?
Newer action types can be found in sources here: https://github.com/TelegramMessenger/Telegram-iOS/blob/45fa1b5ddb3a9a794bf407cb8d9bf2d0e4643b1f/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaAction.swift#L136-L262
Other enums:
- MessageTags: https://github.com/TelegramMessenger/Telegram-iOS/blob/45fa1b5ddb3a9a794bf407cb8d9bf2d0e4643b1f/submodules/TelegramCore/Sources/SyncCore/SyncCore_Namespaces.swift#L156-L171
- MessageFlags https://github.com/TelegramMessenger/Telegram-iOS/blob/45fa1b5ddb3a9a794bf407cb8d9bf2d0e4643b1f/submodules/Postbox/Sources/Message.swift#L858-L870
IOS not have
.tempkeyEncrypted
file, is.tempkey
, and is 48 bytes not 64 bytes, code maybe not work. : (
@badguy123 then it should just be the key and salt in unencrypted form, try that
dbKey = data[0:32]
dbSalt = data[32:48]
@lindsaymorgan I think @ekzotech wrote about it, try this
Also there's an error with calling murmur because of mmh3 update 5.0.0 - it fails with negative seed. As workaround you can install mmh3==4.1.0 worked for me.
@lindsaymorgan or see hajimes/mmh3#119
@lindsaymorgan I’ve updated the gist code, hope I didn’t mess it up
@lindsaymorgan I think @ekzotech wrote about it, try this@lindsaymorgan我认为@ekzotech写过它,试试这个
Also there's an error with calling murmur because of mmh3 update 5.0.0 - it fails with negative seed. As workaround you can install mmh3==4.1.0 worked for me.此外,由于 mmh3 更新 5.0.0 而调用 murmur 时出错 - 它失败并出现负种子。作为解决方法,您可以安装 mmh3==4.1.0 对我有用。
It works! Thank you so much!
This has been working great for me for awhile. But recently, I've been getting an exception on this line in the TelegramMediaFile decoder:
self.fileId = (bio.read_int32(), bio.read_int64())
The call to read_int32()
is failing because when it reads the buffer, it's getting b''
. This isn't happening for all Media Files, but it is happening for a lot of them. I'm assuming it's some new feature in Telegram that's causing this, but I thought I would ask here if anyone knows what the change is, before spending time trying to dig into what's causing it.
Thank you very much for your work, it's so helpful!
I was able to get the FORWARDED messages with my partial code:
if msg.get('fwd'):
fwd_info = msg['fwd']
if isinstance(fwd_info, dict):
author_id = fwd_info.get('author')
date = fwd_info.get('date')
signature = fwd_info.get('signature')
fwd_parts = []
if author_id:
fwd_parts.append(f"author: {peer_str(author_id)}")
if date:
fwd_parts.append(f"date: {datetime.datetime.fromtimestamp(date).strftime('%Y-%m-%d %H:%M:%S')}")
if signature:
fwd_parts.append(f"signature: {signature}")
fwd_str = " | ".join(fwd_parts)
full_content = f"[FORWARDED {fwd_str}]{full_content}[/FORWARDED]"
But I am unable to handle REPLY messages.
Ideally I would like to output in this format:
"[REPLY from user name or phone]the original message[/REPLY]additionnal message if exists"
Do you think you can help about this?
I noticed raw mgs data contains some things like:
{'i': 123456789101112, 'p': 654321, '@type': 478003709} from "attributes"
It looks to tells it's a reply message (probably from it's "@type" value), I can say the current message is from the peer_id "654321" but the quoted reply is NOT from peer_id "654321".
I can't get what this "i" with the value "123456789101112" represents and how to get the message referenced by "123456789101112".
I'm maybe in the wrong way with the mgs attributes, don't know.
I tried few things already based on SyncCore_ReplyMessageAttribute.swift for example but I don't know why I can't get the data.
Thanks again for your time!
I assume this needs to be ran on the host machine? I've tried exporting the account postbox directory to another machine and running the jup notebook but doesn't seem to be working. Does the notebook file need to be in the same directory with the db_sqlite? Once I run the jup notebook server and open this ipynb I just get a 0 byte DB and an error saying no such table T7
Just looking for initial setup guidance.
...
Just looking for initial setup guidance.
Hi, You better install Python (v3.10x or later), copy the code parts within a .PY file, edit this line "con = sqlite3.connect('plaintext.db')" to match the path of the db_sqlite file and execute the .PY with Python.
How to get the Sqlite DB file from an Android phone or Windows desktop computer? I searched a lot, but can't find them.
I'm stuck in the fist step of the problem 🤷
@pauloneves this is for iOS/macOS apps only, other apps are completely different
@yunasc what do you mean? there's only telegram desktop for windows, and it has no local database