Skip to main content

Extract WhatsApp key/DB from package directory (/data/data/com.whatsapp) without root access.

Project description



Logo

WhatsApp Key/Database Extractor

Extract key/msgstore.db from /data/data/com.whatsapp in Android v4.0+ without root.

-----------------------------------------------------

-----------------------------------------------------

About The Project

This project is inspired by EliteAndroidApps/WhatsApp-Key-DB-Extractor. Since Android v4.0+ Google has removed adb backup and apps no longer supported being backed up by "adb backup -f myApp.ab -apk com.foobar.app". However there is one catch in this scenario and that is some old version of many apps including WhatsApp support that to this day, and that's the idea...

The idea is to install "Legacy Version" of WhatsApp on you device via adb and use "adb backup" to fetch files from "/data/data/com.whatsapp" folder which includes both the 'key' and 'msgstore.db' (non encrypted) file and after that restore current WhatsApp.

Built With

Depends on

  • Java (To extract backup)

-----------------------------------------------------

Getting Started

Before doing anything take a backup of your chats and turn off your phone's internet so you don't lose any new messages. For that go to 'WhatsApp Settings → Chat Settings → Chat Backup' here take a local bacakup. Prepare for Worst. After intallation follow on screen instructions.

Prerequisites

  • O/S: Any Windows/Mac/Linux.
  • Python 3.x
  • Java
  • USB Debugging must be enabled on the target device. Settings → Developer Options → USB debugging.
    • If you cannot find Developer Options then please go to: Settings → About phone/device and tap the Build number multiple times until you're finally declared a developer.
  • Android device with Android 4.0 or higher. i.e. Ice Cream Sandwich, Jelly Bean, KitKat, Lollipop, Marshmallow, Nougat, Oreo, Pie, Q.

Installation

  1. Download and install.
pip install wakdbe
  1. Install dependencies (for linux and OSX only) : skip sudo for mac.
**TODO**
chmod +x bin/linux_dependencies.sh
sudo ./bin/linux_dependencies.sh

If you're getting any error while running above command you need to install the following manually for your linux distro. : adb curl tar openjdk11 7zip scrcpy

  1. Unleash the beast
python3 -m wakdbe -h

Command Line Flags

Short Flag Type Behaviour Status
-ar --allow-reboot Optional Bool Reboots device before installing Legacy WhatsApp. Stable
-tip --tcp-ip IP_ADDRESS Optional String Connects to a remote device via TCP mode. Stable
-tp --tcp-port PORT Optional String Port number to connect to. Default : 5555. Stable
-s --scrcpy Optional Bool Show device screen as a window using ScrCpy. Stable
-to --tar-only Optional Bool Get ALL files as a tarball instead of main files from whatsapp backup. Beta

Example usage :

python3 -m wakdbe --allow-reboot --tcp-ip 192.168.43.130 --tcp-port 5555 --scrcpy --tar-only
python3 -m wakdbe -ar -tip 192.168.43.130 -tp 5555 -s -to

Standalone Operations

These operations are standalone implementation of their defined task. One should run these when specifically needed. For ex : Process finished but WhatsApp was not reinstalled on device.

  1. Run view_extract : To unpack whatsapp.ab to whatsapp.tar and extract files.
python3 -m wakdbe.view_extract
  • IMP : For this to work there should be 'whatsapp.ab' file either in 'extracted/' folder or in 'tmp' folder in your directory.
  1. Run protect : To compress/decompress user folder with(out) password for safekeeping.
python3 -m wakdbe.protect
  • IMP : For this to work there should either be "userName" folder or "userName.7z" file in 'extracted' folder in current directory. Where "userName" is name of user you entered earlier.
  1. Run restore_whatsapp : To reinstall WhatsApp on device.
python3 -m wakdbe.restore_whatsapp

Features & ToDo

  • 🟢 Extracts msgstore.db from /data/data/com.whatsapp. (duh)
  • 🟢 Works wirelessly without USB cable using "ADB over TCP" with --tcp-ip IP --tcp-port PORT flags.
  • 🟢 See and control your android phone with your computer using ScrCpy using --scrcpy flag.
  • 🟢 Works with any android device v4.0+ so far.
  • 🟢 Works with any android device no matter where it is in universe as long as it is running ADB over TCP.
  • 🟢 Moves msgstore.db to your phone.
  • 🟢 Creates password protected 7z file so keep your extraction safe.
  • 🟢 Continues without JAVA installed and make "whatsapp.tar" out of "whatsapp.ab" once java is installed by running python3 -m wakdbe.view_extract.
  • 🟢 Command line arguments
  • 🟢 ADB Devices menu.
  • 🟢 Implement datetime.
  • 🟢 Extracts backup created over TCP.
  • 🔴 Works with WhatsApp Business.

Demo

https://github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor/discussions/33

Troubleshooting

  • If running python3 -m wa_kdbe or any other file is throwing error like "python3 is recognised as interal or external command." AND python3 is "already added to path (in case of windows)" try running files with py -m wa_kdbe instead.

  • If list is empty close terminal, remove and replug the device, and re-run the script. Read more.

  • If you have never used USB Debugging before, you may also need to verify the fingerprint by ticking the checkbox and tapping 'allow' on device popup.

  • If you have set a default backup password in your Android settings, then this MUST be the backup password that you PROVIDE when prompted to backup your data. Else it WILL fail!

  • If you get an error saying "AES encryption not allowed" then you need to update your Oracle Java Cryptography Extension (JCE) to Unlimited Strength Jurisdiction Policy Files.

  • WhatsApp crashing? Run python3 -m wakdbe.restore_whatsapp. Or "clear data/storage" / uninstall and reinstall from Play Store.

  • In MIUI, "Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]" occurs during installation of LegacyWhatsapp.apk, fix it by allowing install via adb

  • If "[INSTALL_FAILED_VERSION_DOWNGRADE]" run with --allow-reboot flag.

    python3 -m wa_kdbe --allow-reboot
    
  • If "[INSTALL_PARSE_FAILED_NOT_APK]" delete helpers/LegacyWhatsApp.apk and re-run.

  • If "adb: error: cannot create 'tmp/WhatsAppbackup.apk': Permission denied" on macOS run script with sudo.

    sudo python3 -m wa_kdbe
    

-----------------------------------------------------

Limitations

There always are limitations on how much we can make it work and this is what allows us to keep going. Well no matter what I do sometimes this tool just won't work on some devices and if that's your case you can try this fork of MarcoG3's WhatsDump by Alessandro Maggio.

-----------------------------------------------------

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the project on GitHub.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. "Draft" a pull request and mark it "Ready for review" once work is done.

Other ways to contribute is to buy me a coffee but let's just say it is to test out new features of the project. Checkout features/fast to test backup and reinstallation of WhatsApp on device level. This makes it quite time saving specially in case of TCP.

-----------------------------------------------------

License

Distributed under the MIT License. See LICENSE for more information.

-----------------------------------------------------

Agreement

I made this project because it was hard for me to kill time and the other one was very old. This tool is provided "as-is" and hence you will be responsible however you use it. Cheers☕

-----------------------------------------------------

Contact

Yuvraj Raghuvanshi - Send me a mail

Project Link: https://github.com/yuvrajraghuvanshis/WhatsApp-Key-Database-Extractor

-----------------------------------------------------

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wakdbe-0.4.1.tar.gz (31.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wakdbe-0.4.1-py3-none-any.whl (31.8 MB view details)

Uploaded Python 3

File details

Details for the file wakdbe-0.4.1.tar.gz.

File metadata

  • Download URL: wakdbe-0.4.1.tar.gz
  • Upload date:
  • Size: 31.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for wakdbe-0.4.1.tar.gz
Algorithm Hash digest
SHA256 d1df10f7d89a7e5dc25a4682f75a65942abc8734bef47fce4ab2a2024ec95a7a
MD5 7fb34187b974f0f32a3a0546dee1a40b
BLAKE2b-256 8084129e04c8977558cc2f2aa374ffae3280029793b7b984721e89dea4a1e93a

See more details on using hashes here.

File details

Details for the file wakdbe-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: wakdbe-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 31.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for wakdbe-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 918b2dd2269dda32eca1079d15d07428e9ee4537ad091540a76173b1b73f60f2
MD5 482b87d57dc263f9491a4d13d135f1e9
BLAKE2b-256 eab8ae86da141f841c7695331dbc6abcc2ae6ba79710105462191d24a0b103c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page