KnugiHK / WhatsApp-Key-DB-Extractor

Allows WhatsApp users to extract their cipher key and databases on non-rooted Android devices.
Other
107 stars 6 forks source link

Prompt for cache refresh #8

Open SavSanta opened 5 months ago

SavSanta commented 5 months ago

I have 1 day (well literally 8 minutes now) before the app has to be updated from 2.23.23.78 to whatever is here now that made Issue #6 . As Im a big procrastinator lol. I tried to see how this utility works on my old phone with Android 8.0 ahead of dealing with possible Issue #6 issues

I interestingly enough had a more successful run than I did on my Android 10 device where I discovered the issue presenting in Issue #4 . So PR i submitted for that doesnt present after a certain Android version.

However I did run into "[INSTALL_FAILED_VERSION_DOWNGRADE] " as described in Issue #2 .

In my case app was uninstalled successfully. The older OS didnt update/refresh the installed software package cache/manifests somewhere on the phone which I somehow got that error presented. Restarting the device and Manually installed removed it. Perhaps might need a modification to read the errorcode/sucess value and prompt for that as restarting or if possible manually refreshing the cache should be considered.

Everything else went as expected

SavSanta commented 5 months ago

Output describing the situation above

`\=========================================================================
\= 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: v5.1 (22/02/2022) ### =
\=========================================================================

Please connect your Android device with USB Debugging enabled:

cannot connect to daemon at tcp:5037: Connection refused

Downloading legacy WhatsApp 2.11.431 to local folder

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 17.4M 100 17.4M 0 0 7671k 0 0:00:02 0:00:02 --:--:-- 7672k

WhatsApp 2.23.23.78 installed

Backing up WhatsApp 2.23.23.78
/data/app/com.whatsapp-vPvkDixlHOeWZYS91dxTrA==/base.ap...pulled, 0 skipped. 14.0 MB/s (55290033 bytes in 3.764s) Backup complete

Removing WhatsApp 2.23.23.78 skipping data
Success
Removal complete

Installing legacy WhatsApp 2.11.431
Performing Streamed Install
adb: failed to install tmp/LegacyWhatsApp.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
`

[ At this point I reboot the phone and install it manually]

`Install complete

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

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:

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
apps/com.whatsapp/f/key
apps/com.whatsapp/f/encrypted_backup.key
apps/com.whatsapp/db/msgstore.db
apps/com.whatsapp/db/wa.db
apps/com.whatsapp/db/axolotl.db
apps/com.whatsapp/db/chatsettings.db
tar: apps/com.whatsapp/Avatars: Not found in archive
tar: Exiting with failure status due to previous errors

Saving whatsapp.cryptkey ...

Saving encrypted_backup.key ...
Saving msgstore.db ...
Saving wa.db ...
Saving axolotl.db ...
Saving chatsettings.db ...
cp: cannot stat 'tmp/apps/com.whatsapp/Avatars': No such file or directory
Saving Avatars...

Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
tmp/apps/com.whatsapp/f/key: 1 file pushed, 0 skipped. 0.9 MB/s (158 bytes in 0.000s)

Restoring WhatsApp 2.23.23.78
Performing Streamed Install
Success
Restore complete

Cleaning up temporary files ...
Done

Operation complete

Please press Enter to quit... `

SavSanta commented 5 months ago

No further testing possible on this phone. Accidentally erased my data doing a second complete uninstall without the -k flag. Whoops. Big sad

drzraf commented 3 weeks ago

Happened to me. Same error, same resolution: a phone reboot. But a user is likely to interrupt the script what is not fool proof because running it again: It'll store 2.11.431 as the "previous" version, and attempt to restore it from whatsapp after the operation is complete which is further confusing and error proof. That's a scenario the script should handle in an safe and idempotent way.