Deep-Recovery is a digital forensics and data recovery project designed to retrieve deleted files directly from raw disk images. This tool demonstrates advanced sector-level file carving alongside filesystem-specific metadata recovery techniques.
To recover deleted, corrupted, or lost files from disk images formatted with different file systems (XFS, BTRFS) without relying heavily on the operating system's native mounting utilities.
The recovery engine consists of three distinct modules that work together to maximize data extraction:
A highly professional, sector-by-sector file carver designed for scenarios where filesystem metadata is destroyed or overwritten.
- Signature Recognition: Precisely searches for
PDF,PNG,JPG, andWebP(via RIFF chunks) by matching file headers and footers. - Intelligent Scanning: Predicts and extracts files based on theoretical boundaries and utilizes robust overlapping sliding windows to defeat cross-sector fragmentation.
- MIME-Type Fallback: Features a built-in
python-magicdetection mechanism to identify unsupported file types. - Forensic Verification: Automatically verifies retrieved images using
Pillowand generates an organizedcarving_report.csvfor forensic mapping.
A specialized module that targets the internal structures of the Btrfs filesystem.
- Superblock & Inode Parsing: Accurately maps files and directories directly from the Btrfs root tree.
- Journal & Extent Analysis: Discovers orphan inodes and deleted generation changes to find historical data that still resides on the disk.
- Includes disk_reader.py for rapid, shallow block scanning visualization and immediate file type detection within random chunks.
Two virtual disk images were created locally for rigorous testing:
disk_btrfs.imgdisk_xfs.img(Note: These images are not uploaded to GitHub because they exceed the standard 100MB file limit).
- Python 3.8+
- libmagic: Required for file type identification.
- Dependencies: Install via
pip install -r requirements.txt.
To ensure the accuracy of the recovery engine, a controlled forensic environment was created using standard Linux utilities.
dd: For allocating raw, zero-filled disk images.mkfs.btrfs/mkfs.xfs: For partitioning and formatting the virtual drives.mount/umount: For simulating real-world file system usage.shasum: For generating cryptographic hashes to verify data integrity.
- Infrastructure: Created 256MB raw disk images (
.img). - Environment: Formatted images with the Btrfs and XFS filesystems.
- Data Population: Wrote test files (PDFs, JPEGs, PNGs) to the mounted drives.
- Deletion Simulation: Deleted specific files and unmounted the drives to simulate data loss.
- Recovery Phase: Ran Deep-Recovery modules to carve the raw sectors and parse the metadata to retrieve the deleted items.
- Validation: Compared the recovered hashes against original file hashes.
Scan a disk image for common file types and save them to an output folder:
python -m src.carver.engine <disk_image> <output_folder>Analyze Btrfs metadata to recover files with their original names and structures:
python -m src.metadata_recovery.recover <disk_image> [output_dir]