Blog/20180506 Backing up WhatsApp on the commandline for Android 7

From Bjoern Hassler's website
Jump to: navigation, search

More from B's blog:

Some older entries are here.

1 Backing up WhatsApp on the commandline for Android 7

This is a write-up of [1]. This recipe works if:

  • You're on Android.
  • You know how to use the command line and adb
  • You get these scripts
  • 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 [2] 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' [3].

2 Step I: Getting the key.

  1. What device do you have?
    1. If you have an Android 6 device (or lower), the script from [4] will work. You may still want to follow the steps below, so you don't have to keep downgrading WhatsApp every time.
    2. 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.
  2. 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).
  3. 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 [5] 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 | Leave a comment | Back to blog Share on Twitter Share on Facebook