Skip to content

Instantly share code, notes, and snippets.

@programminghoch10
Created June 2, 2021 21:34
Show Gist options
  • Save programminghoch10/842af10d716758b6fda29eb20f36942d to your computer and use it in GitHub Desktop.
Save programminghoch10/842af10d716758b6fda29eb20f36942d to your computer and use it in GitHub Desktop.
WhatsApp Data Extractor
rm -r /storage/emulated/0/whatsapp_exports
mkdir -v /storage/emulated/0/whatsapp_exports
cp -r /data/data/com.whatsapp/files/Stickers /storage/emulated/0/whatsapp_exports
mkdir /storage/emulated/0/whatsapp_exports/Avatars
mkdir /storage/emulated/0/whatsapp_exports/AvatarsThumbnail
cp /data/data/com.whatsapp/files/Avatars/* /storage/emulated/0/whatsapp_exports/AvatarsThumbnail
cp /data/data/com.whatsapp/cache/Profile\ Pictures/* /storage/emulated/0/whatsapp_exports/Avatars
cp /data/data/com.whatsapp/files/me.jpg /storage/emulated/0/whatsapp_exports/Avatars
cp /data/data/com.whatsapp/files/status /storage/emulated/0/whatsapp_exports/status.txt
cp /data/data/com.whatsapp/files/statistics.json /storage/emulated/0/whatsapp_exports
mkdir /storage/emulated/0/whatsapp_exports/databases
cp /data/data/com.whatsapp/databases/msgstore.db /storage/emulated/0/whatsapp_exports/databases
cp /data/data/com.whatsapp/databases/wa.db /storage/emulated/0/whatsapp_exports/databases
cp /data/data/com.whatsapp/databases/chatsettings.db /storage/emulated/0/whatsapp_exports/databases
cp /data/data/com.whatsapp/databases/web_sessions.db /storage/emulated/0/whatsapp_exports/databases
cp /data/data/com.whatsapp/databases/stickers.db /storage/emulated/0/whatsapp_exports/databases
cp -r /data/data/com.whatsapp/files/Wallpapers /storage/emulated/0/whatsapp_exports
for file in /storage/emulated/0/whatsapp_exports/AvatarsThumbnail/*.j; do mv "$file" "$file.jpg"; done
for file in /storage/emulated/0/whatsapp_exports/Wallpapers/*; do mv "$file" "$file.jpg"; done
@programminghoch10
Copy link
Author

WhatsApp Data Extractor

A script to automatically extract Profile Pictures, databases, stickers, wallpapers and more from WhatsApp's files.

Story

After I created my script to automatically extract photos and videos from Snapchat,
I thought I could do the same for WhatsApp.

So with the root access I have, I searched through the files of WhatsApp and created a script to collect all the interesting stuff.

How to use

The script is written in a way, such that one can just copy the entire script and paste it into their phones shell.

You need superuser / root privileges for this to work!

  1. Enable Android USB Debugging
  2. Connect the device to your computer
  3. Open a terminal
  4. Run adb shell
  5. Run su to elevate to root privileges
  6. Copy the entire script
  7. Paste it into the terminal, you might need to press enter once after pasting
  8. The script now copies and processes WhatsApp's data
  9. When it finishes, you will find the result on your phone in a folder named whatsapp_exports.

To download the extracted data:

  1. Open a terminal in the folder where the results folder should be copied to
  2. Run adb pull /storage/emulated/0/whatsapp_exports
  3. When it finishes, you will find the resulting data in the folder whatsapp_exports

Description of extracted data

Folder What the folder contains Additional information
Avatars Full-resolution profile pictures For a picture to be saved here, you must have opened the profile picture on your phone lately.
AvatarsThumbnail Small profile picture thumbnails
databases The most interesting databases Read more on how to open these files below.
Wallpapers The currently used chat background wallpaper
Stickers Stickers I guess this contains all of your stickers and stickers you received lately.

The files statistics.json and status.txt are just text files and should be opened as such. status.txt might need advanced text editors, as it's charset is kinda non-standard.

The databases are sqlite3 databases.
They can be queried with sqlite3 <file.db> <SQL-query>,
but they can be more easily examined using a db browser.

Database name What it contains
msgstore.db All written and received messages
wa.db Metadata about contacts and profiles
chatsettings.db
stickers.db Metadata about sticker packs
web_sessions.db Metadata about connected WhatsApp Web sessions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment