I want add Automatically contacts that message to me in Whatsapp, so I need to access to Whatsapp's database for my program, but Whatsapp's database is not in .db
format and is in .crypt7
format and I cannot use it. How can I use Whatsapp db or convert .crypt7
to .db
?
As Ashesh mentioned you can use the tool on the XDA developer website: [TOOL] Whatsapp Xtract: Backup Messages Extractor / Database Analyzer / Chat-Backup
Alternatively you can do this manually as follows:
The WhatsApp Database is stored unencrypted at this path on the Android device:
/data/data/com.whatsapp/databases/msgstore.db
Backups of the database are also stored encrypted on the SD card typically at the following location:
/sdcard/WhatsApp/Databases/msgstore.db.crypt7
The unique key for the encrypted backup databases is stored here:
/data/data/com.whatsapp/files/key
Access to the /data/data directory requires root access. Alternatively ADB (Android Debug Bridge) can be used to extract the above files after booting into recovery on the device.
How to Decrypt WhatsApp crypt7 Database Messages:
(commands below are run from a linux enviroment)
Extract Decryption Keys from "key" file extracted in step 1:
256-bit AES key:
hexdump -e '2/1 "%02x"' key | cut -b 253-316 > aes.txt
IV (initialisation vector):
hexdump -e '2/1 "%02x"' key | cut -b 221-252 > iv.txt
Strip Header in crypt7 File:
dd if=msgstore.db.crypt7 of=msgstore.db.crypt7.nohdr ibs=67 skip=1
Note: Size of header stripped file in bytes must be divisible by 16
Decrypt crypt7 File:
openssl enc -aes-256-cbc -d -nosalt -nopad -bufsize 16384 -in msgstore.db.crypt7.nohdr -K $(cat aes.txt) -iv $(cat iv.txt) > msgstore.db
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With