2

I'd like to read *.db.crypt-files, preferably with PHP. The content is encoded.

Does anyone know how to decode the content or how to figure out what kind of encoding was used?

It's possible. The tool "WhatsApp Xtract" is able to do it, but it's written in python.

hakre
  • 193,403
  • 52
  • 435
  • 836
Mr. B.
  • 8,041
  • 14
  • 67
  • 117
  • 5
    I would go for the python tool and examine it's source-code to find out about which encoding is used. After you've found out, you can port it to PHP. – hakre Dec 17 '12 at 00:29
  • @hakre Thanks for your reply! I'll examine the python code. – Mr. B. Dec 17 '12 at 15:19
  • Check this answer for decrypting the [whatsApp crypt5 DB(android code).](http://stackoverflow.com/a/23380177/2219600) – amalBit Apr 30 '14 at 05:22

1 Answers1

3
$crypt = file_get_contents('msgstore.db.crypt');
$key = pack('H*', '346a23652a46392b4d73257c67317e352e3372482177652c');
$decrypt = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $crypt, MCRYPT_MODE_ECB);
James Whayman
  • 338
  • 3
  • 10
  • Great, thx! But how to get the `$enc`? Do you mean `$crypt`, maybe? – Mr. B. Jan 14 '14 at 00:08
  • The decrypted data is still encrypted. Is `346................52c` the right key/hash? – Mr. B. Jan 14 '14 at 00:23
  • @Mr.Bombastic Yes, sorry, $enc was $crypt, I have updated the code with the correct key too. – James Whayman Jan 15 '14 at 00:44
  • That works fine, thx! There are still crypted lines. I will check if these lines are sent/received images. Another point are Emoticons. A lot of strange lines but the messages are in plain text and readable. Answer happy accepted! :-) – Mr. B. Jan 15 '14 at 23:29