yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] ztedd:
Merging chat from database file of the receiver into database file of the sender

Great!

You can use SQLite Database Browser or any other SQLite software to edit the chat messages and of course you can switch sender and receiver.

http://sqlitebrowser.sourceforge.net/

First, open the database file from the other person. To make it easier, delete any messages inside the messages table which do not belong to the chat between you and the other person.

You may use the Execute SQL tab in SQLite Database Browser. Use this SQL query:

provided YOUR phone number is 43123456789@s.whatsapp.net (to be sure check if there are entries with key_remote_jid like this):

DELETE FROM messages where key_remote_jid <> "43123456789@s.whatsapp.net"

Now switch key_from_me:

Execute the following queries (at first the first one, then the second, then the third):

UPDATE messages set key_from_me = 9 WHERE key_from_me = 1
UPDATE messages set key_from_me = 1 WHERE key_from_me = 0
UPDATE messages set key_from_me = 0 WHERE key_from_me = 9

Now switch the key_remote_jid:

provided YOUR phone number is 43123456789@s.whatsapp.net and the phone number of the other person is 43987654321@s.whatsapp.net:

UPDATE messages set key_remote_jid = "43987654321@s.whatsapp.net" WHERE key_remote_jid = "43123456789@s.whatsapp.net"

Save the other database. It now only contains the interesting chat and sender and receiver are successfully switched.

Now you need to import the conversation from the other database to your database.

Use the tool SQLite Compare to merge the two databases (see linked howto).

- on the left side, open your own database file

- on the right side, open the other database file ( the one which you edited before to extract the desired chat and switch receiver to sender )

This way it should work out!
[Android Apps and Games] Xelai:
Once you have decrypted the file, you use it the same as the encrypted version, but where sometimes Whatsapp decides it does not find the .crypt file, the unencrypted files works perfectly.

Man, I am extremely thankful for your help, really, I will try it over the weekend.

Impressive work in the decrypt project, but impressive support here, awesome. :good:
[Android Apps and Games] Weldzar:
First of all I want to thank you for this great application.. useful and quite simple to use!

Now, I would want to point the attention to the fact that if I extract the chat history from the database ( or if I extract it by mail with whatsapp), the result is the history from today till some months ago, but not the entire chat history that has more than one year.. what could be the problem?

Whatsapp saves as backup only the recent part of the history?

Thank you
[Android Apps and Games] ztedd:
No, Whatsapp saves the whole database in the backup file. There are two possibilities: First, your Whatsapp doesn't have the full period saved anymore. Try the search function inside Whatsapp to check whether really messages from more than one year still are included.

Second, maybe Whatsapp Xtract crashes somehow during extraction and that's why the generated output file is incomplete. This could be checked, e.g. I could have a look at your file.

Also you can use SQLite Database Browser to check whether the old messages still are included.
[Android Apps and Games] dedo93:
does it work with the iphone's latest version of whatsapp (2.8.6)?
[Android Apps and Games] ztedd:
I don't know - try it. IPhone support was never really finished since I don't have a good and up-to-date sample database file. If you could help me by sending your Chatstorage.sqlite file or creating a new sample and sending it to me, that would be very helpful.

how to create the sample database:

CREATING A SAMPLE DATABASE:

Create a new sample database by reinstalling Whatsapp and then sending some test messages.

Ideally, these should include:

Also you can use SQLite Database Browser to anonymize your database file by modifying/deleting sensitive information.
[Android Apps and Games] IceJoe:
What is "PK"?

What does "PK" stand for in the first column of the HTML output?

Thank you for an excellent script. Worked perfectly! :laugh::D

IceJoe
[Android Apps and Games] ztedd:
PK = something like "Primary Key", the unique identifier number for the chats (first table) / messages (second table).
[Android Apps and Games] IceJoe:
Thank you

Thank you.
[Android Apps and Games] droopyar:
extraction

Someone knows if whatsapp do the backup automatically each day at 4 am? ( i see this on FAQ of whatsapp site).

Is it there any other way of forcing whatsapp app to create the encrypted database when we want? (apart from doing it manually inside the application or installing/uninstalling a new whatsapp applicaton). Any ideas are welcome.

regards.
[Android Apps and Games] Deus_fox:
Nokia

Does the program supports now Nokia especially Nokia C-3?
[Android Apps and Games] ztedd:
No.
[Android Apps and Games] ztedd:
With Tasker it could be possible.
[Android Apps and Games] sushdroid:
I just got an unexpected message when I opened Whatsapp saying "Error: your message history is corrupted. Would you like to restore backup from history?" and when I restored, I got messages only upto 4am, and today's more recent messages are all missing! I just wish there was a way to backup message history automatically at any desired time! Any suggestions?
[Android Apps and Games] CJCord:
there is a possibility to backup history manually:

(OWTTE due to translation): In app: (Options/Menu-soft-touch-button) => Settings => Chat Settings => Backup Chathistory

€: sorry. misread "automatically". still the upper solution is working for doing it manually
[Android Apps and Games] droopyar:
Tasker

How do you do it with Tasker? i dont see how to trigger the backup automatically from the application.

Any script for that? Any help?

Thanks.
[Android Apps and Games] Deus_fox:
Ty

Thanks
[Android Apps and Games] rmaldonado:
Help to read sqlite file. Urgent...Thanks!!

+++++

Hi, My name is Reinaldo and I also ned your help badly. I will really appreciate your support about this case, indeed I can send you the file to your email. Please let me know where you want me to share the file.

I would like to know how I can recover and read all the messages I have in the "sqlite" file.

Thanks a lot for your help!
[Android Apps and Games] ztedd:
Sorry, I can't do all the work for you. Please use google for yourself to get information on how to use tasker - there are plenty.
[Android Apps and Games] Murks28:
Laver Line?

Hi all :)

Does anybody know if there is a similar app for extracting naver line chats? There is a SQLite file for the chats similar to Whatsapp files. But I am not a python expert to adjust the scripts on my own :/

Best wishes

Sue
[Android Apps and Games] adflyer:
thumb_image field decode

I've been working on an application to pull together communications from various sources including WhatsApp (others include disparate website messages, sms, email, skype, msn) into a single database to allow the display of unified threads. This script has been very useful in understanding the WhatsApp database format. Thanks ;)

I have noticed that the thumb_image field isn't decoded in the python, which is a shame because it contains (at least on Android, that I'm looking at) the path to the media. This would eliminate the need for all of that code that tries to match up the media files based on the date plus/minus a couple of days!

The magic number at the start of the field, 0xACED, indicates that thumb_image is a Java object serialization stream. The contents can be fairly easily decoded using the format described in the java docs (just Google for "Java Object Serialization Stream Protocol" - sadly, I can't post a link as a newbie!) You'll see that one of the data items towards the end is the path of the media file.

Hope that helps / is of interest!

(My application exports from sqlite, imports into MySQL and then uses PHP to decode into HTML, hence my thumb_image decoder is written in PHP, rather than python, otherwise I'd have given you some source to do it!)
[Android Apps and Games] benthe:
Are you making an Android app to allow reading and responding to all those services from a single app?
[Android Apps and Games] lordcapy:
That would be nice :P
[Android Apps and Games] arieljannai:
Great tool :)

It really helped me!

One thing I've noticed, when i'm dragging more than one db file to the whatsapp_xtract_drag'n'drop_database(s)_here.bat, and when the db files and the scripts files are in a separate directories - only the first file is being decrypted.

From what I've seen, on the second file, the script is looking for the whatsapp_xtract.py in the db's location instead of the scripts location.

example:

D:\Users\Ariel\Desktop\WhatsApp\Databases>python "D:\Users\Ariel\Downloads\Whatsapp_Xtract_V2.2_2012-11-17\whatsapp_xtract.py" D:\Users\Ariel\Desktop\WhatsApp\Databases\msgstore-2012-09-29.1.db.crypt

Python Version 2.x

Android mode!

trying to repair android database...

trying to decrypt android database...

decrypted database written to D:\Users\Ariel\Desktop\WhatsApp\Databases\msgstore-2012-09-29.1.plain.db

printing output to D:\Users\Ariel\Desktop\WhatsApp\Databases\msgstore-2012-09-29.1.db.html ...

done!

D:\Users\Ariel\Desktop\WhatsApp\Databases>python "D:\Users\Ariel\Desktop\WhatsApp\Databases\whatsapp_xtract.py" D:\Users\Ariel\Desktop\WhatsApp\Databases\msgstore-2012-09-30.1.db.crypt

python: can't open file 'D:\Users\Ariel\Desktop\WhatsApp\Databases\whatsapp_xtract.py': [Errno 2] No such file or directory

for now im just copying them to the same directory, faster than one by one :)

Thanks for the tool!!
[Android Apps and Games] hemantizbest0128:
Hey thanx its working:good:

but its showing chats of last 4-5 days only :(

why its not showing older chats???
[Android Apps and Games] dzay:
hey there again!

Is there any way to figure out the day, month and year from a chatstorage.sqlite database, by opening it with notepad? I mean, does that code that is before the message or somethin' else, could tell me what the date was??
[Android Apps and Games] Julievw:
Whatsapp.exe

I would desperately like to test it.... Please send me your whatsapp.exe file. Hv blackberry messageStore.db

Thanks!
[Android Apps and Games] CVonV:
mine shows upto the most recent msg. but do a manual backup of your chat history first then copy that db...

anyways this tool is great! I was wondering though if someone is able to help me with my problem from within whatsapp. my previous images (sent and received) are no longer openable after I reinstalled whatsapp and restored the history. when I click on the thumbnails from within the conversation it says "Sorry, this media file doesn't exist on your SD card." but the images are all still there as I can view them from the gallery or file manager or even the PC. any new pictures sent/received after the re-installation work fine. and those new pictures are also in the same folder as the previous pictures. my whatsapp installation has always been on the internal SD card. it seems like the links of the previous images are broken somehow?

running this tool and opening the resulting html file correctly links to the all images though.
[Android Apps and Games] huzefa_from_kuwait:
Hello,

I have used this tool and it works perfect, thanks for it.

I want to ask is I have two whatsapp backup files, (one from my old mobile and one from my new mobile). Both whatsapp were registered on the same phone number.

Is it possible to merge both these ,db files and use it in my new phone (so that I can get my old messages also)

I wasn't aware of this backup thing of whats app when I changed the phone but I did however copy the whole file system before formatting it and selling the old phone.

-I apologise if this is a duplicat post, I hope I made myself understandable.

Thanks.
[Android Apps and Games] ark0n3:
Whatsapp iPhone to Android DB converter

if anyone wants to try/help, here's the link to the google drive folder for the Whatsapp iPhone to Android DB converter

https://docs.google.com/folder/d/0B5t-Ej5NEPygalh1bUpJNFZlYzA/edit

it's working correctly but still does not handle some features like group chats (multiple recipients chats) and media (images/positions/etc). i had no spare time to work on the code since september, anyway any alpha-tester is welcome (just click on the link and ask to join the folder)!
[Android Apps and Games] guap:
you litterally saved my life... read my story :| http://xdaforums.com/showpost.php?p=35890159&postcount=779

a big thank you (I know it's forbidden, sorry :angel: )
[Android Apps and Games] gody12:
editiing the outcome

hi,

i would like to thank you for this thread and your whole work. Everythink worked fine and im pretty thankfull for this.

i ve got now all my conversations in this html file and i would like to filter just one of this chats. tried it with a normal html editor, but ofcourse all the smilies where gone. Do you have a program in mind, with which i could delete all the other chats and still keep the smilies and aöüä and stuff?

thank you very much

greetings

gody12
[Android Apps and Games] adytcullen:
did you have any video tutorials to use it..??

i'm little hard to use it..
[Android Apps and Games] ztedd:
Iphone timestamp / deleted messages

In the database file, each message is stored with a timestamp, eg. 304966548. There is a difference between Android and Iphone database files, which is explained here:

http://blog.digital-forensics.it/2012/05/whatsapp-forensics.html?showComment=1348006984006#c351495555264276318

You can use this website to transfer an epoch timestamp into a human readable format without using python:

http://www.epochconverter.com/

However, for Iphone Chatstorage.sqlite files, first you have to use the calculator to manually add the +11323*60*1440 to the timestamp (calculate timestamp + 978307200, then enter the result in the website and you get the responding date).

No, as told a several times before, it's known and noticed that Whatsapp somehow still stores deleted messages in the SQLite database file, but in a for SQLite tools unreadable format. Up to now, no one was able to deliver information on how to read this information in an automated way - you still have to rely on notepad or an hex editor to do that. If there is any update, we will tell in this thread. But please, don't repeat to ask for that. I won't invest efforts in solving this. Only if someone finds a solution, I would think about including it in the code.
[Android Apps and Games] ztedd:
merging two database files

Use the tool SQLite Compare to merge the two databases (see linked howto).
[Android Apps and Games] ztedd:
Great! I'm glad it helped you! :)
[Android Apps and Games] ztedd:
Thank you! :)

There are two possibilities, first, deleting the unwanted chats from the database file before converting it with Whatsapp Xtract or second, deleting the unwanted chats from the html file.

First option:

- Download&install SQLite Database Browser

- Open the input Database file (Chatstorage.sqlite OR msgstore.db OR msgstore.plain.db) in SQLite Database Browser

- go to "Browse data" and then to ZWACHATSESSION (Iphone) OR chat_list (Android)

- delete all unwanted entries

- save database file

- run Whatsapp Xtract on the database file

Second option:

- Download&install Notepad++

- Open the *.htm file that Whatsapp Xtract generated

- Open it also in a browser, look for the text of the first and last message you want to delete

- Inside Notepad++, search for the text of the first message. Then mark everything from the first starting "<tr class" .... of the first message you want to delete till the last "</tr>" of the last message you want to delete. Delete the whole marked text.

- Save.
[Android Apps and Games] ztedd:
That's a really great hint! I'll look into this. Maybe you can send me the PHP code you used?
[Android Apps and Games] ztedd:
whatsapp_xtract_drag'n'drop_database(s)_here.bat

Yes, thanks for your feedback, you're right, that whatsapp_xtract_drag'n'drop_database(s)_here.bat up to now only works with multiple files in the same directory as the script. However, I updated the batch file and in the next version of Whatsapp Xtract it will be included and you'll be able to use it with multiple files in a different directory as well!
[Android Apps and Games] ztedd:
WhatsAppMigrator (Whatsapp iPhone to Android DB converter)

Great! Thank you a lot for continuing your work on your WhatsAppMigrator!

I didn't have much time to look into it, however. I get errors like

and

.

It seems that it quite rigorously expects a certain kind of database format, but the database format changed from time to time. So either it should be more tolerant to different structure, or you should provide a working empty Android msgstore.db file for the conversion...

However, maybe we shouldn't discuss all the issues of the WhatsAppMigrator here. You could start a new thread for your tool where we can discuss all problems, howtos and work on it.
[Android Apps and Games] ztedd:
View / Extract Iphone Whatsapp Messages with I-Twin instead of Whatsapp Xtract

By the way, for Iphone Whatsapp, there now exists another alternative. The tool I-Twin is beginning to support Whatsapp since the latest version:

http://www.i-twin.de/de/download

The author of I-Twin says that he is still working on it and this is a beta version screenshot:

However I still think that Whatsapp Xtract (http://xdaforums.com/showthread.php?t=1583021) is the better alternative, since it's free, open-source and better in converting multiple database files at once into html.

However we still haven't updated the Iphone support for media and group messages because we don't have a sample Iphone database including these kinds of messages. So if you want to help, you can send us such an Iphone Chatstorage.sqlite file (see How to create sample database).

As soon as the Whatsapp support of I-Twin is further developed, it will provide you an easier alternative to Whatsapp Xtract, as it's not so complex to use for beginners and the messages will be shown directly in the program instead of creating an html file which needs to be opened in a browser (export options are included as well, including text, html and pdf).

So you may try it and decide if it helps!
[Android Apps and Games] Marvi70:
hi ztedd,

many thanks for your great work!

I saw that the whatsapp-db (android) contains more information as the extractor shows. e.g. the received_timestamp.

Whatsapp also shows only the "timestamp" value, which is the send-time. It's a little bit confusing, when you asked, why you didn't answer a chat and you didn't even received it ;)

Maybe it's an additional point on your future-feature-list to add an additional field?

I tested it with setting my phone to flightmode. An arriving chat message will have the sending time (not the receiving time), when deactivating the flightmode.

Kind regards

Marvi70
[Android Apps and Games] gody12:
i do hope i wont get a warning for this, but dude you are a ****ing god. Thank you very much :)
[Android Apps and Games] ztedd:
That's nice, I like that I could help. :) If you want to "say Thank you!", I really appreciate ukash Codes as donation, see www.ukash.com to find out where to buy such a code for me or go to http://www.pcgamesupply.com/buygames/Ukash-Voucher-Online/ to buy it online.

Here you can send me a message: Send message to ztedd

Thanks :)
[Android Apps and Games] rararafael:
Windows Phone

Hi!

I discovered this program today, and it seems that no one shared a way to backup the files from windows phone devices.

I managed a way to extract the files a long time ago (for backup), but I didn't know a way to read them (before it was in a different format), but now I guess that my info can be useful!

I don't know if you have access to whatsapp Isolated Storage directly. If you do, just backup the folder to your computer. If you don't, use my noob way... here is what I did (btw, my mobile phone = HTC HD2):

Step 1: install root tools

Step 2: go to explorer, and copy 218A0EBB-1585-4C7E-A9EC-054CF4569A79 folder on Applications\Data\ to an isolated storage folder of an application witch can be acceded by an isolated storage explorer

Step 3: open an isolated storage tool explorer and copy that folder to the computer

I guess it won't be difficult to read, I opened it on Notepad++, and it is not encrypted. It is in a SQLite 3 format, all readable in plain text, I really would love to have it in a graphic way. I tried to open it with SQLite Browser, but it doesn't show me anything.

I will send a PM with a sample to ztedd.

Hope I helped to improve the program ;)
[Android Apps and Games] GFXi0N:
Ok: I have this problem:

I was making daily backups with titanium backup until my phone got bricked...

Now, I'm using a backup phone but I forgot to restore the backups (I just didn't think about it)...

With this tool, can I merge both backups (the current one and the old one) in a same backup?

I want to do this because in the old phone's backup, the crashed one, I have all my whatsapp conversations from january 2012 until a month ago, when it said goodbye

The new phone just has the latest month.

My idea is open the old backup and add the newest conversations to it, then restore it, is it possible?

Thank you :)
[Android Apps and Games] ztedd:
This tool can help you at least to show the content of one of the backups on a computer - or as an html file on your phone, as well. It's not able to merge multiple backups. But this already has been asked before and so we figured out some solution that is, however, a bit difficult. Anyway, if you want to try: just go one page back, there is the link:
[Android Apps and Games] GFXi0N:
hi!

I'm trying to get the msgstore.plain.db files of my messages but it says

Python Version 2.x
Android mode!

trying to repair android database...
trying to decrypt android database...
decrypted database written to msgstore.plain.db
trying to repair decrypted android database...
Could not open database file. Guess it's not a valid Android or Iphone database file.

These databases are from circa november 2012... is this because they are "too old"? - they are the databases I got from /data

What can I do?
[Android Apps and Games] habibalby:
Can't make it work

I can't make it this work at all;

D:\D Drive\Softwares\Whatsapp_Xtract_V2.1_2012-05-10-2>python -i whatsapp_xtract

.py msgstore.db.crypt

Python Version 2.x

Android mode!

trying to repair android database...

trying to decrypt android database...

Traceback (most recent call last):

File "whatsapp_xtract.py", line 2062, in <module>

main(sys.argv[1:])

File "whatsapp_xtract.py", line 988, in main

from Crypto.Cipher import AES

ImportError: No module named Crypto.Cipher

>>>

C:\Windows\system32>pypm install pyodbc

The following packages will be installed into "%APPDATA%\Python" (2.7):

pyodbc-3.0.3

error: Can't install pyodbc-3.0.3: requires Business Edition subscription

*** If you have purchased ActivePython Business Edition, please login to

*** your account at:

*** https://account.activestate.com/

*** and download and run the license installer for your platform.

***

*** Please visit <www.activestate.com/business-edition> to learn more

*** about the ActivePython Business Edition offering.

C:\Windows\system32>
[Android Apps and Games] GFXi0N:
You installed the 64bit version

Install the 32 bit one
[Android Apps and Games] ztedd:
The database file is corrupt. As it says, "it's not a valid Android or Iphone database file". Try to open it with a SQLite tool like SQLite Database Browser (http://sqlitebrowser.sourceforge.net/) - if it can't open it, then the file is corrupt and can't be opened by Whatsapp Xtract, as well.

Try to copy it a second time, maybe using another way, e.g. copy the msgstore.db.crypt from the SD card (folder /WhatsApp/Databases) instead of the file from the internal store. Or try to copy it from the SD card directly (using a card reader) instead of mounting the phone on USB. Etc...