Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 12: Export: wa.db - Contacts are not exported. #63

Open
sietsevdschoot opened this issue Sep 28, 2023 · 11 comments
Open

Android 12: Export: wa.db - Contacts are not exported. #63

sietsevdschoot opened this issue Sep 28, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@sietsevdschoot
Copy link

sietsevdschoot commented Sep 28, 2023

I have a OnePlus Android 12 Phone.

Using WhatsApp-Key-DB-Extractor I can successfully extract the whatsapp databases. My whatsapp backups are not password protected.

However, after explorer the wa.db with DB Browser for SqlLite i see that the wa_contacts table remains empty.
Other tables like wa_vnames,wa_contact_storage_usage,wa_biz_profiles in this sqlite are populated

Also in Whatsapp on the device all contacts in the Whatsapp conversation have their correct names.

FWIW:
When i have to confirm the permission for the backup and press Enter afterwards, i can give the permissions, but i can't open the app because of the Your phone data is inaccurate. Adjust your clock and try again error, - even though the system time is correct - that is caused by the older version of WhatsApp.

Whatsapp Chat Exporter:

wtsexporter -a

Processing contacts...(0)
Processing messages...(22625/22625)
Processing media...(4410/4410)
Processing vCards...(56/56)
Processing calls...(74)
Generating chats...(376/376)
WhatsApp directory already exists in output directory. Skipping...

Everything is done!

Extracted files:

Name                Length LastWriteTime
----                ------ -------------
.placeholder             2 20:34:43
axolotl.db          299008 22:00:55
chatsettings.db      24576 21:29:43
msgstore.db       18329600 20:34:52
wa.db               417792 20:37:41
wa.db-shm            32768 20:42:08
wa.db-wal                0 20:42:08
whatsapp.cryptkey      158 21:29:41

WhatsAppKeyDBExtract output:

Please connect your Android device with USB Debugging enabled:

* daemon not running. starting it now on port 5037 *
* daemon started successfully *

WhatsApp 2.23.18.79 installed

Found legacy WhatsApp 2.11.431 in local folder

Backing up WhatsApp 2.23.18.79
6745 KB/s (52214668 bytes in 7.558s)
Backup complete

Removing WhatsApp 2.23.18.79 skipping data
Success
Removal complete

Installing legacy WhatsApp 2.11.431
3912 KB/s (18329558 bytes in 4.575s)
Success
Install complete


Paused. Open Whatsapp. Ok the Permissions Request. Press Enter to continue:

Now unlock your device and confirm the backup operation.

Please enter your backup password (leave blank for none) and press Enter:


apps/com.whatsapp/f/key
C:\Temp\WhatsApp\WhatsApp-Key-DB-Extractor\bin\tar.exe: apps/com.whatsapp/f/encrypted_backup.key: Not found in archive
C:\Temp\WhatsApp\WhatsApp-Key-DB-Extractor\bin\tar.exe: Error exit delayed from previous errors
apps/com.whatsapp/db/msgstore.db
apps/com.whatsapp/db/wa.db
apps/com.whatsapp/db/axolotl.db
apps/com.whatsapp/db/chatsettings.db
C:\Temp\WhatsApp\WhatsApp-Key-DB-Extractor\bin\tar.exe: apps/com.whatsapp/Avatars: Not found in archive
C:\Temp\WhatsApp\WhatsApp-Key-DB-Extractor\bin\tar.exe: Error exit delayed from previous errors

Extracting whatsapp.cryptkey ...
Extracting msgstore.db ...
Extracting wa.db ...
Extracting axolotl.db ...
Extracting chatsettings.db ...

Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
5 KB/s (158 bytes in 0.027s)

Cleaning up temporary files ...
Done

Restoring WhatsApp 2.23.18.79
4923 KB/s (52214668 bytes in 10.355s)
Success
Restore complete

Removing WhatsApp 2.23.18.79 temporary apk


Operation complete

@KnugiHK
Copy link
Owner

KnugiHK commented Sep 29, 2023

Hi. Would you be able to find where the contact names came from?

@KnugiHK
Copy link
Owner

KnugiHK commented Oct 1, 2023

When i have to confirm the permission for the backup and press Enter afterwards, i can give the permissions, but i can't open the app because of the Your phone data is inaccurate. Adjust your clock and try again error, - even though the system time is correct - that is caused by the older version of WhatsApp.

This is normal.

However, after explorer the wa.db with DB Browser for SqlLite i see that the wa_contacts table remains empty.
Other tables like wa_vnames,wa_contact_storage_usage,wa_biz_profiles in this sqlite are populated

Also in Whatsapp on the device all contacts in the Whatsapp conversation have their correct names.

I can reproduce the problem. But further investigations are needed.

@KnugiHK KnugiHK added the bug Something isn't working label Oct 1, 2023
@sietsevdschoot
Copy link
Author

sietsevdschoot commented Oct 1, 2023

Hi. Would you be able to find where the contact names came from?

The wa.db contains a table system_contacts_version_table with a id and version column. In my database this table contains about 2000 rows. It might have something to do with it.

The contacts app on my Android, synced with Gmail contacts, contains all contacts used in the WhatsApp conversations.

@sietsevdschoot
Copy link
Author

sietsevdschoot commented Oct 1, 2023

When i have to confirm the permission for the backup and press Enter afterwards, i can give the permissions, but i can't open the app because of the Your phone data is inaccurate. Adjust your clock and try again error, - even though the system time is correct - that is caused by the older version of WhatsApp.

This is normal.

However, after explorer the wa.db with DB Browser for SqlLite i see that the wa_contacts table remains empty.
Other tables like wa_vnames,wa_contact_storage_usage,wa_biz_profiles in this sqlite are populated
Also in Whatsapp on the device all contacts in the Whatsapp conversation have their correct names.

I can reproduce the problem. But further investigations are needed.

I've tried several ways of trying to force whatsapp to refresh the contact list. But none of those options caused the contacts table to get populated.

So i took another approach. I downloaded all contacts from Gmail in .vcf format.
I've found a nice Powershell script to convert .vcf on Github ConvertFrom-Vcf. I had to tweak it a little bit to work for the Gmail format.

After that I wrote a Powershell script to sanitize the phonenumbers and replace all occurences with the actual contactname in the generated .html files, and to rename the file to the contactname.

@KnugiHK
Copy link
Owner

KnugiHK commented Oct 2, 2023

No sure if WhatsApp changed the database structure again. Any more people encounter this issue?

@sietsevdschoot
Copy link
Author

In the meantime I have a script (Github gist) to fix the problem using exported Gmail .vcf contacts to replace contactnames after running the Whatsapp Chat Exporter.

@KnugiHK
Copy link
Owner

KnugiHK commented Dec 3, 2023

Weird. I just did a new export from WhatsApp 2.23.25.3. The wa_contacts table was populated.

@msloco
Copy link

msloco commented Feb 27, 2024

I can confirm same behavior reported by the op happens here with a decrypted wa.db.crypt15 : only populated tables seems to be wa_trusted_contacts and wa_trusted_contacts_send.
whatsapp reports version 2.24.3.81.

@guilherme-puida
Copy link

The issue also happens here with an export from version 2.24.6.10.

@iher1
Copy link

iher1 commented Apr 23, 2024

Hi, I also see the issue on WhatsApp 2.24.8.85 on Android: the wa.db is not populated with any contact data.

@qosch
Copy link

qosch commented May 10, 2024

Using a WhatsApp database I exported a few years ago (mid 2021), I am experiencing the same issue. Looking at the wa.db file, I can't find any table indicating actual contact names. wa_contact_storage_usage does contain a plausible number of lines, though (but no names).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants