itsjunetime / smserver

An app to allow Jailbroken iPhones to send texts & attachments from their browser
GNU General Public License v3.0
158 stars 27 forks source link

Cannot parse handwritten/digital touch messages #64

Open boomcan90 opened 3 years ago

boomcan90 commented 3 years ago

I'm having an issue where the chat I open crashes SMServer if there was past location sharing on it.

SMServer 0.6.1 libsmserver 0.5.1-1

itsjunetime commented 3 years ago

Until now, I hadn't run into any instances of location sharing in my own texts, so I hadn't explicitly added support for it. I'll definitely check this out and hopefully have it fixed by next version.

itsjunetime commented 3 years ago

I tried it out on my own device, and location sharings appear to work fine; they just appear as a .vcf attachment in the web interface. Are you certain it's the location sharing that is causing the crash or was that just your suspicion since that was the only major difference between that conversation and other ones?

boomcan90 commented 3 years ago

That was my suspicion. I don't know what the specific issue is, how can I isolate the problem?

itsjunetime commented 3 years ago

If you can get a crash log for the app (through cr4shed or something similar), that would help significantly. If that's not possible, there are instructions in the readme of this repo for how to get a debug log for SMServer (it's clunky, I know, I'm hoping to improve it soon). If you could run through those steps and attach the debug log here, that would also massively help to determine the issue.

boomcan90 commented 3 years ago

Cr4shed Logs: https://paste.ee/p/WswJ5

itsjunetime commented 3 years ago

It looks like the libsmserver library isn't being loaded, and I think that may be your issue. I recently released a new version of SMServer and libsmserver on twickd (just a few hours ago), so could you completely uninstall your version of SMServer and libsmserver, install the new versions, and try again?

boomcan90 commented 3 years ago

Updated crash log: https://paste.ee/p/zpoPx

itsjunetime commented 3 years ago

So, it looks like the app is crashing when it tries to parse a rich link that was sent in this conversation. Have you sent any links that appear with their rich description (e.g. they don't just show the plain url, like google.com, but rather show an image along with the website title and possibly a description) in this conversation recently? And if so, would you be ok with sharing the link here? If I could send it and check out how the rich link description is stored, that would help a lot in fixing this issue.

boomcan90 commented 3 years ago

The links are:

boomcan90 commented 3 years ago

Relevant part of Debug Log:

Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: full sql query: SELECT ROWID, guid, text, subject, is_from_me, date, date_read, service, cache_has_attachments, handle_id, balloon_bundle_id, payload_data, associated_message_guid, associated_message_type from message WHERE ROWID IN (SELECT message_id FROM chat_message_join WHERE chat_id IN (SELECT ROWID from chat WHERE chat_identifier is "+65XXXXXXXX") ORDER BY message_date DESC) ORDER BY date DESC LIMIT 0, 100;
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: opened statement
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: destroyed statement
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: Getting attachment for mid 14237
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: opened database
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: full sql query: SELECT filename, mime_type from attachment WHERE ROWID in (SELECT attachment_id from message_attachment_join WHERE message_id is 14237);
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: opened statement
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: destroyed statement
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: attachment file length: 2Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: Opened statement in getLinkTitle
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: Getting attachment for mid 13739
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: opened database
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: full sql query: SELECT filename, mime_type from attachment WHERE ROWID in (SELECT attachment_id from message_attachment_join WHERE message_id is 13739);
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: opened statement
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: destroyed statement
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: attachment file length: 1Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: Getting attachment for mid 13730
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: opened database
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: full sql query: SELECT filename, mime_type from attachment WHERE ROWID in (SELECT attachment_id from message_attachment_join WHERE message_id is 13730);
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: opened statement
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: destroyed statement
Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: attachment file length: 1Dec  2 05:41:59 iPhone SMServer(com.ianwelker.smserver.debugging)[9139] <Debug>: SMServer_app: Opened statement in getLinkTitle
itsjunetime commented 3 years ago

So it looks like the issue is that digital touch messages are being interpreted as rich links, as opposed to the digital touch messages that they are, and this then causes the app to crash when it tries to decode some data as a plist (when it's in some other format). I'll add some checks to make sure it doesn't try to decode the data as a plist (so that it doesn't crash the app), but I'm not quite as of yet what format the digital touch message is being in, so it'll probably still be a bit until I can add support for viewing digital touch messages.

itsjunetime commented 3 years ago

SMServer 0.6.2 should now allow you to view conversations that have digital touch messages in them, it just won't display the message at all. I have yet to figure out what format digital touch messages are stored in, so I don't yet know how to display them on the web interface.

If anybody who sees this would like to take a shot at figuring out how to parse them, here's a file that contains the raw data that makes up a digital touch message - it's not actually a text file, I just added the .txt extension so that github would allow me to upload it. If you can figure out how to turn this data into the display one sees in the iMessages app, I'd love to hear about it :)

digitalTouchMessage.txt

sabogalc commented 1 year ago

While this isn't a full code breakdown on how it was accomplished, the BlueBubbles devs have figured this out https://github.com/BlueBubblesApp/bluebubbles-server/issues/492