# yuvrajraghuvanshis/whatsapp-key-database-extractor architecture

> Architecture diagram of the GitHub repository yuvrajraghuvanshis/whatsapp-key-database-extractor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yuvrajraghuvanshis/whatsapp-key-database-extractor
- Repository: https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor

## Overview

This is a Python utility for extracting WhatsApp’s key and message database from an Android device without root. The main workflow connects over USB or ADB-over-TCP, temporarily uses a legacy WhatsApp version to create an Android backup, unpacks that backup, and saves selected files for the user. Separate utilities can restore the original app or password-protect extracted files. The README documents the overall process; some orchestration calls and extraction details are omitted from the sampled excerpts, so those links are marked unverified or omitted.

Main entry points: [`wa_kdbe.py`](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/wa_kdbe.py) (Extractor CLI), [`view_extract.py`](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/view_extract.py) (Backup unpacking), [`restore_whatsapp.py`](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/restore_whatsapp.py) (App restore utility), [`protect.py`](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/protect.py) (Archive protection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Device workflow"]
  node_main["Extractor CLI<br/>[wa_kdbe.py]"]
  node_discovery["Device discovery"]
  node_validation["Device validation<br/>[handler.py]"]
  node_legacy["Legacy app handling<br/>[wa_kdbe.py]"]
end

subgraph group_extract["Backup extraction"]
  node_extractor["Backup unpacking<br/>[view_extract.py]"]
  node_backup["Android backup"]
  node_results["Extracted files"]
end

subgraph group_utilities["Standalone utilities"]
  node_restore["App restore utility"]
  node_protect["Archive protection<br/>[protect.py]"]
end

subgraph group_support["Shared support"]
  node_logging["Console and logging<br/>[custom_ci.py]"]
end

node_user(("User"))
node_device_android["Android device"]
node_adb["ADB tools"]
node_legacy_cdn["Legacy app sources"]
node_java["Java ABE"]
node_sevenzip["7-Zip tool"]
node_scrcpy["Screen control"]

node_user -->|"starts workflow"| node_main
node_main -.->|"selects device"| node_discovery
node_discovery -->|"runs commands"| node_adb
node_adb -->|"connects to"| node_device_android
node_main -.->|"checks device"| node_validation
node_validation -->|"downloads app"| node_legacy_cdn
node_validation -->|"queries device"| node_adb
node_main -->|"runs backup flow"| node_legacy
node_legacy -->|"backs up app data"| node_device_android
node_legacy -->|"creates backup"| node_backup
node_main -->|"offers extraction"| node_extractor
node_extractor -->|"reads backup"| node_backup
node_extractor -->|"unpacks archive"| node_java
node_extractor -->|"writes selected files"| node_results
node_user -->|"runs standalone"| node_restore
node_restore -->|"selects device"| node_discovery
node_restore -->|"reinstalls original app"| node_device_android
node_user -->|"runs standalone"| node_protect
node_protect -->|"archives extracted data"| node_results
node_protect -->|"compresses or extracts"| node_sevenzip
node_main -.->|"optionally launches"| node_scrcpy
node_main -.->|"reports progress"| node_logging
node_extractor -->|"reports progress"| node_logging
node_protect -->|"reports progress"| node_logging
node_restore -->|"reports progress"| node_logging

click node_main "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/wa_kdbe.py"
click node_discovery "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/helpers/device_serial_id.py"
click node_validation "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/helpers/handler.py"
click node_legacy "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/wa_kdbe.py"
click node_extractor "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/view_extract.py"
click node_backup "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/tree/master/extracted"
click node_results "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/tree/master/extracted"
click node_restore "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/restore_whatsapp.py"
click node_protect "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/protect.py"
click node_logging "https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/helpers/custom_ci.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_discovery,node_validation,node_legacy,node_user,node_scrcpy toneBlue
class node_extractor,node_backup,node_results toneAmber
class node_restore,node_protect toneMint
class node_logging toneRose
class node_device_android,node_adb,node_legacy_cdn,node_java,node_sevenzip toneIndigo
```

## Components

### Device workflow

- [Extractor CLI](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/wa_kdbe.py): `wa_kdbe.py`
- [Device discovery](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/helpers/device_serial_id.py): `helpers/device_serial_id.py`
- [Device validation](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/helpers/handler.py): `helpers/handler.py`
- [Legacy app handling](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/wa_kdbe.py): `wa_kdbe.py`

### Backup extraction

- [Backup unpacking](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/view_extract.py): `view_extract.py`
- [Android backup](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/tree/master/extracted): `extracted`
- [Extracted files](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/tree/master/extracted): `extracted`

### Standalone utilities

- [App restore utility](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/restore_whatsapp.py): `restore_whatsapp.py`
- [Archive protection](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/protect.py): `protect.py`

### Shared support

- [Console and logging](https://github.com/yuvrajraghuvanshis/whatsapp-key-database-extractor/blob/master/helpers/custom_ci.py): `helpers/custom_ci.py`

### Other components

- **User**
- **Android device**
- **ADB tools**
- **Legacy app sources**
- **Java ABE**
- **7-Zip tool**
- **Screen control**

## Connections

- User → Extractor CLI: starts workflow (evidence: `README.md`)
- Extractor CLI → Device discovery: selects device (evidence: `wa_kdbe.py`)
- Device discovery → ADB tools: runs commands (evidence: `helpers/device_serial_id.py`)
- ADB tools → Android device: connects to
- Extractor CLI → Device validation: checks device (evidence: `wa_kdbe.py`)
- Device validation → Legacy app sources: downloads app (evidence: `helpers/handler.py`)
- Device validation → ADB tools: queries device (evidence: `helpers/handler.py`)
- Extractor CLI → Legacy app handling: runs backup flow (evidence: `wa_kdbe.py`)
- Legacy app handling → Android device: backs up app data (evidence: `README.md`)
- Legacy app handling → Android backup: creates backup (evidence: `README.md`)
- Extractor CLI → Backup unpacking: offers extraction (evidence: `README.md`)
- Backup unpacking → Android backup: reads backup (evidence: `view_extract.py`)
- Backup unpacking → Java ABE: unpacks archive (evidence: `view_extract.py`)
- Backup unpacking → Extracted files: writes selected files (evidence: `view_extract.py`)
- User → App restore utility: runs standalone (evidence: `README.md`)
- App restore utility → Device discovery: selects device (evidence: `restore_whatsapp.py`)
- App restore utility → Android device: reinstalls original app (evidence: `restore_whatsapp.py`)
- User → Archive protection: runs standalone (evidence: `README.md`)
- Archive protection → Extracted files: archives extracted data (evidence: `protect.py`)
- Archive protection → 7-Zip tool: compresses or extracts (evidence: `protect.py`)
- Extractor CLI → Screen control: optionally launches
- Extractor CLI → Console and logging: reports progress (evidence: `wa_kdbe.py`)
- Backup unpacking → Console and logging: reports progress (evidence: `view_extract.py`)
- Archive protection → Console and logging: reports progress (evidence: `protect.py`)
- App restore utility → Console and logging: reports progress (evidence: `restore_whatsapp.py`)
