B16f00t / whapa

WhatsApp Parser Toolset v1.59
1.09k stars 258 forks source link

encrypt decrypted file again #177

Open praveenyadav1602 opened 2 years ago

praveenyadav1602 commented 2 years ago

how to encrypt decrypted msgstore.db back to crypt14. why there is lock on encrypt button. there are 4 option in menu. 1. file, 2.crypto, 3.key 4.output what to file in second option.

AlbertCalvet commented 1 year ago

Very interested in this as well. The lock icon on the encrypt button I don't think it is related to not being able to perform the operation, but rather a visual representation of the encryption action. Am I right?

I have been able to generate the encrypted database successfully by just inputing in each of the 4 input textboxes the respective paths of each file needed (unencrypted database you want to encrypt, an example of a crypt14 database, the key used on these databases and finally the output path) and clicking on the button.

However if I copy back this new msgstore.db.crypt14 file to the \com.whatsapp\Whatsapp\Databases folder and try to restore in the official Whtasapp client, the backup is detected, but restoration fails instantly with a 100% count and a message telling it could not restore the chat history.

Any idea what might be going on? Is there any special trick to have into consideration when trying to restore this reencrypted databases? Sorry I know github is rather for bugs not for support but there's not many left places to discuss this. Thanks!

AlbertCalvet commented 1 year ago

Well, for what is worth, I had a look at the source code and it seems that although the tool can decrypt either crypt12 or crypt14, when it encrypts it actually does it with the crypt12 format. It seems there is just a small difference in an offset used to do its thing but is critical when later choosing the algorihtm to decrypt again. I suspected this because decrypting/re-encrypting the same database with the correct key and then decrypting, ended up with the WhatasApp Viewer tool complaining that the key was not valid, but clearly it was. So I tried to change extension of the re-encrypted db to crypt12 and decrypt it again with the WA Viewer again and then I ended up with a valid unencrypted database, which confirms that the encryption went ok, its just about the format you end up with.

However, I still cannot do a thing with this crypt12 file, putting it in the official Whatsapp client (or any other that I tried) ends up with instant 100% restore process and an error.

If anyone knows how to follow from there on it would be much appreciated. I don't know if actually implementing the encryption with the crypt14 format might change something in the whatsapp client side. It is my understanding that the WA understands previous formats just fine so it seems this would not help, unless they changed something recently.

Lu5ck commented 1 year ago

ATM, this tool cannot encrypt back to the file that can be read by the whatsapp backup. Therefore, there is little to no reason to use this tool as you can already obtain decrypted "msgstore.db" from "/data/data/com.whatsapp/databases". Likewise, you can simply replace "msgstore.db", "msgstore.db-shm" and "msgstore.db-wal" in "/data/data/com.whatsapp/databases" to apply your changes.

Do note that it is extremely important to replace these 3 files and not just one main file, as the database in android is always in use. To obtain these 3 files in your PC, you just simply need to open the database and you will see it in the folder.

courious875 commented 1 year ago

Having the same problem here. Cannot re-encrypt a crypt12 file so that WhatsApp would recognize it and would restore all messages in it. Do you guys know anyone who successfully re-encrypted a crypt12 file? Many thanks for your input :)

My original crypt12 file got corrupted right after decrypting it. Therefore I have the key and unencrypted database file, but cannot re-encrypt it. Would be very important. Any help is appreciated.

menotuu commented 1 year ago

same prob here what AlbertCalvet 4th Aug. said. thats bad.

NomiRizwan commented 6 months ago

ATM, this tool cannot encrypt back to the file that can be read by the whatsapp backup. Therefore, there is little to no reason to use this tool as you can already obtain decrypted "msgstore.db" from "/data/data/com.whatsapp/databases". Likewise, you can simply replace "msgstore.db", "msgstore.db-shm" and "msgstore.db-wal" in "/data/data/com.whatsapp/databases" to apply your changes.

Do note that it is extremely important to replace these 3 files and not just one main file, as the database in android is always in use. To obtain these 3 files in your PC, you just simply need to open the database and you will see it in the folder.

hi Brother i have these 3 files can i modify the chat replacing in a root mobile. thanks in advance