yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] felisco:
Hi,

I downloaded the last version v4.8 and executed the script in W10. First I downloaded legacy WhatsApp 2.11.431 from http://whatcrypt.com/WhatsApp-2.11.431.apk and copied it into tmp folder to avoid error 'Failed to parse APK', and also enabled Install via USB to avoid error 'INSTALL_FAILED_USER_RESTRICTED'.

Everything runs fine, but the adb backup command seems to not be working correctly. When the line bin\adb.exe backup -f tmp\whatsapp.ab com.whatsapp is executed, it generates a whatsapp.ab of size 1KB. It is unpacked using abe.jar, but the whatsapp.tar file extracted is empty, so nothing can be extracted from it.

Any idea?

Please connect your Android device with USB Debugging enabled:

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

WhatsApp 2.20.202.18 installed

Found legacy WhatsApp 2.11.431 in local folder

Backing up WhatsApp 2.20.202.18
3783 KB/s (30667885 bytes in 7.914s)
Backup complete

Removing WhatsApp 2.20.202.18 skipping data
Success
Removal complete

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

Now unlock your device and confirm the backup operation.

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

49%
1024 bytes written to tmp\whatsapp.tar.
bin\tar.exe: Record size = 2 blocks
bin\tar.exe: apps/com.whatsapp/f/key: Not found in archive
bin\tar.exe: Error exit delayed from previous errors
bin\tar.exe: Record size = 2 blocks
bin\tar.exe: apps/com.whatsapp/db/msgstore.db: Not found in archive
bin\tar.exe: Error exit delayed from previous errors
bin\tar.exe: Record size = 2 blocks
bin\tar.exe: apps/com.whatsapp/db/wa.db: Not found in archive
bin\tar.exe: Error exit delayed from previous errors
bin\tar.exe: Record size = 2 blocks
bin\tar.exe: apps/com.whatsapp/db/axolotl.db: Not found in archive
bin\tar.exe: Error exit delayed from previous errors
bin\tar.exe: Record size = 2 blocks
bin\tar.exe: apps/com.whatsapp/db/chatsettings.db: Not found in archive
bin\tar.exe: Error exit delayed from previous errors

Cleaning up temporary files ...

Archivo eliminado: D:\Cosas\Fran\WAC\WhatsApp-Key-DB-Extractor-4.8\tmp\whatsapp.ab
Archivo eliminado: D:\Cosas\Fran\WAC\WhatsApp-Key-DB-Extractor-4.8\tmp\whatsapp.tar
Archivo eliminado: D:\Cosas\Fran\WAC\WhatsApp-Key-DB-Extractor-4.8\tmp\waplen.txt
Archivo eliminado: D:\Cosas\Fran\WAC\WhatsApp-Key-DB-Extractor-4.8\tmp\sdpath.txt
Archivo eliminado: D:\Cosas\Fran\WAC\WhatsApp-Key-DB-Extractor-4.8\tmp\wapath.txt
Archivo eliminado: D:\Cosas\Fran\WAC\WhatsApp-Key-DB-Extractor-4.8\tmp\wapver.txt
Archivo eliminado: D:\Cosas\Fran\WAC\WhatsApp-Key-DB-Extractor-4.8\tmp\sdkver.txt

Done

Restoring WhatsApp 2.20.202.18
4685 KB/s (30667885 bytes in 6.392s)
Success

Restore complete

Removing WhatsApp 2.20.202.18 temporary apk
Archivo eliminado: D:\Cosas\Fran\WAC\WhatsApp-Key-DB-Extractor-4.8\tmp\base.apk

Operation complete

Presione una tecla para continuar . . .
[Android Apps and Games] xdaanym:
Hi,

I had a similar Error on a Mac with a Samsung Galaxy S9 (Android 10):

=========================================================================
= This script will extract the WhatsApp Key file and DB on Android 4.0+ =
= You DO NOT need root for this to work but you DO need Java installed. =
= If your WhatsApp version is greater than 2.11.431 (most likely), then =
= a legacy version will be installed temporarily in order to get backup =
= permissions. You will NOT lose ANY data and your current version will =
= be restored at the end of the extraction process so try not to panic. =
= Script by: TripCode (Greets to all who visit: XDA Developers Forums). =
= Thanks to: dragomerlin for ABE and to Abinash Bishoyi for being cool. =
= ### Version: v4.7 (12/10/2016) ### =
=========================================================================

Please connect your Android device with USB Debugging enabled:

cannot connect to daemon at tcp:5037: Connection refused
* daemon not running; starting now at tcp:5037
* daemon started successfully
./WhatsAppKeyDBExtract.sh: line 57: [: -eq: unary operator expected

Found legacy WhatsApp 2.11.431 in local folder

WhatsApp 2.20.202.18 installed

Backing up WhatsApp 2.20.202.18
/data/app/com.whatsapp-HiCsxb5W5ML68ip.... 33.4 MB/s (30667885 bytes in 0.875s)
Backup complete

Removing WhatsApp 2.20.202.18 skipping data
Success
Removal complete

Installing legacy WhatsApp 2.11.431
Performing Streamed Install
Success
Install complete

WARNING: adb backup is deprecated and may be removed in a future release
Now unlock your device and confirm the backup operation...

Please enter your backup password (leave blank for none) and press Enter:
123456abc
Calculated MK checksum (use UTF-8: true): xxx
3%
1024 bytes written to tmp/whatsapp.tar.
tar: apps/com.whatsapp/f/key: Not found in archive
tar: Error exit delayed from previous errors.
tar: apps/com.whatsapp/db/msgstore.db: Not found in archive
tar: Error exit delayed from previous errors.
tar: apps/com.whatsapp/db/wa.db: Not found in archive
tar: Error exit delayed from previous errors.
tar: apps/com.whatsapp/db/axolotl.db: Not found in archive
tar: Error exit delayed from previous errors.
tar: apps/com.whatsapp/db/chatsettings.db: Not found in archive
tar: Error exit delayed from previous errors.

Saving whatsapp.cryptkey ...
cp: tmp/apps/com.whatsapp/f/key: No such file or directory
Saving msgstore.db ...
cp: tmp/apps/com.whatsapp/db/msgstore.db: No such file or directory
Saving wa.db ...
cp: tmp/apps/com.whatsapp/db/wa.db: No such file or directory
Saving axolotl.db ...
cp: tmp/apps/com.whatsapp/db/axolotl.db: No such file or directory
Saving chatsettings.db ...
cp: tmp/apps/com.whatsapp/db/chatsettings.db: No such file or directory

Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
adb: error: cannot stat 'tmp/apps/com.whatsapp/f/key': No such file or directory

Restoring WhatsApp 2.20.202.18
Performing Streamed Install
Success
Restore complete

Cleaning up temporary files ...
Done

Operation complete

Please press Enter to quit...

Can anybody help? :) Thanks a lot!
[Android Apps and Games] akk96:
Script works well for me. Tested on Nokia 6.1 Plus and Linux.

Thanks dannymx!! :D:good: Your fork and instructions worked for me.

I was able to get the shell script to execute. The issue which I faced was that the WhatsApp-2.11.431 apk did not download from the whatsapp cdn site (It's removed i think). So i manually downloaded from the second url(whatcrypt), placed it in tmp folder and renamed it to LegacyWhatsApp. The shell script then did it's job.

Another issue which I faced was after the script was completed the latest whatsapp kept crashing in my phone. So i just uninstalled it and reinstalled it again. Now everything is working well.

Since the whatsapp cryptkey is also generated, is it ok to delete the .nomedia file in Whatsapp/Databases ?
[Android Apps and Games] colder1989:
Hi all,

I managed to extract the key but when I try to enter it on whatsapp viewer to decrypt the crypt12 database doesn't work ... I also tried with the WhatCrypt app but it says the key is different ... any help?
[Android Apps and Games] felisco:
Stuck doing the backup

Hi everybody,

I've executed the script but had a few problems:

Device: Xiaomi Redmi 5 Plus

Android version: 8.1.0

- Copy of the installed Whatsapp version to local folder and uninstalled it ok.

- The LegacyWhatsApp.apk download failed, so I downloaded it separately and put it into the tmp folder.

- Installation of the LegacyWhatsApp.apk failed with error [INSTALL_FAILED_VERSION_DOWNGRADE]. I rebooted the device and installed it succesfully.

- Backup doesn't display any error but, after tapping on Back up my data on the device, a file of only 1KB is copied to the local folder that, of course, doesn't have the complete whatsapp backup.

I've read that many people have had problems with android versions > 7, but I've been able to complete the process using another device with android 10.

Does anybody have an idea of why I can't complete the backup?

Thank you.
[Android Apps and Games] PIRATA!:
Follow this guide to the letter:

Or also take a look at this:

Hope you'll find the way.
[Android Apps and Games] felisco:
I did find the way!!

Opening the legacy whatsapp in the device before doing the backup was the key to solve the problem.

Thank you very much PIRATA!!.
[Android Apps and Games] PIRATA!:
Your welcome ;)
[Android Apps and Games] PIRATA!:
Go read this post:

https://xdaforums.com/showthread.php?p=83935801
[Android Apps and Games] PIRATA!:
Use 4.7-E1 as I've done it with that version.

And strictly follow my guide.

Or follow the other comment I quoted in the post I've linked you as the key can be retrieved also in that method.
[Android Apps and Games] samour50:
I did follow it. I just never got the Date time prompt nor did the app appear on the phone.

It just uninstalled the old one.

Just a suggestion you may also want to post permalinks for others to make it easier for others to find them and pin the instructions post.

#1 https://xdaforums.com/showpost.php?p=83856863&postcount=621

#2 https://xdaforums.com/showpost.php?p=79488008&postcount=541

#3 https://xdaforums.com/showpost.php?p=81902381&postcount=575
[Android Apps and Games] PIRATA!:
You just need to go back and find the original posts that I mention, that are these two:

https://xdaforums.com/showthread.php?p=83629013

https://xdaforums.com/showthread.php?p=83733553

...and you'll have everything.

It is strange that it doesn't work for you.

Are you sure you are exactly using the version I mention?

Try also the other method for retrieving the key (second link and then follow back the posts).
[Android Apps and Games] samour50:
Cool thanks yeah I followed the first link. Exact same version of WA and the extractor. I could try to rename the 2.11 to Legacy but that is not the issue. The issue is it fails to downgrade. I saw a few posts on that before but no clear resolution.

For the second method the script there is unix-based. Are there changes that can be done to the Windows one?
[Android Apps and Games] samour50:
OK here is what worked for me in the end but still no key.

Following https://xdaforums.com/showthread.php?p=81902381

After Step 5, at step 6 nothing happens. I have to manually install the legacy APK. Backup completes but it doesn't find a key or a msgstore.

So I think I got the script to run properly but it didn't extract the key

##### Backup Creation #####
You can backup using "adb backup" command (option A)
or you can use "bu" command and then "adb pull" (option B) (need enough storage on sdcard)
A or B ? A

Now unlock your device and confirm the backup operation...
Size of tmp\whatsapp.ab is 3908284 bytes

##### Backup extraction #####

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

Now unlock your device and confirm the backup operation...
Size of tmp\whatsapp.ab is 3908284 bytes

##### Backup extraction #####

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

0% 1% 2% 3% 4% 5% 6% 7% 8% 9% 10% 11% 12% 13% 14% 15% 16% 17% 18% 19% 20% 21% 22% 23% 24% 25% 26% 27% 28% 29% 30% 31% 32% 33% 34% 35% 36% 37% 38% 39% 40% 41% 42% 43% 44% 45% 46% 47% 48% 49% 50% 51% 52% 53% 54% 55% 56% 57% 58% 59% 60% 61% 62% 63% 64% 65% 66% 67% 68% 69% 70% 71% 72% 73% 74% 75% 76% 77% 78% 79% 80% 81% 82% 83% 84% 85% 86% 87% 88% 89% 90% 91% 92% 93% 94% 95% 96% 97% 98% 99% 100%
11280384 bytes written to tmp\whatsapp.tar.
bin\tar.exe: apps/com.whatsapp/f/key: Not found in archive
bin\tar.exe: Error exit delayed from previous errors
bin\tar.exe: apps/com.whatsapp/db/msgstore.db: Not found in archive
bin\tar.exe: Error exit delayed from previous errors
apps/com.whatsapp/db/wa.db
apps/com.whatsapp/db/axolotl.db
apps/com.whatsapp/db/chatsettings.db

Extracting wa.db ...
1 file(s) copied.

Extracting axolotl.db ...
1 file(s) copied.

Extracting chatsettings.db ...
1 file(s) copied.

Cleaning up temporary files ...

Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\whatsapp.ab
Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\whatsapp.tar
Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\waplen.txt
Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\sdpath.txt
Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\wapath.txt
Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\wapver.txt
Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\newwapver.txt
Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\sdkver.txt
Done

##### Restore previous WhatsApp version #####
When debugging or on error, you might save time by not restoring the updated version.
Do you want to restore previous WhatsApp version (Y/N)? Y

Restoring WhatsApp previous version
Performing Streamed Install
Success

Restore complete

Removing WhatsApp previous version temporary apk
Deleted file - C:\WhatsApp-Key-DB-Extractor-4.7-E1.0\tmp\base.apk

Exiting ...

Press any key to continue . . .
[Android Apps and Games] orlith:
Hello

Did one of you had successfuly restore an unencrypted db on whatsapp ?

If so how ?

I did merge 2 db and copy the db to the whatsapp/database folder, deleting all other files, uninstall reinstall it, but It never imports my unencrypted db :(
[Android Apps and Games] KaMyKaSii:
To do this I think you need root to direct replace the file /data/data/com.whatsapp/databases/msgstore.db
[Android Apps and Games] DRei69:
This i great, in combination with the Whatsapp Viewer For PC. Someone in family passed away, I stopped paying the phone bill a few months later and and the number got disconnected. WhatsApp in all its wisdom deregistered the account :( I just wanted to keep their phone alive with all the messages. I don't know if there was any easier way in accessing the information without trying to get hold of the old number.

In regards to the steps which may not be mentioned very well is these:

I downloaded the following and installed them

Omni-Crypt

Omni-Crypt for Android - APK Download

Download Omni-Crypt apk 3.0.2 for Android. Omni-Crypt recrypts WhatsApp backup files to legacy CRYPT files.

apkpure.com

WhatsApp-2.11.431.apk which was saved in $:\WhatsApp-Key-DB-Extractor-master\tmp\ and renamed to LegacyWhatsApp.apk

UniversalAdbDriverSetup.msi

Universal ADB Drivers

WhatsApp Viewer

WhatsApp Viewer

andreas-mausch.de

When I clicked WhatsAppKeyDBExtract it all just went ahead without any reboots or prompts, sorry only prompt was on the phone when it asked if I wanted to do a backup.

Is there any way to have WhatsApp on the phone show the messages? Right now it wants to re-register the phone, which it can't do since the number is no longer in service. All i want is to see the messages on the phone.
[Android Apps and Games] Magicmadonna:
Hello,

I have the Backup, and i just need to merge them

did this patch help in any way?
[Android Apps and Games] Ubtohts:
can you update this .bat file its cant find key of whatsapp...
[Android Apps and Games] ol326:
Hey,

I am having the same problem where I get this message: "WhatsApp is not installed on the target device". Whatsapp is installed and I can access the Whatsapp files with the Android File Transfer app (I am on a mac), but I am looking to retrieve the Whatsapp key to decipher the messages. It is a pretty old device (Motorola Moto G 1st Generation XT1033). I am not well-versed with programming, so I did not really understand what you meant with "you can easily edit out the package check in the bat file and re-run it". I would be eternally grateful if you could give me further instructions on how to proceed.

Thanks so much in advance
[Android Apps and Games] Ronny81:
I download "WhatsApp-2.11.431.apk" now and put it in "tmp" folder and git it the name "LegacyWhatsApp.apk" is it the right way? Can i run it now again? I realy hope someone can help me here. Thanks so much.
[Android Apps and Games] handysmog:
Hello you guys and girls are as awesome as someone can be!!! I just made an account to say this solution is still totaly possible on Android 9 at the 10th January of 2021.

My only problem occured, because my phone was in charge only mode and not in data transfer mode.

Did I tell you you are awesome?

Have a nice day

handysmog(maybe i am just a one time user) :D
[Android Apps and Games] joluke:
This doesn't work on Rog Phone 2 running Android 10 and whatsapp version WhatsApp Messenger 2.20.206.24
[Android Apps and Games] Zotho:
Worked perfectly, thanks a lot. Backup before switching to Signal or Telegram :)
[Android Apps and Games] robined:
OK On a Xiomi 9T Pro it took me some time but what finally worked for me was

v4.7-E1.0

You need to download WhatsApp-2.11.431.apk and abe-all.jar

Then rename WhatsApp-2.11.431.apk to LegacyWhatsApp.apk and copy it to the tmp/ directory

Rename abe-all.jar to abe.jar and copy it to the bin/ directory

Run the script.

Make sure you enable File transfer mode on the phone after you connect it

Also, I needed to open the old version of WhatsApp before making the backup in the script - fortunately the script waits here for a password! First it wants you to update: don't! I got a phone date is inaccurate error. Just wait on this screen and then continue on with the script. The script goes silent here for quite some time.

The best instructions are to be found here by PIRATA! but miss the above few steps.

https://xdaforums.com/t/tool-whatsa...ed-october-2016.2770982/page-31#post-83629013

Good luck!
[Android Apps and Games] yuvrajraghuvanshi:
Hey everyone, I have created a similar tool in python which extract database by creating whatsapp.ab using adb. It works. But I am skeptical about making it public on github. I have contacted whatsapp support regarding the same but they are not giving one line answer. Should I make it public? What are possible complication if I do so?
[Android Apps and Games] bdforbes:
I can confirm that this method still works as of 2021-01-24 using the latest version of WhatsApp Android on a Pixel 3. However, I had some issues with the whatsapp.ab file being transferred across as a tiny 47 B file, so it clearly wasn't working properly. In the end I manually stepped through the batch file, pasting the most important commands one at a time into a command prompt. The part where the adb backup command is run seems to be the critical part; when I ran that command manually, confirmed the backup on the phone and just waited, it then completed successfully, whereas running it via the batch file and pressing ENTER to use no backup password always caused the issue with the tiny whatsapp.ab file.

Hope that helps someone!

EDIT: Oh and make sure your WhatsApp is backed up to Google Drive before doing this method! I found that I had to clear WhatsApp storage and restore from backup after this, otherwise the app would refuse to open.
[Android Apps and Games] shnks:
I replaced the 2 files, but still can't run it.

I have the problem to downgrade:

Installing legacy WhatsApp 2.11.431

2682 KB/s (18329558 bytes in 6.671s)

Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

Install complete

Changing the date of may phone (Galaxy Note 8) didn't help.

Any ideas?
[Android Apps and Games] RomDafrog:
Hi there,

The instructions for PC did not help; and I see that 47b whatsapp.ab file transferred on my Mac.

It did the same when I used only adb backup -f tmp/whatsapp.ab com.whatsapp command.

Is this file the unencrypted key ?
[Android Apps and Games] yuvrajraghuvanshi:
I was away for sometime. It's public on github : https://github.com/yuvrajraghuvanshis/WhatsApp-Key-Database-Extractor

However, on some devices issue of 41/46/47/549 bytes backup file still persists and I'm still finding out why. I have tried adb version 1.0.31 with no luck

How did you manage to overcome this issue?
[Android Apps and Games] yuvrajraghuvanshi:
This happens because of data structure changes between old and new version or something like that. Quick fix is to allow device to reboot before installing legacy whatsapp. I have added that in my project with `--allow-reboot` flag.

wa_kdbe.py --allow-reboot
[Android Apps and Games] yuvrajraghuvanshi:
Nope you've been 47byte'd, right now there's no fix that I can think of. However you can try tools like whatsdump
[Android Apps and Games] MB03:
Hello!

I have read through this forum, seen the posts where it says some things need to be updated and still feeling very lost!

I would very much like to decrypt some message on my whatsapp however I am VERY green when it comes to these things. I had used whatcrypt and downloaded the key extractor and like many others ran into issues where it would not extract anything. Also, when I look in my phone in whatsapp files I don't see anything called KEY. Could this be a problem also?

Here are some details that I am unsure are relevant:

-phone is a S10 plus

-using Windows 10

-javw updated and downloaded Java

-in my extractor file I don't have any file that ends in bat, however I can still run the correct one. But it doesn't work and has errors saying it couldn't get the key.

Now I'm not horrible with technology. Maybe someone will feel kind enough to provide a quite detailed step by step on what will work for me. In lamens terms? I just want to make this work!

Eternally grateful.
[Android Apps and Games] shnks:
Thanks for your help! Where did you add this? Did you change the code or did u use it as a command using python?
[Android Apps and Games] ol326:
Hey guys,

I would like to update you on my progress. In my special case, I had installed Whatsapp with SIM card number 1, used it for a while, and then took out the SIM card and inserted a new one, SIM card number 2. For whatever reason, Whatsapp kept working but with the old number, that of SIM card number 1. I actually wanted to do a back up using a back up application from the internet, but when I connected the phone to my computer and ran the application it deleted Whatsapp. This is, I was told, because the application installs a different version of Whatsapp on the phone. But I suppose it could not reinstall it and connect it to the previous Whatsapp account because I have a different SIM card in the phone. So Whatsapp disappeared from my phone, and when I restarted it it appeared again, but it showed the screen where it asks you to register with a new number. This is probably why it showed the error that Whatsapp is not installed on this phone.

When I access the phone with Android File Transfer on mac, it shows me that the encrypted message databases are still saved on the phone. Which leads me to believe that the previous Whatsapp key is also still saved on the phone.

Because of these complications, I believe that my only option now is to make a back up of the phone and then put that back up on a rooted phone, from which I can access the Whatsapp key. But I am not sure if the Whatsapp key will be saved when I do a back up – Does anyone know if that is the case? If someone could assist me in this process I'd be happy to pay a fair price for it.
[Android Apps and Games] yuvrajraghuvanshi:
https://github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor/ This is pretty straight-forward.
[Android Apps and Games] yuvrajraghuvanshi:
I modified code to on my repo to allow for command line input.
[Android Apps and Games] yuvrajraghuvanshi:
I am not active on XDA very much you are welcome to open discussion on github https://github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor/discussions

PS I am not hijacking this thread LoL this is for my repo specifically.
[Android Apps and Games] deltacharlie:
When try this i get the error

failed to install tmp/LegacyWhatsApp.apk: Failure [-26: Package com.whatsapp new target SDK 19 doesn't support runtime permissions but the old target SDK 23 does.]

Any ideas how to solve this
[Android Apps and Games] Da7mMulhim:
Hi,

I doubt that you are still active here, but I'll try my luck.

Any chance you could share more details on how you fixed the problem?