There will be three main phase you need to perform. You can get all required file in the attachment. Make sure you backup your end result before jump into the next phase.
Phase A: Decrypt and obtain msgstore.db file
This is the easiest method I can find and NO ROOT is required to perform this. All you need is to follow the instruction below.
- Extract "WhatsAppKeyExtract.zip" (from attachment) on your computer maintaining the directory structure.
- Browse to the extracted folder and click on "WhatsAppKeyExtract.bat".
- Enable USB Debugging on your device.
- Connect your device via USB**, unlock your screen and wait for "Full backup" to appear.
- Leave the password field blank and tap on "Back up my data".
- The "extracted" folder will now contain your "whatsapp.key", "msgstore.db" and "wa.db".
(Credited to TripCode for providing this application! Here is the link to original thread.)
For my case, I have three backup files that named msgstore.db.crypt, msgstore.db.crypt7 and msgstore.db.crypt8. Although I know there might be other easier method to achieve this, I choose to restore each file (by uninstall and install WhatsApp) and run the above method to get my decrypted file. Hence I can be sure that all decrypted file will come in the same structure (I will show you what this mean later) and prevent any error that may cause by that.
Phase B: Edit and prepare database for merge
This will be a bit tricky. But in general, you MUST make sure that you have no overlapping message history between your files.
- Download SQLite Database Browser and install on your computer.
- Open the database you want to edit.
- Click on [Browse Data] tab.
- In Table drop down menu, click on [messages] (You will see all your WhatsApp message here).
- Use it like you are using Excel, select any row that is overlapping (EXCEPT the row with many [-1] value) and click on [Delete Record], then click on [Write Changes] (this means you have save the change to the database).
- Keep doing this for your remaining file and close all windows of SQLite Database Browser when you are done.
For my case, the number of column of all my file when display in "messages" table is different (newer WhatsApp database file have more data type). This is the reason I restore and run backup again to make sure all my file have the same structure. Also, a quick tips to figure out which row is overlapping or duplicate is export the messages table to CSV file and open it with Excel. You will need to copy the first few column of each database and paste them together, then use the feature that come with Excel such as Filter and Remove Duplicate to identify which row number you need to remove from actual database file.
IMPORTANT - Never edit your database on excel and import it back to your original database. This will remove all thumbnail, link, emoticon and etc. and show you some weird message when you restore back to your device.
Phase C: Merge database file
This method only can merge two file at once. You may need to do this several time depending how many database you want to merge. I suggest you start from the oldest to newest.
- Rename the older file to old.db.
- Rename the newer file to new.db
- Create a new folder called Merge and copy the file old.db, new.db and merjapp.jar into it.
- Run Command Prompt on your computer (or click on Start Menu and search for cmd)
- In Command Prompt, type each of the following separately and press Enter:
cd desktop cd merge
- You now should see [C:\Users\<UserName>\Desktop\Merge>] in cmd window.
- Now type the following and press Enter:
java.exe -jar merjapp.jar -old old.db -new new.db
- You should see a "Done!" is displayed and a new file named output.db will be created in the Merge folder.
- If you have other database to merge, repeat the steps above by rename the output.db to old.db.
- Once you are done, rename the output.db to msgstore.db and it is ready to restore into WhatsApp.
For my case, I have to run this steps twice to merge 3 databases. I get error the first time I run this because some messages is overlapping and this is the reason for Phase B to edit my database. Once I got my merged database, I renamed it to msgstore.db (without encrypt again) and have no problem restore back to my device. I also copy and paste all my backed up WhatsApp folder to my device (except the file in Database folder) for the picture in WhatsApp to work.
Disclaimer: I do not know any coding behind all these so if you have any questions I will try to answer but the best bet is to go back to the original thread.
Below is some other method that I found online but can't figure out how to do it. You may try it at your own risk.
sch3m4's wforensic Method
Alternate sch3m4's wforensic Method