WhatsApp database decrypt

Posted by in Databases, Python

#WhatsApp has become in a very popular app to chat with your contacts on smartphones. Some of you could ask you why I am writting aboout WhatsApp in www.manejandodatos.es? Easy:

Every action on WhatsApp is stored on a database, a SQLite database.

Before success occurs, WhatsApp was an app where the important role was chat with contacts and sharing photos and videos. The database selected to store everything was the best for this king of app:SQLite, although in the first versions nobody ask for security.

However, a few versions ago, WhatsApp decided to encrypt the database and … after that, it was impossible to load the SQLite database on a SQLite manager. Let’s try to go further …

On Internet I found the WhatsApp Xtrac project, so, I decided to give it a try. The requirements are Python 2.7 (I already told you how to install it) and PyCripto. Because I am using the Anaconda version of Python, I don’t event have to install anything, becuase it’s already installed.



Anyway, if you need to install PyCrypto, just download the package from here and in less that a minute it will be installed! (under Windows, in my case).

Now, let’s try to decrypt the WhatsApp database::

Desencriptando WhatsApp

Decrypt WhatsApp database

Although I got an error, I can see how a few tables are written on SQLite, so I check it on an SQLite admin.

Desencriptando WhatsApp

Decrypt WhatsApp database

There are a few thing of this project that I’m not convinced, but I must say … it works!

I don’t feel very happy with the results, also the error, so …  I read the documentation again, and I found I made a mistake. Let’s try again with the right sentence::

Descencriptar WhatsApp

Decrypt WhatsApp database

Now, everything seems to work fine. Here you can see the list of files used:

Directorio de WhatsApp

Files use to decrypt WhatsApp database

And of course, the HTML with my conversations, with all my conversations (I omitted some confidential info, but you can see the result!!):

Informe de conversaciones en WhatsApp

HTML file with WhatsApp conversations

More than one will be surprised because all stuff stored in a “single” database: even photos. If you want to see the files, apart from msgstore.db.crypt, copy also the /Media directory.

Reading the code, and maybe because of my way of programming, I cann’t understand why the Python code mix CSS, Javascript, HTML …. instead of creating an HTML5 template, and using different files. At least, the desing is good!

To end with and if you would like to improve the Python’s code, it won’t be difficult to improve functionality, but I’m not in the mood of doing it!

And of course, the tool does its jobs perfectly!

Ah, and I’m not responsible of what you do with I told you in this post, only for educational purposes!

Update 2018 Febrarym and here you have a “cool” project in case you want to “work” with WhatsApp: https://github.com/B16f00t/whapa

Have a nice day, and if you like the content, please, feel free to donate !

Google+ Comments - Comentarios Google+