Blog/20180506 Backing up WhatsApp on the commandline for Android 7
1 Backing up WhatsApp on the commandline for Android 7
This is a write-up of . This recipe works if:
- You're on Android.
- You know how to use the command line and adb
- You get these scripts https://github.com/EliteAndroidApps
- You have a spare pre Android 7 phone, such as an Android 6 phone, or a phone with a lower version than 6 (temporarily).
Why this recipe is needed:
- From Android 7 onwards, WhatsApp cannot be downgraded. The above script 'WhatsApp-Key-DB-Extractor' relies on this, and so script won't work now (and probably never will) under Android 7+.
- This article  also suggests that the adb backup functionality is disabled.
However, here's some good news. The whatsapp message store (msgstore.db.crypt12) is kept on internal SD card: It's put there when WhatsApp backs up (to SD card, and optionally to Google Drive). Therefore, once you have the key, you can then decrypt that file using 'WhatsApp-Crypt12-Decrypter' .
2 Step I: Getting the key.
- What device do you have?
- If you have an Android 6 device (or lower), the script from  will work. You may still want to follow the steps below, so you don't have to keep downgrading WhatsApp every time.
- If you have an Android 7+ device (with WhatsApp) and an Android 6 device, sync your WhatsApp to Google Drive, and then transfer to the Android 6 device.
- You now have your WhatsApp data on the Android 6 device. Use 'WhatsApp-Key-DB-Extractor' to extract the key (and backup up your messages of course).
- Then transfer your WhatsApp back to the Android 7 device.
3 Step II: Using the key.
Whenever you want to do further backups (on your Android 7 device):
- Back up WhatsApp to internal storage (it's in the WhatsApp settings)
- Get the msgstore.db.crypt12 from internal storage
adb pull -a /storage/emulated/0/WhatsApp/Databases
(The correct adb command may depend on your Android version and phone type.) Then use WhatsApp-Crypt12-Decrypter  to decrypt your store.
4 Some notes
- One caveat to this is that I don't know whether the WhatsApp key might change as you upgrade, or change devices in the future. Also, I guess WhatsApp may eventually become unavailable for Android 6, blocking this recipe altogether.
- You may need an older version of adb e.g. if your older Android phone is e.g. Android 4 (such as adb 1.0.31).
- Once you have the database, you'll need to work out how to read your messages. There are some scripts around that can convert to the database to HTML.
2018-05-06 | Back to blog|