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

Error : whatsapp.ab size 549 bytes/ could not extract whatsapp.tar #16

Closed
Benji005 opened this issue Jan 28, 2021 · 93 comments
Closed

Error : whatsapp.ab size 549 bytes/ could not extract whatsapp.tar #16

Benji005 opened this issue Jan 28, 2021 · 93 comments

Comments

@Benji005
Copy link

Describe the bug
No extracted file

To Reproduce
Steps to reproduce the behavior:

  1. run 'wa_kdbe.py'
  2. Enter 'y'
  3. See error:
  4. 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
    [WinError 3] The system cannot find the path specified: 'tmp/apps/com.whatsapp/f/key' -> 'extracted/mine/key'
    Cleaning up tmp folder...

Expected behavior
File in extracted folder

Screenshots
If applicable, add screenshots to help explain your problem.

Terminal output
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
[WinError 3] The system cannot find the path specified: 'tmp/apps/com.whatsapp/f/key' -> 'extracted/mine/key'
Cleaning up tmp folder...

Desktop (please complete the following information):

  • OS: Windows 10

Smartphone (please complete the following information):

  • Device: Redmi note 5
  • Android : Oreo
  • Version OPM1.171019.019

Additional context
Add any other context about the problem here.

@roberts011
Copy link

What WhatsApp version do you use?
Also, did you download the prerequsities (python 3.x, latest java, adb)?

@YuvrajRaghuvanshiS
Copy link
Owner

It happens sometimes when adb can't create whatsapp.ab file properly. The process of creating backup, you must have noticed that the process completed quickly. Try re running the script.

@YuvrajRaghuvanshiS
Copy link
Owner

Send complete output not just error.

@Benji005
Copy link
Author

I already tried... twice
I will try again and copy paste the complete error for you

@Benji005
Copy link
Author

Benji005 commented Jan 28, 2021

Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
  • Found Java installed on system.
  • Please read above instructions carefully. Continue? (default y) : y
  • Connected to Redmi Note 5
  • WhatsApp V2.21.1.13 installed on device
  • Found legacy WhatsApp V2.11.431 apk in helpers/ folder
  • Backing up WhatsApp 2.21.1.13 apk, the one installed on device to tmp/WhatsAppbackup.apk
  • 5542 KB/s (31608405 bytes in 5.569s)
  • Apk backup complete.
  • Uninstalling WhatsApp, skipping data.
  • Success
  • Uninstalled.
  • Installing legacy WhatsApp V2.11.431, hold tight now.
  • 4295 KB/s (18329558 bytes in 4.167s)
  • Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
  • Installation Complete.
  • Backing up WhatsApp data as tmp/whatsapp.ab. May take time, don't panic.
  • Now unlock your device and confirm the backup operation.
  • Done backing up data.
  • Reinstallting original WhatsApp.
  • 4791 KB/s (31608405 bytes in 6.441s)
  • Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
  • Our work with device has finished, it is safe to remove it now.
  • Found whatsapp.ab in tmp folder. Continuing
  • Enter a reference name for this user. : Bkp
  • Enter same password which you entered on device when prompted earlier. : 12345
  • Successfully 'fluffed' tmp/whatsapp.ab tmp/whatsapp.tar
  • Taking out main files in tmp/ folder temporaily.
  • 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
  • [WinError 3] The system cannot find the path specified: 'tmp/apps/com.whatsapp/f/key' -> 'extracted/Bkp/key'
  • Cleaning up tmp folder...

@YuvrajRaghuvanshiS
Copy link
Owner

YuvrajRaghuvanshiS commented Jan 28, 2021

Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]

I believe you are using MIUI. MIUI restricts apk installation via adb. You have to allow that.
Here's a quick guide

  • Go to Settings -> Additional Settings -> Developer options.
  • Under Debugging, click on 'Install via USB' option.

You might need to add MI account to your device for that

@Benji005
Copy link
Author

Benji005 commented Jan 28, 2021

Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
  • Found Java installed on system.
  • Please read above instructions carefully. Continue? (default y) : y
  • Connected to Redmi Note 5
  • WhatsApp V2.21.1.13 installed on device
  • Found legacy WhatsApp V2.11.431 apk in helpers/ folder
  • Backing up WhatsApp 2.21.1.13 apk, the one installed on device to tmp/WhatsAppbackup.apk
  • 5294 KB/s (31608405 bytes in 5.829s)
  • Apk backup complete.
  • Uninstalling WhatsApp, skipping data.
  • Success
  • Uninstalled.
  • Installing legacy WhatsApp V2.11.431, hold tight now.
  • 4875 KB/s (18329558 bytes in 3.671s)
  • Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
  • Installation Complete.
  • Backing up WhatsApp data as tmp/whatsapp.ab. May take time, don't panic.
  • Now unlock your device and confirm the backup operation.
  • Done backing up data.
  • Reinstallting original WhatsApp.
  • 4679 KB/s (31608405 bytes in 6.596s)
  • Success
  • Our work with device has finished, it is safe to remove it now.
  • Found whatsapp.ab in tmp folder. Continuing

@YuvrajRaghuvanshiS
Copy link
Owner

YuvrajRaghuvanshiS commented Jan 28, 2021

Try this and send output.

In same terminal copy paste following commands.

git pull origin
git checkout issues/16
python wa_kdbe.py

@Benji005
Copy link
Author

What do you mean by the same terminal?
I dont get you!

@YuvrajRaghuvanshiS
Copy link
Owner

I meant in same directory. Where you have this project. Like this
image

@Benji005
Copy link
Author

Benji005 commented Jan 28, 2021

What WhatsApp version do you use? My version 2.21.1.13
Also, did you download the prerequsities (python 3.x, latest java, adb)?

Yes

@YuvrajRaghuvanshiS
Copy link
Owner

YuvrajRaghuvanshiS commented Jan 28, 2021

If you don't have git installed on system you can do this.

Go to : https://github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor/tree/issues/16

Download project zip :

image
Unzip and continue regularly.

@Benji005
Copy link
Author

Benji005 commented Jan 28, 2021

TypeError: can only concatenate str (not "int") to str
  • Found Java installed on system.
  • Please read above instructions carefully. Continue? (default y) : y
  • Connected to Redmi Note 5
  • WhatsApp V2.21.1.13 installed on device
  • Downloading legacy WhatsApp V2.11.431 to helpers folder
  • 100% [........................................................................] 18329558 / 18329558Backing up WhatsApp 2.21.1.13 apk, the one installed on device to tmp/WhatsAppbackup.apk
  • 4729 KB/s (31608405 bytes in 6.525s)
  • Apk backup complete.
  • Uninstalling WhatsApp, skipping data.
  • Success
  • Uninstalled.
  • Installing legacy WhatsApp V2.11.431, hold tight now.
  • Traceback (most recent call last):
  • File "F:\Backups\WhatsApp-Key-Database-Extractor-issues-16\wa_kdbe.py", line 148, in
  • main()
  • File "F:\Backups\WhatsApp-Key-Database-Extractor-issues-16\wa_kdbe.py", line 42, in main
  • USBMode()
  • File "F:\Backups\WhatsApp-Key-Database-Extractor-issues-16\wa_kdbe.py", line 142, in USBMode
  • RealDeal(SDKVersion, WhatsAppapkPath, versionName) if ACReturnCode==1 else Exit()
  • File "F:\Backups\WhatsApp-Key-Database-Extractor-issues-16\wa_kdbe.py", line 95, in RealDeal
  • InstallLegacy(SDKVersion)
  • File "F:\Backups\WhatsApp-Key-Database-Extractor-issues-16\wa_kdbe.py", line 88, in InstallLegacy
  • CustomPrint('SDK Version is : ' + SDKVersion)
  • TypeError: can only concatenate str (not "int") to str

@Benji005
Copy link
Author

I think since the legacy whatsapp version is older than the original whatsapp version installed in my device the code is not working.

@YuvrajRaghuvanshiS
Copy link
Owner

YuvrajRaghuvanshiS commented Jan 28, 2021

Yes you are thinking right. I'm sorry for this error above it was bad code on my side and not related to your issue.
Do a quick
git pull origin
git checkout issue/16
python wa_kdbe.py

Or re-download zip from GitHub whichever way you're doing this.

@Benji005
Copy link
Author

Benji005 commented Jan 28, 2021

- SDK Version is : 27 - 4452 KB/s (18329558 bytes in 4.020s) - Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
  • Found Java installed on system.
  • Please read above instructions carefully. Continue? (default y) : y
  • Connected to Redmi Note 5
  • WhatsApp V2.21.1.13 installed on device
  • Found legacy WhatsApp V2.11.431 apk in helpers/ folder
  • Backing up WhatsApp 2.21.1.13 apk, the one installed on device to tmp/WhatsAppbackup.apk
  • Folder tmp/ already exists.
  • 4410 KB/s (31608405 bytes in 6.999s)
  • Apk backup complete.
  • Uninstalling WhatsApp, skipping data.
  • Success
  • Uninstalled.
  • Installing legacy WhatsApp V2.11.431, hold tight now.
  • SDK Version is : 27
  • 4452 KB/s (18329558 bytes in 4.020s)
  • Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
  • Installation Complete.
  • Backing up WhatsApp data as tmp/whatsapp.ab. May take time, don't panic.
  • Now unlock your device and confirm the backup operation.
  • Done backing up data.
  • Reinstallting original WhatsApp.
  • 5021 KB/s (31608405 bytes in 6.147s)
  • Success
  • Our work with device has finished, it is safe to remove it now.
  • Found whatsapp.ab in tmp folder. Continuing
  • Enter a reference name for this user. : issue16
  • Enter same password which you entered on device when prompted earlier. :
  • Successfully 'fluffed' tmp/whatsapp.ab tmp/whatsapp.tar
  • Taking out main files in tmp/ folder temporaily.
  • 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
  • [WinError 3] The system cannot find the path specified: 'tmp/apps/com.whatsapp/f/key' -> 'extracted/issue16/key'
  • Cleaning up tmp folder...

@Benji005
Copy link
Author

Yes you are thinking right. I'm sorry for this error above it was bad code on my side and not related to your issue.
Do a quick
git pull origin
git checkout issue/16
python wa_kdbe.py

Or re-download zip from GitHub whichever way you're doing this.

Yeah i got it!
But still the issue persists!

@YuvrajRaghuvanshiS
Copy link
Owner

It is saying 'success' when uninstalling whatsapp so downgrading error is not because of apk but because of data (which is not deleted while uninstalling original whatsapp). And I believe that is doing something in not installing legacy apk. I need some time to research into this.

I have used '-d' flag while installing apk adb install -r -d legacy whatsapp which explicitly tells device to allow downgrading of apk

@Benji005
Copy link
Author

Okay... sure take your time.

I will check back later!

@YuvrajRaghuvanshiS
Copy link
Owner

In the meantime you can try this however I'm no longer maintaining this fork : https://github.com/YuvrajRaghuvanshiS/WhatsDump

@Benji005
Copy link
Author

Benji005 commented Jan 28, 2021

In the meantime you can try this however I'm no longer maintaining this fork : https://github.com/YuvrajRaghuvanshiS/WhatsDump

I have tried the same and there is syntax error in the code.

Refer below:
File "F:\Backups\WhatsDump-master\whatsdump.py", line 228
except WaException, e:
^
SyntaxError: invalid syntax

@roberts011
Copy link

WhatsDump only runs with python 2.7

@YuvrajRaghuvanshiS
Copy link
Owner

Thank you @rschuppan for pointing that out. Sorry I missed that.
You need to download python 2.7.x and run it with python2 whatsdump.py

@Benji005
Copy link
Author

Benji005 commented Jan 28, 2021

Then I better wait for you to update this file itself. I have no rush to extract the key.
Or else i will try it later

Anyways thanks! @YuvrajRaghuvanshiS @rschuppan

@roberts011
Copy link

No prob, spent like half a day figuring that out when I tried WhatsDump the first time. Also, I think I remember that the java references are broken...
@YuvrajRaghuvanshiS PLEASE add a note pointing that (python 2.7 thing) out on the readme of your WhatsDump version

@YuvrajRaghuvanshiS
Copy link
Owner

Then I better wait for you to update this file itself. I have no rush to extract the key.
Or else i will try it later

Anyways thanks! @YuvrajRaghuvanshiS @rschuppan

This is not as easy as changing few lines in code.

@Benji005
Copy link
Author

Then I better wait for you to update this file itself. I have no rush to extract the key.
Or else i will try it later
Anyways thanks! @YuvrajRaghuvanshiS @rschuppan

This is not as easy as changing few lines in code.

Yeah... Okay. No problem!

@YuvrajRaghuvanshiS
Copy link
Owner

YuvrajRaghuvanshiS commented Jan 28, 2021

This method does not work work on every device. Recently a friend on mine faced issues on his Samsung device. That's why I'm thinking of re-working that fork of WhatsDump again, https://github.com/YuvrajRaghuvanshiS/WhatsDump/tree/python3Implementation

@roberts011
Copy link

Problem with that is, the core concept of WhatsDump is faulty.
The key spawned by WhatsApp on the emulator is NOT the same key thats on your original / real phone, and therefore cannot be used.
I had to find this out the hard way, you remember by Nox-HowTo over at Signal community.

@YuvrajRaghuvanshiS
Copy link
Owner

Well we don't need key remember? Just msgstore.db is enough for us.

@YuvrajRaghuvanshiS
Copy link
Owner

@Benji005 @thbiela Try now guys, be sure to get latest from github with

git pull origin
git checkout issues/16
python wa_kdbe.py --allow-reboot

@thbiela
Copy link

thbiela commented Feb 19, 2021

It worked! Thank you :D

@YuvrajRaghuvanshiS
Copy link
Owner

You have NO idea how eager I was to hear that. Once @Benji005 also confirms and I'll close this.

@roberts011
Copy link

So is this solved then?

@YuvrajRaghuvanshiS
Copy link
Owner

I do hope so.

@thbiela
Copy link

thbiela commented Feb 21, 2021

I have successfully exported my database and imported all messages to Signal. So in my case this issue is resolved. Thanks again, Yuvray!

YuvrajRaghuvanshiS added a commit that referenced this issue Feb 21, 2021
@YuvrajRaghuvanshiS
Copy link
Owner

@thbiela Can you check one more thing for me since I can not reproduce this issue on my end. During the trial and error period of this issue I came across a post claiming adb v1.0.31 fixes this issue so I changed my binaries accordingly but since this is solved (and I believe is independent of adb version) I have made a branch to check if adb v1.0.41 works as intended. You need to do the following to check

git pull origin
git checkout checks/iss_16_latest_adb
python wa_kdbe.py

YuvrajRaghuvanshiS added a commit that referenced this issue Feb 22, 2021
Checks/iss 16 latest adb
ADB V1.0.41 used, not tested on #16 thoroughly 
Fixed : #24
@Benji005
Copy link
Author

@Benji005 @thbiela Try now guys, be sure to get latest from github with

git pull origin
git checkout issues/16
python wa_kdbe.py --allow-reboot

The latest adb does not recognise my device.
I am using redmi note 5

@Benji005
Copy link
Author

And if I run the latest master the code stops with this:

[11:46:25.008696] Found Java installed on system.

[11:46:25.008696] Please read above instructions carefully ↑ . Continue? (default y) : y
[11:46:27.227537] Connected to Redmi Note 5

@YuvrajRaghuvanshiS
Copy link
Owner

The latest adb does not recognise my device.

Get old adb from here and copy adb.exe AdbWinApi.dll AdbWinUsbApi.dll to bin folder. I think issue is persisting on your device only.

@roberts011
Copy link

@YuvrajRaghuvanshiS
Copy link
Owner

Second one must be active

@YuvrajRaghuvanshiS
Copy link
Owner

It uses curl to check for content length (if file exists on url) and if does then uses wget to download.

@Benji005
Copy link
Author

Extracted the file thank you so much for your efforts!

@roberts011
Copy link

Lol what solved it?

@YuvrajRaghuvanshiS
Copy link
Owner

yeah @Benji005 what solved that for you? That'd be helpful for us to maintain.

@Benji005
Copy link
Author

yeah @Benji005 what solved that for you? That'd be helpful for us to maintain.

I was using usb tethering for internet connection in my pc.
Later i realised that while using adb tethering does not work.
Then i turned on wifi and it started working. That's why i deleted the comment.

@YuvrajRaghuvanshiS
Copy link
Owner

Who'd have thought LoL.

@thbiela
Copy link

thbiela commented Feb 24, 2021

@thbiela Can you check one more thing for me since I can not reproduce this issue on my end. During the trial and error period of this issue I came across a post claiming adb v1.0.31 fixes this issue so I changed my binaries accordingly but since this is solved (and I believe is independent of adb version) I have made a branch to check if adb v1.0.41 works as intended.

@YuvrajRaghuvanshiS Unfortunately, I already have deleted my WhatsApp account after dumping my db. Maybe it could be some android permission related issue? Using your issues/16 branch the temporary installed WA version started and I had to confirm the permissions of the app. After confirmation the dump worked.

@YuvrajRaghuvanshiS
Copy link
Owner

@thbiela maybe not permission related issue but legacy needed to be in running state for it to work and since it is also solved for Benji I believe adb version had nothing to do with it.

@f-nyx
Copy link

f-nyx commented May 7, 2023

Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]

I believe you are using MIUI. MIUI restricts apk installation via adb. You have to allow that. Here's a quick guide

* Go to Settings -> Additional Settings -> Developer options.

* Under Debugging, click on 'Install via USB' option.

You might need to add MI account to your device for that

In order to make it work in MIUI 12.03 and newer, you need to disable the MIUI Optimizations to prevent the confirmation popup from cancelling the process. In MIUI 13.x, if the install confirmation popup shows up, it breaks the script, it does not allow you to manually accept the installation of an APK via USB, even if the USB Install option is enabled in the Developer Options.

The following guide to disable MIUI Optimizations works: https://www.gizmochina.com/guides/how-to-disable-miui-optimization/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants