# pablolec/recoverpy architecture

> Architecture diagram of the GitHub repository pablolec/recoverpy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pablolec/recoverpy
- Repository: https://github.com/pablolec/recoverpy

## Overview

RecoverPy is a Linux terminal application for finding and manually extracting surviving content from raw partitions or disk images. The main workflow is select a device, search for a string, inspect and navigate matching blocks, choose useful blocks, and save them. Its internal layers separate device discovery and metadata, streaming byte scanning and result conversion, block reads, and text/result modeling. The graph uses documented workflow links and the shown call/import relationships; unsampled modules are represented only where the README or source index supports their role.

Main entry points: [`recoverpy/lib/search/search_engine.py`](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/search/search_engine.py) (Search engine), [`recoverpy/ui/app.py`](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/app.py) (Application), [`recoverpy/ui/screens/screen_result.py`](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_result.py) (Block inspection), [`recoverpy/ui/screens/screen_search.py`](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_search.py) (Search screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Textual interface"]
  node_app["Application<br/>[app.py]"]
  node_environment["Environment check<br/>[env_check.py]"]
  node_params["Partition and query<br/>[screen_params.py]"]
  node_partition_list["Partition list<br/>[partition_list.py]"]
  node_search_screen["Search screen<br/>[screen_search.py]"]
  node_result_list["Result list"]
  node_result_screen["Block inspection<br/>[screen_result.py]"]
  node_save_screen["Save confirmation<br/>[screen_save.py]"]
  node_path_edit["Save path editor"]
end

subgraph group_device["Device access"]
  node_inventory["Device inventory"]
  node_partition_model["Partition model<br/>[partition.py]"]
  node_device_metadata["Device metadata"]
  node_byte_reader["Block and range reader"]
end

subgraph group_search["Search and results"]
  node_engine["Search engine<br/>[search_engine.py]"]
  node_scanner["Binary scanner<br/>[binary_scanner.py]"]
  node_search_params["Search parameters<br/>[search_params.py]"]
  node_progress["Search progress<br/>[search_progress.py]"]
  node_text_processing["Text processing<br/>[text_processing.py]"]
  node_search_result["Search result model<br/>[search_result.py]"]
end

subgraph group_recovery["Inspection and saving"]
  node_saver["Selected-block saver<br/>[saver.py]"]
end

node_user(("User"))
node_raw_source["Partition or image"]
node_output_file["Saved output file"]

node_user -->|"starts and operates"| node_app
node_app -->|"installs and opens"| node_params
node_app -->|"checks environment"| node_environment
node_params -->|"uses"| node_partition_list
node_partition_list -->|"discovers devices"| node_inventory
node_inventory -->|"creates partitions"| node_partition_model
node_user -->|"selects partition and query"| node_params
node_app -->|"starts search"| node_search_screen
node_search_screen -->|"starts and controls"| node_engine
node_engine -->|"stores query"| node_search_params
node_engine -->|"gets device size"| node_device_metadata
node_engine -->|"scans for hits"| node_scanner
node_scanner -->|"reads byte stream"| node_raw_source
node_engine -->|"validates hit blocks"| node_byte_reader
node_engine -->|"decodes hit content"| node_text_processing
node_engine -->|"creates results"| node_search_result
node_engine -->|"updates progress"| node_progress
node_search_screen -->|"streams results to"| node_result_list
node_result_list -->|"renders"| node_search_result
node_user -->|"opens match"| node_search_screen
node_app -->|"opens selected block"| node_result_screen
node_result_screen -->|"reads adjacent blocks"| node_byte_reader
node_byte_reader -->|"reads at offsets"| node_raw_source
node_result_screen -->|"formats block content"| node_text_processing
node_result_screen -->|"adds selected blocks"| node_saver
node_result_screen -->|"opens save flow"| node_save_screen
node_save_screen -->|"opens path editor"| node_path_edit
node_path_edit -->|"confirms directory"| node_save_screen
node_save_screen -->|"saves selected blocks"| node_saver
node_saver -->|"writes output"| node_output_file

click node_app "https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/app.py"
click node_environment "https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/env_check.py"
click node_params "https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_params.py"
click node_partition_list "https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/widgets/partition_list.py"
click node_inventory "https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/storage/block_device_inventory.py"
click node_partition_model "https://github.com/pablolec/recoverpy/blob/main/recoverpy/models/partition.py"
click node_device_metadata "https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/storage/block_device_metadata.py"
click node_search_screen "https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_search.py"
click node_engine "https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/search/search_engine.py"
click node_scanner "https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/search/binary_scanner.py"
click node_search_params "https://github.com/pablolec/recoverpy/blob/main/recoverpy/models/search_params.py"
click node_progress "https://github.com/pablolec/recoverpy/blob/main/recoverpy/models/search_progress.py"
click node_text_processing "https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/text/text_processing.py"
click node_search_result "https://github.com/pablolec/recoverpy/blob/main/recoverpy/models/search_result.py"
click node_result_list "https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/widgets/search_result_list.py"
click node_result_screen "https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_result.py"
click node_byte_reader "https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/storage/byte_range_reader.py"
click node_saver "https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/saver.py"
click node_save_screen "https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_save.py"
click node_path_edit "https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_path_edit.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_app,node_environment,node_params,node_partition_list,node_search_screen,node_result_list,node_result_screen,node_save_screen,node_path_edit,node_user toneBlue
class node_inventory,node_partition_model,node_device_metadata,node_byte_reader toneAmber
class node_engine,node_scanner,node_search_params,node_progress,node_text_processing,node_search_result toneMint
class node_saver toneRose
class node_raw_source,node_output_file toneIndigo
```

## Components

### Textual interface

- [Application](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/app.py): `recoverpy/ui/app.py`
- [Environment check](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/env_check.py): `recoverpy/lib/env_check.py`
- [Partition and query](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_params.py): `recoverpy/ui/screens/screen_params.py`
- [Partition list](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/widgets/partition_list.py): `recoverpy/ui/widgets/partition_list.py`
- [Search screen](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_search.py): `recoverpy/ui/screens/screen_search.py`
- [Result list](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/widgets/search_result_list.py): `recoverpy/ui/widgets/search_result_list.py`
- [Block inspection](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_result.py): `recoverpy/ui/screens/screen_result.py`
- [Save confirmation](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_save.py): `recoverpy/ui/screens/screen_save.py`
- [Save path editor](https://github.com/pablolec/recoverpy/blob/main/recoverpy/ui/screens/screen_path_edit.py): `recoverpy/ui/screens/screen_path_edit.py`

### Device access

- [Device inventory](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/storage/block_device_inventory.py): `recoverpy/lib/storage/block_device_inventory.py`
- [Partition model](https://github.com/pablolec/recoverpy/blob/main/recoverpy/models/partition.py): `recoverpy/models/partition.py`
- [Device metadata](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/storage/block_device_metadata.py): `recoverpy/lib/storage/block_device_metadata.py`
- [Block and range reader](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/storage/byte_range_reader.py): `recoverpy/lib/storage/byte_range_reader.py`

### Search and results

- [Search engine](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/search/search_engine.py): `recoverpy/lib/search/search_engine.py`
- [Binary scanner](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/search/binary_scanner.py): `recoverpy/lib/search/binary_scanner.py`
- [Search parameters](https://github.com/pablolec/recoverpy/blob/main/recoverpy/models/search_params.py): `recoverpy/models/search_params.py`
- [Search progress](https://github.com/pablolec/recoverpy/blob/main/recoverpy/models/search_progress.py): `recoverpy/models/search_progress.py`
- [Text processing](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/text/text_processing.py): `recoverpy/lib/text/text_processing.py`
- [Search result model](https://github.com/pablolec/recoverpy/blob/main/recoverpy/models/search_result.py): `recoverpy/models/search_result.py`

### Inspection and saving

- [Selected-block saver](https://github.com/pablolec/recoverpy/blob/main/recoverpy/lib/saver.py): `recoverpy/lib/saver.py`

### Other components

- **User**
- **Partition or image**
- **Saved output file**

## Connections

- User → Application: starts and operates (evidence: `README.md`)
- Application → Partition and query: installs and opens (evidence: `recoverpy/ui/app.py`)
- Application → Environment check: checks environment (evidence: `recoverpy/ui/app.py`)
- Partition and query → Partition list: uses (evidence: `recoverpy/ui/screens/screen_params.py`)
- Partition list → Device inventory: discovers devices (evidence: `recoverpy/ui/widgets/partition_list.py`)
- Device inventory → Partition model: creates partitions (evidence: `recoverpy/lib/storage/block_device_inventory.py`)
- User → Partition and query: selects partition and query (evidence: `README.md`)
- Application → Search screen: starts search (evidence: `recoverpy/ui/app.py`)
- Search screen → Search engine: starts and controls (evidence: `recoverpy/ui/screens/screen_search.py`)
- Search engine → Search parameters: stores query (evidence: `recoverpy/lib/search/search_engine.py`)
- Search engine → Device metadata: gets device size (evidence: `recoverpy/lib/search/search_engine.py`)
- Search engine → Binary scanner: scans for hits (evidence: `recoverpy/lib/search/search_engine.py`)
- Binary scanner → Partition or image: reads byte stream (evidence: `README.md`)
- Search engine → Block and range reader: validates hit blocks (evidence: `recoverpy/lib/search/search_engine.py`)
- Search engine → Text processing: decodes hit content (evidence: `recoverpy/lib/search/search_engine.py`)
- Search engine → Search result model: creates results (evidence: `recoverpy/lib/search/search_engine.py`)
- Search engine → Search progress: updates progress (evidence: `recoverpy/lib/search/search_engine.py`)
- Search screen → Result list: streams results to (evidence: `recoverpy/ui/screens/screen_search.py`)
- Result list → Search result model: renders (evidence: `recoverpy/ui/widgets/search_result_list.py`)
- User → Search screen: opens match (evidence: `README.md`)
- Application → Block inspection: opens selected block (evidence: `recoverpy/ui/app.py`)
- Block inspection → Block and range reader: reads adjacent blocks (evidence: `recoverpy/ui/screens/screen_result.py`)
- Block and range reader → Partition or image: reads at offsets (evidence: `recoverpy/lib/storage/byte_range_reader.py`)
- Block inspection → Text processing: formats block content (evidence: `recoverpy/ui/screens/screen_result.py`)
- Block inspection → Selected-block saver: adds selected blocks (evidence: `recoverpy/ui/screens/screen_result.py`)
- Block inspection → Save confirmation: opens save flow (evidence: `recoverpy/ui/screens/screen_result.py`)
- Save confirmation → Save path editor: opens path editor (evidence: `recoverpy/ui/screens/screen_save.py`)
- Save path editor → Save confirmation: confirms directory (evidence: `recoverpy/ui/screens/screen_save.py`)
- Save confirmation → Selected-block saver: saves selected blocks (evidence: `recoverpy/ui/screens/screen_save.py`)
- Selected-block saver → Saved output file: writes output (evidence: `recoverpy/lib/saver.py`)
