mirror of
https://github.com/ElDavoo/wa-crypt-tools.git
synced 2026-04-26 14:15:55 +03:00
[GH-ISSUE #16] Can't decrypt #15
Labels
No labels
bug
documentation
enhancement
enhancement
good first issue
help wanted
info needed
invalid
low priority
pull-request
skill issue
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/wa-crypt-tools#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @martinodonnell on GitHub (Mar 25, 2022).
Original GitHub issue: https://github.com/ElDavoo/wa-crypt-tools/issues/16
Originally assigned to: @ElDavoo on GitHub.
Hexdump of the encrypted DB
Program output using -v and -f
Normal
Force
Additional context
My android phone doesn't connect to a laptop so I used an emulator from android studio to spin up a Pixel_3a_API_30_x86 device.
I installed version
2.22.7.71of WhatsApp on the device by downloading it from their website and dragging it onto the emulator. I then logged in and took my backup from google drive.To get the
keyandmsgstore.db.crypt14file off the emulator, I used android studio and used the device file explorer - stackoverflow postI am using Python
3.9.6I am following the guide by @tim25651 from here to use @residentsummer watio tool
@ElDavoo commented on GitHub (Mar 25, 2022):
Whoops. Did I really forget to delete print(key) from main?
You can just use a previous commit
github.com/ElDavoo/WhatsApp-Crypt14-Crypt15-Decrypter@2e146c69e3while I fully wake up and fix whatever I've done@ElDavoo commented on GitHub (Mar 25, 2022):
Or, easier, delete lines 627 and 628 (i forgot to remove them before committing!!!)
@ElDavoo commented on GitHub (Mar 25, 2022):
There you go. Apologies for any disruption. This is why #10 is needed haha
@martinodonnell commented on GitHub (Mar 25, 2022):
@ElDavoo Thanks. That worked!
How can I go about buying you a coffee?
@ElDavoo commented on GitHub (Mar 25, 2022):
Thank you! ❤️ Just a star is enough for now :) I also have no idea on how to as I never donated/received on github
@martinodonnell commented on GitHub (Mar 25, 2022):
@ElDavoo I'll come back and write some tests for you once I work out how to get media from android to IOS
Thanks!
@ElDavoo commented on GitHub (Mar 25, 2022):
Thanks! I still have to fix str() properly though
@martinodonnell commented on GitHub (Mar 25, 2022):
Sorry, got carried away!
@ElDavoo commented on GitHub (Mar 25, 2022):
Ok I am fully operative now.
Did it? It... shouldn't :)
That means that your key_version and/or your googleid is None, which means you must have had some warnings about the key (?)
Did you have to use --force? Can you plz send logs?
@ElDavoo commented on GitHub (Mar 25, 2022):
Only the key_version actually as the googleid is checked before
@ElDavoo commented on GitHub (Mar 25, 2022):
Can you also send the first 32 bytes of your key file please?
od -t x1 -N 32 keyThat will be:
So no sensitive material
Thank you very much
@ElDavoo commented on GitHub (Mar 25, 2022):
Ok, looks like you posted it and then edited the post. Be more careful next time: the post history is public! I've deleted the revisions containing the key for you.
So it looks like Whatsapp started pushing version 3 of the key. However, nothing changes, and you said the program worked, so I think just adding \x03 to supported_key_versions will be enough.
Thank you for the issue :)
@ElDavoo commented on GitHub (Mar 25, 2022):
Ok Martin please confirm that the program works in the latest commit without using --force, thank you.
@martinodonnell commented on GitHub (Mar 25, 2022):
Sorry for the delay, different time zones
I think I may have been wrong. I used the previous commit rather than delete the lines and the
msgstore.dbwas created. Looking back now, the file was empty!I did post it and decided to remove it as I didn't think you would need it. I knew it was easy enough to create a new one and didn't really know how to send it the correct way.
Might be a good idea to add the
od -t x1 -N 32 keycommand to your issues templateCurrent Key File
I have updated main and ran the new code. This error occurred
Looking through some docs, I found that that
MODE_GCMis no longer supported (MODE_GCM)I installed pycryptodomex and changed line 10 to
from Cryptodome.Cipher import AESWhen I ran the script again, I got this result with a populated
msgstore.dbfileI will test if I can get the files to IOS later tonight.
@ElDavoo commented on GitHub (Mar 25, 2022):
Hi Martin,
As written multiple times, you need to install pycryptodome, not pycryptodomex (EDIT: pycryptodomex is fine, pycrypto is the problem). I might add a check about that.
The important thing is that your key file (the first seen in the wild with version 3) is decoded correctly. (E.g. no errors like "unsupported key version" or similar)
@ElDavoo commented on GitHub (Mar 25, 2022):
I also see that you have no phone number (?) I will check more in detail when I get home
@martinodonnell commented on GitHub (Mar 25, 2022):
I removed that. The number came up correct
@martinodonnell commented on GitHub (Mar 25, 2022):
I deleted all the python packages and and reinstalled them with the versions in the
requirements.txt.The output from script looks good and
msgstore.dbfile has data. I will let you know later when I finish work if I can get the data over to my iPhone@ElDavoo commented on GitHub (Mar 25, 2022):
Yeah, the way it works is that the argparse library automatically creates the filestream for you, on a "wb" mode that means the file will be created and it will be empty if the program errors out before writing anything
I don't think so, the part that i need to see really depends on which part of the parsing fails, so it's better to just send the whole thing directly
This script checks if the decrypted output makes sense so you 99% have a valid msgstore.db. If you want to be sure, open it with a sqlite3 viewer.
If you can't import it in iOS i'm afraid you'll have to open an issue at whatsapp2ios.
@ElDavoo commented on GitHub (Mar 25, 2022):
I guess this happens when you install pycrypto and not pycryptodome. Pycrypto is old and unsupported.
That's MODE_CCM , not MODE_GCM .
I added some informative messages for this kind of errors, I know it can be confusing
To save you some headaches I suggest you to use venv . Virtual environments are very nice: They are a way to make a project's libraries and the system's libraries separate from each other.
From the project's directory, run:
python -m venv venvThis will create a virtual environment in the venv folder.
Check this table to see the command you need to run to activate the venv (it's like "entering inside it"). After that, you can install the libraries as usual with pip. The important concept is that the libraries installed will be stored in the venv folder and will be separate from your system! :)
@ElDavoo commented on GitHub (Mar 25, 2022):
Ok, that should be it! Let me know if you have other problems
@martinodonnell commented on GitHub (Mar 26, 2022):
Good idea, been a while since I did python
@ElDavoo Thanks very much for your help! I'll be back next week to write some tests
I was able to use SQLite on the terminal to open the
msgstore.dband see all the messages.For the next person
Installing SQLite
Common Commands
Run
@ElDavoo commented on GitHub (Mar 26, 2022):
or just use sqlite browser