YuvrajRaghuvanshiS / WhatsApp-Key-Database-Extractor

The most advanced and complete solution for extracting WhatsApp key/DB from package directory (/data/data/com.whatsapp) without root access.
MIT License
443 stars 57 forks source link

unexpected end of data #115

Closed stambec closed 10 months ago

stambec commented 1 year ago

Describe the bug Launching python3 wa_kdbe.py --allow-reboot During extraction, after succesfully unpacking, "unexpected end of data" pops up. The tmp folder couldnt be deleted, and its content (tmp/whatsapp.tar) is an unreadable archive (unexpected end of archive); /extracted/customFolder is empty. . Note: previously, an [INSTALL_FAILED_ALREADY_EXISTS] error popped up in the process of reinstalling Whatsapp, latest version. I don't think it has anything to do with the next problem, as it is the last thing that requires the device. It is very easily solved by manually reinstalling Whatsapp and it runs perfectly.

Screenshots logs

additional context Ran on Huawei P8 Lite 2017, Android 8.0.0. Latest version of Whatsapp (2.23.12.77). Database is .crypt14, circa 580MB. Had to run with --allow-reboot because otherwise Legacy Whatsapp couldn't be installed. Ran on another Huawei P8 Lite 2017, Android 7.0, different database, with no problems, smoothly delivered. Side note: the sd with Whatsapp/Media was previously removed and put into the latter device. Sim was removed as well. I doubt this has anything to do with it, but it is context.

Terminal output or log file


====== Logging starts here. ====== 
====== Logging starts here. ====== 
File: wa_kdbe.py
Date: Monday 19/06/2023, 23:46:49
If you see any password here then do let know @github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor

[Monday 19/06/2023, 23:46:49] >>> I am in device_serial_id.init(mode=USB, tcp_ip, tcp_port=)
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.main()
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.check_bin()
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.show_banner()

================================================================================
========                Current release date: 21/04/2022                ========
========                                                                ========
========  db   d8b   db  .d8b.         db   dD d8888b. d8888b. d88888b  ========
========  88   I8I   88 d8' `8b        88 ,8P' 88  `8D 88  `8D 88'      ========
========  88   I8I   88 88ooo88        88,8P   88   88 88oooY' 88ooooo  ========
========  Y8   I8I   88 88~~~88 C8888D 88`8b   88   88 88~~~b. 88~~~~~  ========
========  `8b d8'8b d8' 88   88        88 `88. 88  .8D 88   8D 88.      ========
========   `8b8' `8d8'  YP   YP        YP   YD Y8888D' Y8888P' Y88888P  ========
========                                                                ========
================================================================================

============ WhatsApp Key / Database Extrator for non-rooted Android ===========

================================================================================
===                                                                          ===
===  xxxxx  PLEASE TAKE WHATSAPP CHAT BACKUP BEFORE GETTING STARTED.  xxxxx  ===
===                                                                          ===
===     For that go to "WhatsApp settings \u2192 Chat Settings \u2192 Chat Backup"     ===
===              here take a local backup. Prepare for Worst.                ===
===                                                                          ===
===  Also if you see a folder "Android/media/com.whatsapp" copy it somewhere ===
===   safe. New versions of WhatsApp are saving data here INCLUDING IMAGES   ===
===       AND VIDEOS. I try to save it while uninstalling WhatsApp but       ===
===                        YOU CAN NEVER BE TOO SAFE.                        ===
===                                                                          ===
===     This script can extract your WhatsApp msgstore.db (non crypt12,      ===
===   un-encrypted file) and your "key" file from "/data/data/com.whatsapp"  ===
===  directory in Android 4.0+ device without root access. However you need  ===
===   to have JAVA installed on your system in order to "view the extract".  ===
===  If you don't have JAVA installed then you can "view extract" later by   ===
===   running "view_extract.py". The idea is to install a "Legacy WhatsApp"  ===
===       temporarily on your device in order to get the android backup      ===
===    permission. You should not lose any data and your current WhatsApp    ===
===   version will be installed after this process so don't panic and don't  ===
=== stop this script while it's working. However if something fails you can  ===
===    run "restore_whatsapp.py" and reinstall current WhatsApp or simply    ===
===                    update that from Google Play Store.                   ===
===                                                                          ===
===                      Script by: Yuvraj Raghuvanshi                       ===
===                      Github.com/YuvrajRaghuvanshiS                       ===
================================================================================

[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.check_java()
[Monday 19/06/2023, 23:46:49] Found Java v1.8.0_361 installed on system. Continuing...

[Monday 19/06/2023, 23:46:49] Arguments passed: Namespace(allow_reboot=True, tcp_ip=None, tcp_port='5555', scrcpy=False, tar_only=False)
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.get_sys_info()
[Monday 19/06/2023, 23:46:49] System Info: {
  "Architecture": "AMD64",
  "Hostname": "Stoat",
  "Platform": "Windows",
  "Platform Release": "10",
  "Platform Version": "10.0.19045",
  "Processor": "Intel64 Family 6 Model 78 Stepping 3, GenuineIntel",
  "RAM": "16 GB",
  "Python": [
    "tags/v3.11.4:d2340ef",
    "Jun  7 2023 05:45:37"
  ]
}
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.run_scrcpy(_is_scrcpy=False)
[Monday 19/06/2023, 23:46:49] Turned off wifi and mobile data...
[Monday 19/06/2023, 23:46:49] Please read above instructions carefully \u2191 . Continue? (default y): 

[Monday 19/06/2023, 23:46:49] If you haven't already, it is advised to take a WhatsApp chat backup by going to "WhatsApp settings \u2192 Chat Settings \u2192 Chat Backup". Hit "Enter" key to continue.
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.usb_mode()
[Monday 19/06/2023, 23:46:49] >>> I am in handler.handler(adb=bin\adb.exe -s 57U7N17913006451)
[Monday 19/06/2023, 23:46:49] Connected to PRA-LX1
[Monday 19/06/2023, 23:46:49] >>> I am in handler.after_connect(adb=bin\adb.exe -s 57U7N17913006451)
Starting new HTTPS connection (1): web.archive.org:443
https://web.archive.org:443 "HEAD /web/20141111030303if_/http://www.whatsapp.com/android/current/WhatsApp.apk HTTP/1.1" 200 0
[Monday 19/06/2023, 23:46:49] WhatsApp v2.23.12.77 installed on device
[Monday 19/06/2023, 23:46:49] Found legacy WhatsApp V2.11.431 apk in "helpers" folder
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.real_deal(sdk_version=26, whatsapp_apk_path_in_device=/data/app/com.whatsapp-4Itbw-72lXYEKrpqzEPi8w==/base.apk, version_name=2.23.12.77)
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.backup_whatsapp_apk(sdk_version=26, version_name=2.23.12.77, whatsapp_apk_path_in_device=/data/app/com.whatsapp-4Itbw-72lXYEKrpqzEPi8w==/base.apk)
[Monday 19/06/2023, 23:46:49] Backing up WhatsApp 2.23.12.77 apk, the one installed on device to "/data/local/tmp/WhatsAppbackup.apk" in your phone.
[Monday 19/06/2023, 23:46:49] Apk backup is completed.
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.uninstall_whatsapp(sdk_version=26)
[Monday 19/06/2023, 23:46:49] Uninstalling WhatsApp, skipping data.
[Monday 19/06/2023, 23:46:49] Uninstalled.

[Monday 19/06/2023, 23:46:49] Rebooting device, please wait.
[Monday 19/06/2023, 23:46:49] Waiting for device to get online | o    |
[Monday 19/06/2023, 23:46:49] Hit "Enter" key after unlocking device.
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.install_legacy(sdk_version=26)
[Monday 19/06/2023, 23:46:49] Installing legacy WhatsApp V2.11.431, hold tight now.
[Monday 19/06/2023, 23:46:49] Installation Complete.
[Monday 19/06/2023, 23:46:49] Starting: Intent { cmp=com.whatsapp/.Main }
[Monday 19/06/2023, 23:46:49] Running legacy WhatsApp, it may crash, do not check for updates if it prompts.
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.backup_whatsapp_data_as_ab(sdk_version=26)
[Monday 19/06/2023, 23:46:49] Backing up WhatsApp data as "tmp/whatsapp.ab". May take time, don't panic.
[Monday 19/06/2023, 23:46:49] Done backing up data. Size: 501849605 bytes.
[Monday 19/06/2023, 23:46:49] >>> I am in wa_kdbe.reinstall_whatsapp()
[Monday 19/06/2023, 23:46:49] Reinstalling original WhatsApp.
[Monday 19/06/2023, 23:46:49] Could not install WhatsApp, install by running "restore_whatsapp.py" or manually installing from Play Store.
However if it crashes then you have to clear storage/clear data from "Settings \u2192 App Settings \u2192 WhatsApp".
[Monday 19/06/2023, 23:46:49] Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install com.whatsapp without first uninstalling.]

[Monday 19/06/2023, 23:46:49] Our work with device has finished, it is safe to remove it now.

[Monday 19/06/2023, 23:46:49] >>> I am in view_extract.extract_ab(is_java_installed=True, is_tar_only=False)
[Monday 19/06/2023, 23:46:49] Found "whatsapp.ab" in "tmp" folder. Continuing... Size: 501849605 bytes.
[Monday 19/06/2023, 23:46:49] Enter a name for this user (default "user").: dada
[Monday 19/06/2023, 23:46:49] Enter same password which you entered on device when prompted earlier.: ********
[Monday 19/06/2023, 23:46:49] Successfully unpacked "tmp/whatsapp.ab" to "tmp/whatsapp.tar". Size: 1245757440 bytes.
[Monday 19/06/2023, 23:46:49] >>> I am in view_extract.taking_out_main_files(username=dada)
[Monday 19/06/2023, 23:46:49] Folder "extracted/" already exists.
[Monday 19/06/2023, 23:46:49] Taking out main files in "tmp/" folder temporarily.
[Monday 19/06/2023, 23:46:49] unexpected end of data
[Monday 19/06/2023, 23:46:49] >>> I am in view_extract.clean_tmp()
[Monday 19/06/2023, 23:46:49] Cleaning up "tmp/" folder...
[Monday 19/06/2023, 23:46:49] Could not delete "tmp/" folder...
[Monday 19/06/2023, 23:46:49] [WinError 32] Impossibile accedere al file. Il file è utilizzato da un altro processo: 'tmp/whatsapp.tar'
[Monday 19/06/2023, 23:46:49] Delete it manually, it's important.
[Monday 19/06/2023, 23:46:49] >>> I am in view_extract.kill_me(reason=)

[Monday 19/06/2023, 23:46:49] Exiting...
[Monday 19/06/2023, 23:46:49] Turn off USB debugging [and USB debugging (Security Settings)] if you're done.
[Monday 19/06/2023, 23:46:49] Hit "Enter" key to continue....