MCPcopy Index your code
hub / github.com/PabloLec/RecoverPy

github.com/PabloLec/RecoverPy @2.3.0 sqlite

repository ↗ · DeepWiki ↗ · release 2.3.0 ↗
290 symbols 1,066 edges 56 files 2 documented · 1%
README

RecoverPy

RecoverPy

Scan raw partitions and recover data by inspecting disk blocks directly.

GitHub release License Downloads Tests


🎬 Demo

RecoverPy Demo

🔎 Overview

When a file is deleted, its metadata disappears first. The underlying disk blocks often remain intact until they are reused.

RecoverPy scans raw partition data directly and searches for byte patterns across the entire device. If the blocks have not been overwritten, fragments of deleted files can still be located by their content.

It lets you inspect matching blocks, navigate adjacent ones, and extract what remains in a straightforward way.

If the blocks are gone, recovery is impossible. If they are still there, RecoverPy helps you retrieve them.


🧭 What you can do

  • Search a partition or disk image for a specific string.
  • Inspect the disk blocks where matches are found.
  • Move across adjacent blocks to recover fragmented data.
  • Select and save useful content.

RecoverPy does not attempt to interpret filesystem structures or restore filenames. It focuses on exposing what remains on disk and making it accessible.


📦 Installation

Requirements

  • Linux
  • Python 3.9+

Accessing raw block devices typically requires sudo.

Using uv

sudo uvx recoverpy
````

Or install locally:

```bash
uv tool install recoverpy
sudo recoverpy

Using pip

python -m pip install recoverpy
sudo recoverpy

▶️ Usage

Start RecoverPy:

sudo recoverpy
  1. Select a partition.
  2. Enter a distinctive search string.
  3. Start the scan.
  4. Open a result.
  5. Inspect and navigate blocks.
  6. Save useful content.

Using a unique identifier, configuration key, or sentence fragment generally produces better results than common words.


⚙️ How it works

RecoverPy operates directly on the raw byte stream of a block device.

The selected partition is opened in read-only mode and scanned sequentially using fixed-size chunks. The scanner processes the stream incrementally, keeping a small overlap between chunks to ensure that matches spanning chunk boundaries are not missed.

Pattern matching is performed at the byte level. For every match, RecoverPy records the exact absolute offset within the device. This offset becomes the reference point for block inspection and navigation.

Block reads are performed using explicit offsets rather than relying on filesystem abstractions. This allows precise access to adjacent blocks without loading large portions of the device into memory.

The entire scan is streaming-based and memory-bounded: RecoverPy never loads the full partition into memory.


⚠️ Limitations

RecoverPy works on raw data. It does not reconstruct files automatically or infer file boundaries.

Results may be partial or fragmented. If the underlying blocks have already been overwritten, recovery is not possible.

Accessing block devices typically requires sudo. To reduce the risk of further overwriting, avoid writing to the target partition during recovery and unmount it when possible.


🤝 Contributing

If you run into a bug or think something could be improved, feel free to open an issue. And if you’d like to work on it yourself, pull requests are always appreciated.


🛠 Development

Project structure:

  • recoverpy/ui/ — Textual interface
  • recoverpy/lib/search/ — streaming search engine
  • recoverpy/lib/storage/ — block and device access
  • recoverpy/lib/text/ — decoding utilities
  • tests/ — unit and integration tests

Setup

uv sync --dev

Run locally

sudo uv run recoverpy

Run tests

uv run pytest -q

Core symbols most depended-on inside this repo

add_result
called by 14
recoverpy/lib/saver.py
assert_with_timeout
called by 9
tests/integration/helper.py
iter_scan_hits
called by 5
recoverpy/lib/search/binary_scanner.py
extract_range
called by 5
recoverpy/lib/storage/byte_range_reader.py
get_device_info
called by 5
recoverpy/lib/storage/block_device_metadata.py
set
called by 5
recoverpy/ui/screens/screen_result.py
install_and_push_modal
called by 5
recoverpy/ui/screens/modal.py
get_blocks_to_save_count
called by 4
recoverpy/lib/saver.py

Shape

Method 136
Function 124
Class 30

Languages

Python100%

Modules by API surface

recoverpy/ui/screens/screen_search.py23 symbols
recoverpy/ui/screens/screen_result.py19 symbols
recoverpy/ui/screens/screen_save.py17 symbols
recoverpy/lib/search/search_engine.py17 symbols
recoverpy/ui/screens/screen_path_edit.py13 symbols
recoverpy/ui/screens/screen_params.py12 symbols
recoverpy/ui/app.py11 symbols
recoverpy/lib/search/binary_scanner.py11 symbols
tests/unit/test_search_engine.py10 symbols
tests/conftest.py10 symbols
recoverpy/lib/storage/byte_range_reader.py10 symbols
recoverpy/lib/storage/block_device_metadata.py10 symbols

Dependencies from manifests, versioned

textual7.5.0 · 1×

For agents

$ claude mcp add RecoverPy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact