andreas-mausch / whatsapp-viewer

Small tool to display chats from the Android msgstore.db database (crypt12)
https://andreas-mausch.de/whatsapp-viewer/
MIT License
1.23k stars 381 forks source link

Two different errors: older version of WhatsApp Viewer and no such table: chat_list #151

Open UeliDragutin opened 2 years ago

UeliDragutin commented 2 years ago

Using the WhatsApp extractor (YuvrajRaghuvanshiS / WhatsApp-Key-Database-Extractor) which will output some files including the key and msgstore.db.

So, using the version 1.15 to open the msgstore.db, I was greet with the following error message:

It seems like you tried to open an older WhatsApp database. Please try to use an older version of WhatsApp Viewer.

So, I use the version 1.14, which give me the same error as above. This goes the same for 1.13 and 1.12.

Then I decide to try the 1.11 version of Whatsapp viewer and was greet with another error message:

Could not load chat list; SQLite error: 1; no such table: chat_list

This error also appear when I use the version 1.10 and 1.9.

Help needed, thanks.

serginator commented 2 years ago

+1

ammm84 commented 1 year ago

Exactly same problem here. Did you resolve it?

Using the WhatsApp extractor (YuvrajRaghuvanshiS / WhatsApp-Key-Database-Extractor) which will output some files including the key and msgstore.db.

So, using the version 1.15 to open the msgstore.db, I was greet with the following error message:

It seems like you tried to open an older WhatsApp database. Please try to use an older version of WhatsApp Viewer.

So, I use the version 1.14, which give me the same error as above. This goes the same for 1.13 and 1.12.

Then I decide to try the 1.11 version of Whatsapp viewer and was greet with another error message:

Could not load chat list; SQLite error: 1; no such table: chat_list

This error also appear when I use the version 1.10 and 1.9.

Help needed, thanks.

aReaSa commented 1 year ago

+1

AD1977 commented 1 year ago

Hi, I also have the exact same problem. The files were extracted from Encryption 14 but cannot be viewed. With the same error message. I would love for comments .. Thank you very much

WindMaster12 commented 1 year ago

This issue seems to have been around for 2 months now. Any solution at all please?

Ogradion commented 1 year ago

same here

ayberkjs commented 1 year ago

Same issue, need help

mauro-60 commented 1 year ago

same here

vb0 commented 1 year ago

They changed the tables in recent versions of Whatsapp. whapa breaks for lack of "messages" (it's called "message" now). There's no chat_list either. The only alternative I know of is to use sqlitebrowser but of course it's extremely cumbersome, it's good mostly to confirm you have the right db and all is decrypted well.

Otherwise for decryption https://github.com/ElDavoo/WhatsApp-Crypt14-Crypt15-Decrypter works REALLY well, including for the new E2E encryption (at least for the hexdumped key, not sure how you get that if you set a password instead, anyway for now just use in WA that 64-character encryption key instead of the more comfortable user-defined password). This is huge because it means no more shenanigans with find the key.

ReMiOS commented 1 year ago

I have the same issue

It appears the table scheme has been altered Maybe a solution would be to create a view with te table name in the DB with the used columns

Used Tables:

messages (_id, key_remote_jid , key_from_me , key_id , status , needs_push , data , timestamp , media_url , media_mime_type , media_wa_type , media_size , media_name , media_caption , media_hash , media_duration , origin , latitude , longitude , thumb_image , remote_resource , received_timestamp , send_timestamp , receipt_server_timestamp , receipt_device_timestamp , read_device_timestamp , played_device_timestamp , raw_data , recipient_count , participant_hash , starred , quoted_row_id , mentioned_jids , multicast_id , edit_version , media_enc_hash , payment_transaction_id , forwarded , preview_type , send_count , lookup_tables , future_message_type , message_add_on_flags) => Is Missing in new database

messages_links (_id, key_remote_jid , message_row_id , link_index ) => Is Missing in new database (partial in table message_link )

messages_quotes (_id , key_remote_jid , key_from_me , key_id , status , needs_push , data , timestamp , media_url , media_mime_type , media_wa_type , media_size , media_name , media_caption , media_hash , media_duration , origin , latitude , longitude , thumb_image , remote_resource , received_timestamp , send_timestamp , receipt_server_timestamp , receipt_device_timestamp , read_device_timestamp , played_device_timestamp , raw_data , recipient_count , participant_hash , starred , quoted_row_id , mentioned_jids , multicast_id , edit_version , media_enc_hash , payment_transaction_id , forwarded , preview_type , send_count , lookup_tables , future_message_type , message_add_on_flags ) => Is Missing in new database

message_thumbnails (thumbnail , timestamp , key_remote_jid , key_from_me , key_id ) => Exists and is identical

nufrankz commented 1 year ago

I have the same issue

It appears the table scheme has been altered Maybe a solution would be to create a view with te table name in the DB with the used columns

Used Tables:

  • message_thumbnails
  • messages_quotes
  • messages_links
  • messages

So hard to do. Being completely a newbie in SQLite, I downloaded DB Browser and I can see the data, tried to renaming table "message" to "messages" without success, I guess I've to do a new View and I'm currently learning to do that.

ReMiOS commented 1 year ago

I've created a workaround for the changed table scheme in the WhatsApp msgstore.db database

A rewrite of the code would be better, hopefully this will help the developers to make the code working again without the need for this workaround.

This file creates the missing tables

Also it adds some indexes to make it load faster

N.B. i could not find the column "quoted_row_id" as in the old version, but referring to "_id" works for finding a column, this statement appears to be very useful SELECT DISTINCT name FROM sqlite_master WHERE sql like '%%'

Just run this executable in the same folder as the msgstore.db file wav_create_table.zip

You can achieve the same result by running the following SQL statements:

CREATE TABLE IF NOT EXISTS messages AS SELECT file_hash,message._id,message.chat_row_id,message.key_id,jid.raw_string AS key_remote_jid,message.from_me AS key_from_me,
message.status,message.text_data AS data,message.timestamp,message_media.message_url AS media_url,message.message_type AS media_wa_type,message_media.file_size 
AS media_size,message_media.mime_type AS media_mime_type,message_media.media_name,message_media.media_caption,message_media.media_duration,message_location.latitude,
message_location.longitude,message_media.file_path AS thumb_image,receipts.remote_resource,message_thumbnail.thumbnail AS raw_data, message._id AS quoted_row_id 
FROM message LEFT JOIN message_media ON message._id = message_media.message_row_id LEFT JOIN chat ON message.chat_row_id = chat._id LEFT JOIN jid ON jid_row_id = jid._id 
LEFT JOIN message_location ON message._id = message_location.message_row_id LEFT JOIN receipts ON message.key_id = receipts.key_id LEFT JOIN message_thumbnail 
ON message._id = message_thumbnail.message_row_id

CREATE TABLE IF NOT EXISTS messages_quotes AS SELECT message_row_id AS _id, chat_row_id, parent_message_chat_row_id, from_me, sender_jid_row_id, key_id, timestamp,message_type,
text_data, payment_transaction_id, lookup_tables, origin FROM message_quoted

CREATE TABLE IF NOT EXISTS messages_links AS SELECT * FROM message_link

CREATE INDEX IF NOT EXISTS messages_chat_id_index ON messages (chat_row_id,_id)

CREATE INDEX IF NOT EXISTS messages_jid_id_index on messages (key_remote_jid, _id)

CREATE INDEX IF NOT EXISTS messages_key_index on messages ( key_remote_jid, key_from_me, key_id )
blshkv commented 1 year ago

thanks, that's almost working. I ran these sql commands, and tried to use whatsapp-viewer and whapa, both tools failed with the same error: Error: no such column: messages.edit_version

could you have a look what could be wrong?

P.S. you missed ; at the end of each string

vb0 commented 1 year ago

@blshkv for me it works. Thanks @ReMiOS

ReMiOS commented 1 year ago

thanks, that's almost working. I ran these sql commands, and tried to use whatsapp-viewer and whapa, both tools failed with the same error: Error: no such column: messages.edit_version

could you have a look what could be wrong?

P.S. you missed ; at the end of each string

There is no need for ";" if you run don't run the SQL statements at once this way you can see the output for each SQL statement (I use both "SQuirrel" and "DB Browser for SQlite" )

I cannot reproduce your error, what version of WhatsApp Viewer do you use ? Did you also use the attached wav_create_table.exe ?

Maybe this works for you:

DROP TABLE IF EXISTS messages;

CREATE TABLE IF NOT EXISTS messages AS SELECT file_hash,message._id,message.chat_row_id,message.key_id,jid.raw_string AS key_remote_jid,message.from_me AS key_from_me,
message.status,message.text_data AS data,message.timestamp,message_media.message_url AS media_url,message.message_type AS media_wa_type,message_media.file_size 
AS media_size,message_media.mime_type AS media_mime_type,message_media.media_name,message_media.media_caption,message_media.media_duration,message_location.latitude,
message_location.longitude,message_media.file_path AS thumb_image,receipts.remote_resource,message_thumbnail.thumbnail AS raw_data, message._id AS quoted_row_id, NULL AS edit_version 
FROM message LEFT JOIN message_media ON message._id = message_media.message_row_id LEFT JOIN chat ON message.chat_row_id = chat._id LEFT JOIN jid ON jid_row_id = jid._id 
LEFT JOIN message_location ON message._id = message_location.message_row_id LEFT JOIN receipts ON message.key_id = receipts.key_id LEFT JOIN message_thumbnail 
ON message._id = message_thumbnail.message_row_id;
blshkv commented 1 year ago

Thanks for the updated sql commands! I use linux, didn't run wav_create_table.exe. I use the latest git for each tool, got the following from different tools:

WhatsApp-whapa
   Error: no such column: messages.recipient_count
whatsapp-exporter-main/src/main.py", line 19, in query_messages
    for received_timestamp, remote_resource, key_from_me, data, media_caption, media_wa_type in cur.execute(query, {"key_remote_jid": key_remote_jid}):
sqlite3.OperationalError: no such column: received_timestamp
 ./wtsexporter
Whatsapp_Chat_Exporter/extract.py", line 200, in messages
    c.execute("""SELECT messages.key_remote_jid,
sqlite3.OperationalError: no such column: messages_quotes.data
vb0 commented 1 year ago

I just switched now to crypt15 (E2E backups) that are decrypted fine by https://github.com/ElDavoo/WhatsApp-Crypt14-Crypt15-Decrypter (they were since the feature was supported but you could only browse the data with sqlitebrowser because of the table problems we're having). I guess this would be the recommended way forward as there is no problem to obtain the key (it's just shown to you).

With the first version of "manipulations" from above WhatsappViewer works fine. The second version, doesn't work, also it creates a db about 20% smaller.

ReMiOS commented 1 year ago

WhatsApp-whapa Error: no such column: messages.recipient_count sqlite3.OperationalError: no such column: received_timestamp sqlite3.OperationalError: no such column: messages_quotes.data

You should discuss this on the whapa github https://github.com/B16f00t/whapa

for the missing tables add "message.recipient_count , message.received_timestamp, message_quoted.text_data as data" to the SQL create table statement

serginator commented 1 year ago

@ReMiOS thanks for your work! I've tried to run the executable but it failed with error Failed to execute script wav_create_table. Also tried to execute the commands by hand and didn't work neither, here are the results of the first query for example:

$ sqlite3 msgstore.db
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> CREATE TABLE IF NOT EXISTS messages AS SELECT file_hash,message._id,message.chat_row_id,message.key_id,jid.raw_string AS key_remote_jid,message.from_me AS key_from_me, message.status,message.text_data AS data,message.timestamp,message_media.message_url AS media_url,message.message_type AS media_wa_type,message_media.file_size AS media_size,message_media.mime_type AS media_mime_type,message_media.media_name,message_media.media_caption,message_media.media_duration,message_location.latitude, message_location.longitude,message_media.file_path AS thumb_image,receipts.remote_resource,message_thumbnail.thumbnail AS raw_data, message._id AS quoted_row_id FROM message LEFT JOIN message_media ON message._id = message_media.message_row_id LEFT JOIN chat ON message.chat_row_id = chat._id LEFT JOIN jid ON jid_row_id = jid._id LEFT JOIN message_location ON message._id = message_location.message_row_id LEFT JOIN receipts ON message.key_id = receipts.key_id LEFT JOIN message_thumbnail ON message._id = message_thumbnail.message_row_id;
Error: no such column: message_media.media_caption
ReMiOS commented 1 year ago

@ReMiOS thanks for your work! I've tried to run the executable but it failed with error Failed to execute script wav_create_table. ```

Did you run wav_create_table.exe in the same folder as the msgstore.db ?

serginator commented 1 year ago

Did you run wav_create_table.exe in the same folder as the msgstore.db ?

Of course. Maybe there are even more different versions of the db? I don't know. The thing is that if I run the SQL statements it fails too saying that there is no message_media.media_caption column

ammm84 commented 1 year ago

@ReMiOS thanks for your work! I've tried to run the executable but it failed with error Failed to execute script wav_create_table. ```

Did you run wav_create_table.exe in the same folder as the msgstore.db ?

I get the same error when running the exe. Anyway, as Serginator told you, thank you so much for your work!

nufrankz commented 1 year ago

Just run this executable in the same folder as the msgstore.db file wav_create_table.zip

Hello @ReMiOS, works like a charm! Thank you, and plus for the code.

ReMiOS commented 1 year ago

Did you run wav_create_table.exe in the same folder as the msgstore.db ?

Of course. Maybe there are even more different versions of the db? I don't know. The thing is that if I run the SQL statements it fails too saying that there is no message_media.media_caption column

I only have the DB version with message_media.media_caption column to test it with you can try to replace "message_media.media_caption" in the SQL statement with "NULL as media_caption"

serginator commented 1 year ago

Did you run wav_create_table.exe in the same folder as the msgstore.db ?

Of course. Maybe there are even more different versions of the db? I don't know. The thing is that if I run the SQL statements it fails too saying that there is no message_media.media_caption column

I only have the DB version with message_media.media_caption column to test it with you can try to replace "message_media.media_caption" in the SQL statement with "NULL as media_caption"

Sorry, I couldn't try it until today, and it worked flawlessly replacing in the first statement message_media.media_caption with NULL as media_caption. And then the other statements worked well too, so I was able to open the db with Whatsapp Viewer. Thanks @ReMiOS !!!! :)

BOJO2022 commented 1 year ago

thanks @ReMiOS. your help means a lot and it came in right time to me. May god bless you brother!

dheorr commented 1 year ago

I've created a workaround for the changed table scheme in the WhatsApp msgstore.db database

A rewrite of the code would be better, hopefully this will help the developers to make the code working again without the need for this workaround.

This file creates the missing tables

  • messages
  • messages_links
  • messages_quotes

Also it adds some indexes to make it load faster

N.B. i could not find the column "quoted_row_id" as in the old version, but referring to "_id" works for finding a column, this statement appears to be very useful SELECT DISTINCT name FROM sqlite_master WHERE sql like '%%'

Just run this executable in the same folder as the msgstore.db file wav_create_table.zip

You can achieve the same result by running the following SQL statements:

CREATE TABLE IF NOT EXISTS messages AS SELECT file_hash,message._id,message.chat_row_id,message.key_id,jid.raw_string AS key_remote_jid,message.from_me AS key_from_me,
message.status,message.text_data AS data,message.timestamp,message_media.message_url AS media_url,message.message_type AS media_wa_type,message_media.file_size 
AS media_size,message_media.mime_type AS media_mime_type,message_media.media_name,message_media.media_caption,message_media.media_duration,message_location.latitude,
message_location.longitude,message_media.file_path AS thumb_image,receipts.remote_resource,message_thumbnail.thumbnail AS raw_data, message._id AS quoted_row_id 
FROM message LEFT JOIN message_media ON message._id = message_media.message_row_id LEFT JOIN chat ON message.chat_row_id = chat._id LEFT JOIN jid ON jid_row_id = jid._id 
LEFT JOIN message_location ON message._id = message_location.message_row_id LEFT JOIN receipts ON message.key_id = receipts.key_id LEFT JOIN message_thumbnail 
ON message._id = message_thumbnail.message_row_id

CREATE TABLE IF NOT EXISTS messages_quotes AS SELECT message_row_id AS _id, chat_row_id, parent_message_chat_row_id, from_me, sender_jid_row_id, key_id, timestamp,message_type,
text_data, payment_transaction_id, lookup_tables, origin FROM message_quoted

CREATE TABLE IF NOT EXISTS messages_links AS SELECT * FROM message_link

CREATE INDEX IF NOT EXISTS messages_chat_id_index ON messages (chat_row_id,_id)

CREATE INDEX IF NOT EXISTS messages_jid_id_index on messages (key_remote_jid, _id)

CREATE INDEX IF NOT EXISTS messages_key_index on messages ( key_remote_jid, key_from_me, key_id )

Thanks, bro! it worked out!

ceka14 commented 1 year ago

I've created a workaround for the changed table scheme in the WhatsApp msgstore.db database

Just run this executable in the same folder as the msgstore.db file wav_create_table.zip

This worked on the folder that I extracted, so now whatsapp viewer can open the msgstore.db.. Progress

But my issue is with the msgstore-2023-03-28.1.db.crypt14 files from the phone directory. is there a way to implement this to the "msgstore.db.crypt14" file instead of the "msgstore.db"??

Can't open them in wa viewer. and ElDavoo when open the "decrypt14_15.py" it closes in a second.

any help? thanks !!!

Night-Wolf commented 1 year ago

I've created a workaround for the changed table scheme in the WhatsApp msgstore.db database

A rewrite of the code would be better, hopefully this will help the developers to make the code working again without the need for this workaround.

This file creates the missing tables

  • messages
  • messages_links
  • messages_quotes

Also it adds some indexes to make it load faster

N.B. i could not find the column "quoted_row_id" as in the old version, but referring to "_id" works for finding a column, this statement appears to be very useful SELECT DISTINCT name FROM sqlite_master WHERE sql like '%%'

Just run this executable in the same folder as the msgstore.db file wav_create_table.zip

You can achieve the same result by running the following SQL statements:

CREATE TABLE IF NOT EXISTS messages AS SELECT file_hash,message._id,message.chat_row_id,message.key_id,jid.raw_string AS key_remote_jid,message.from_me AS key_from_me,
message.status,message.text_data AS data,message.timestamp,message_media.message_url AS media_url,message.message_type AS media_wa_type,message_media.file_size 
AS media_size,message_media.mime_type AS media_mime_type,message_media.media_name,message_media.media_caption,message_media.media_duration,message_location.latitude,
message_location.longitude,message_media.file_path AS thumb_image,receipts.remote_resource,message_thumbnail.thumbnail AS raw_data, message._id AS quoted_row_id 
FROM message LEFT JOIN message_media ON message._id = message_media.message_row_id LEFT JOIN chat ON message.chat_row_id = chat._id LEFT JOIN jid ON jid_row_id = jid._id 
LEFT JOIN message_location ON message._id = message_location.message_row_id LEFT JOIN receipts ON message.key_id = receipts.key_id LEFT JOIN message_thumbnail 
ON message._id = message_thumbnail.message_row_id

CREATE TABLE IF NOT EXISTS messages_quotes AS SELECT message_row_id AS _id, chat_row_id, parent_message_chat_row_id, from_me, sender_jid_row_id, key_id, timestamp,message_type,
text_data, payment_transaction_id, lookup_tables, origin FROM message_quoted

CREATE TABLE IF NOT EXISTS messages_links AS SELECT * FROM message_link

CREATE INDEX IF NOT EXISTS messages_chat_id_index ON messages (chat_row_id,_id)

CREATE INDEX IF NOT EXISTS messages_jid_id_index on messages (key_remote_jid, _id)

CREATE INDEX IF NOT EXISTS messages_key_index on messages ( key_remote_jid, key_from_me, key_id )

@ReMiOS Hi, I have an issue. When I try to run the file it seems to work but the final dimension of the msgstore.db file becomes heavier (something like from 120 MB to 300 MB).

With this workaround, in Whatsapp Viewer I can read the messages but I noticed that in the group chat of Whatsapp each file I sent is duplicated 2-3-4-... times according to the number of the users in that group chat (for example, if in the group there are 4 other people then each message sent by me is shown 4 times . It is referred only to the sent messages and not to the received ones which remain in the right number.

In the past, when Whatsapp Viewer was working withouth this workaround, my messages weren't duplicated.

How can I solve this issue? Does anyone have this problem apart from me? Thanks for your help :) Sent Messages are repeated

ReMiOS commented 1 year ago

@ReMiOS Hi, I have an issue. When I try to run the file it seems to work but the final dimension of the msgstore.db file becomes heavier (something like from 120 MB to 300 MB).

With this workaround, in Whatsapp Viewer I can read the messages but I noticed that in the group chat of Whatsapp each file I sent is duplicated 2-3-4-... times according to the number of the users in that group chat (for example, if in the group there are 4 other people then each message sent by me is shown 4 times . It is referred only to the sent messages and not to the received ones which remain in the right number.

The workaround is a temporary solution for fixing the table scheme in the WhatsApp msgstore.db database. A rewrite of the code is neccesary, hopefully the developers can find the time to make the code working again without the need for this workaround.

kamran185 commented 1 year ago

Stupid question but don't know where to ask. How can I listen to the audio messages and is it possible to import this database (msgstore.db) to the WhatsApp on the other phone (different number, as my own was virtual and no way to use it) to open messages?

dbazalirwa commented 1 year ago

Hi guys am a newbie here, is there a way to decrypt the crypt 14 database.

kamran185 commented 1 year ago

Hi guys am a newbie here, is there a way to decrypt the crypt 14 database.

https://www.youtube.com/watch?v=TBL72KqemGs

gingir commented 5 months ago

@ReMiOS Hi, I have an issue. When I try to run the file it seems to work but the final dimension of the msgstore.db file becomes heavier (something like from 120 MB to 300 MB). With this workaround, in Whatsapp Viewer I can read the messages but I noticed that in the group chat of Whatsapp each file I sent is duplicated 2-3-4-... times according to the number of the users in that group chat (for example, if in the group there are 4 other people then each message sent by me is shown 4 times . It is referred only to the sent messages and not to the received ones which remain in the right number.

The workaround is a temporary solution for fixing the table scheme in the WhatsApp msgstore.db database. A rewrite of the code is neccesary, hopefully the developers can find the time to make the code working again without the need for this workaround.

We are really grateful at @ReMiOS , also his solution only adds tables with names recognized by the Viewer and copies the data from the other tables, it doesn't delete anything.

We only have to keep the .db file with the added tables, and if a better solution (new version of Viewer) comes along in the future, we will just need to delete those new messages and messages_* tables created by those SQL statements

Git58281 commented 3 months ago

but why https://www.virustotal.com/gui/file/ff6670029470e667721be91501248bbe4b52971a7f61c3346ea8a9c717c4d432/detection

vb0 commented 3 months ago

but why https://www.virustotal.com/gui/file/ff6670029470e667721be91501248bbe4b52971a7f61c3346ea8a9c717c4d432/detection

If you're referring to some security products flagging wav_create_table.zip as malicious it's most likely a false positive. All I went through at first sight are either ancient or something heuristic and non-specific. This file is from August 2022, and it's been uploaded to Virustotal the same month, if it was some malicious payload we'd have for sure more and specific detections. That being said anyone can use some sqlite from their favorite Linux distro (or any place they like and trust) and use the 6 "CREATE TABLE" statements from above manually.

Speaking of 2022 soon this issue will be 2 years old any time now. While I can of course use the workaround and the whole situation makes for a nice piece of conversation about the general state of things where we have Whatsapp with 3+ billions users and the only tool I could find to read the db on the PC (and generally export any conversation without a limitation for the number of messages, or just archive and read your messages without having that specific WA active for that number and so on) is actually broken since 2022 - we probably need to fix it eventually.

ReMiOS commented 3 months ago

The executable is not signed with a developer certificate and also has no console or other output, therefore virusscanners tend to report this as a virus.

If you want to compile this yourself, you can use the Python source code below

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sqlite3

# Connect Database
dbconn = sqlite3.connect( 'msgstore.db' )
cursor = dbconn.cursor()
SQL='''CREATE TABLE IF NOT EXISTS messages AS SELECT file_hash,message._id,message.chat_row_id,message.key_id,jid.raw_string AS key_remote_jid,message.from_me AS key_from_me,
message.status,message.text_data AS data,message.timestamp,message_media.message_url AS media_url,message.message_type AS media_wa_type,message_media.file_size 
AS media_size,message_media.mime_type AS media_mime_type,message_media.media_name,message_media.media_caption,message_media.media_duration,message_location.latitude,
message_location.longitude,message_media.file_path AS thumb_image,receipts.remote_resource,message_thumbnail.thumbnail AS raw_data, message._id AS quoted_row_id 
FROM message LEFT JOIN message_media ON message._id = message_media.message_row_id LEFT JOIN chat ON message.chat_row_id = chat._id LEFT JOIN jid ON jid_row_id = jid._id 
LEFT JOIN message_location ON message._id = message_location.message_row_id LEFT JOIN receipts ON message.key_id = receipts.key_id LEFT JOIN message_thumbnail 
ON message._id = message_thumbnail.message_row_id'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE TABLE IF NOT EXISTS messages_quotes AS SELECT message_row_id AS _id, chat_row_id, parent_message_chat_row_id, from_me, sender_jid_row_id, key_id, timestamp, 
message_type, text_data, payment_transaction_id, lookup_tables, origin FROM message_quoted'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE TABLE IF NOT EXISTS messages_links AS SELECT * FROM message_link'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_chat_id_index ON messages (chat_row_id,_id)'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_jid_id_index on messages (key_remote_jid, _id)'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_key_index on messages ( key_remote_jid, key_from_me, key_id )'''
cursor.execute(SQL)
dbconn.commit()
feverlash commented 3 months ago

The executable is not signed with a developer certificate and also has no console or other output, therefore virusscanners tend to report this as a virus.

If you want to compile this yourself, you can use the Python source code below

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sqlite3

# Connect Database
dbconn = sqlite3.connect( 'msgstore.db' )
cursor = dbconn.cursor()
SQL='''CREATE TABLE IF NOT EXISTS messages AS SELECT file_hash,message._id,message.chat_row_id,message.key_id,jid.raw_string AS key_remote_jid,message.from_me AS key_from_me,
message.status,message.text_data AS data,message.timestamp,message_media.message_url AS media_url,message.message_type AS media_wa_type,message_media.file_size 
AS media_size,message_media.mime_type AS media_mime_type,message_media.media_name,message_media.media_caption,message_media.media_duration,message_location.latitude,
message_location.longitude,message_media.file_path AS thumb_image,receipts.remote_resource,message_thumbnail.thumbnail AS raw_data, message._id AS quoted_row_id 
FROM message LEFT JOIN message_media ON message._id = message_media.message_row_id LEFT JOIN chat ON message.chat_row_id = chat._id LEFT JOIN jid ON jid_row_id = jid._id 
LEFT JOIN message_location ON message._id = message_location.message_row_id LEFT JOIN receipts ON message.key_id = receipts.key_id LEFT JOIN message_thumbnail 
ON message._id = message_thumbnail.message_row_id'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE TABLE IF NOT EXISTS messages_quotes AS SELECT message_row_id AS _id, chat_row_id, parent_message_chat_row_id, from_me, sender_jid_row_id, key_id, timestamp, 
message_type, text_data, payment_transaction_id, lookup_tables, origin FROM message_quoted'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE TABLE IF NOT EXISTS messages_links AS SELECT * FROM message_link'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_chat_id_index ON messages (chat_row_id,_id)'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_jid_id_index on messages (key_remote_jid, _id)'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_key_index on messages ( key_remote_jid, key_from_me, key_id )'''
cursor.execute(SQL)
dbconn.commit()

hi i tried this and i got this error

sqlite3.OperationalError: no such table: messages

feverlash commented 3 months ago

nevermind. It worked!! thankyou

samiazainab commented 2 months ago

The executable is not signed with a developer certificate and also has no console or other output, therefore virusscanners tend to report this as a virus. If you want to compile this yourself, you can use the Python source code below

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sqlite3

# Connect Database
dbconn = sqlite3.connect( 'msgstore.db' )
cursor = dbconn.cursor()
SQL='''CREATE TABLE IF NOT EXISTS messages AS SELECT file_hash,message._id,message.chat_row_id,message.key_id,jid.raw_string AS key_remote_jid,message.from_me AS key_from_me,
message.status,message.text_data AS data,message.timestamp,message_media.message_url AS media_url,message.message_type AS media_wa_type,message_media.file_size 
AS media_size,message_media.mime_type AS media_mime_type,message_media.media_name,message_media.media_caption,message_media.media_duration,message_location.latitude,
message_location.longitude,message_media.file_path AS thumb_image,receipts.remote_resource,message_thumbnail.thumbnail AS raw_data, message._id AS quoted_row_id 
FROM message LEFT JOIN message_media ON message._id = message_media.message_row_id LEFT JOIN chat ON message.chat_row_id = chat._id LEFT JOIN jid ON jid_row_id = jid._id 
LEFT JOIN message_location ON message._id = message_location.message_row_id LEFT JOIN receipts ON message.key_id = receipts.key_id LEFT JOIN message_thumbnail 
ON message._id = message_thumbnail.message_row_id'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE TABLE IF NOT EXISTS messages_quotes AS SELECT message_row_id AS _id, chat_row_id, parent_message_chat_row_id, from_me, sender_jid_row_id, key_id, timestamp, 
message_type, text_data, payment_transaction_id, lookup_tables, origin FROM message_quoted'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE TABLE IF NOT EXISTS messages_links AS SELECT * FROM message_link'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_chat_id_index ON messages (chat_row_id,_id)'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_jid_id_index on messages (key_remote_jid, _id)'''
cursor.execute(SQL)
dbconn.commit()

SQL='''CREATE INDEX IF NOT EXISTS messages_key_index on messages ( key_remote_jid, key_from_me, key_id )'''
cursor.execute(SQL)
dbconn.commit()

hi i tried this and i got this error

sqlite3.OperationalError: no such table: messages

i am getting the same error how did it worked for you?