How to dump your Whatsapp chat messages to a csv file

Pre-requisites:
Linux pc with java jdk installed (Does not work with oracle jdk).
adb in the path

First get your whatsapp database:
adb pull /sdcard/WhatsApp/Databases/msgstore.db.crypt12
Decrypt the file:
git clone https://gitlab.com/digitalinternals/whatsapp-crypt12.git
javac -classpath “lib/whatsapp_spongycastle.jar:.” crypt12.java
Now pull the key for whatsapp from your phone (Requires root):
adb shell
su
cp /data/data/com.whatsapp/files/key /sdcard
exit
adb pull /sdcard/key
java -cp “lib/whatsapp_spongycastle.jar:.” crypt12

sqlite3
sqlite> .open msgstore.db
sqlite> .tables
chat_list messages_fts_content
frequents messages_fts_segdir
group_participants messages_fts_segments
group_participants_history messages_links
media_refs messages_quotes
media_streaming_sidecar messages_vcards
message_thumbnails messages_vcards_jids
messages props
messages_edits receipts
messages_fts status_list
sqlite> .schema messages
sqlite> .mode csv
sqlite> .headers on


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Speak Your Mind

*