tpt-usb-rescue

Rust

Forensic data recovery engine in Rust for degraded or corrupted USB drives: read-only imaging with a resumable mapfile, file carving for 20 types, and FAT32/exFAT/NTFS parsing. Pre-alpha.

0 stars0 forks0 watchers1 open issuesApache License 2.0
data-recoverydisk-imagingfile-carvingforensicsrustusb

Languages

Rust98.4%Shell1.6%
README

tpt-usb-rescue

CI License: MIT OR Apache-2.0

Forensic data recovery engine (Rust) for degraded or corrupted USB mass storage.

Status: release candidate 0.1.0-rc.1 (not yet tagged). The imaging, carving and filesystem code is tested on synthetic data and on real Linux block devices (loop and device-mapper). The Windows, macOS and real-USB-stick paths are compiled but not yet tested on hardware. Testers should read docs/release/TESTING.md for what has and has not been checked, and what to try. See also spec.txt and TODO.md.

  1. Image: read-only, direct I/O, three passes, resumable via a crash-safe mapfile.
  2. Carve / parse: zero-copy signature carving (20 file types, including PNG, JPEG, PDF, ZIP/DOCX, MP4, 7z and SQLite) with structural validation, and FAT32 / exFAT / NTFS parsing that works without a partition table.

Install

Release candidates are published as pre-releases on the GitHub Releases page once v0.1.0-rc.1 is tagged. Each release has archives for Windows (CLI and GUI), Linux and macOS, plus a SHA256SUMS file: check the archive against it, then unpack it. Or build from source:

cargo install --locked --git https://github.com/tpt-solutions/tpt-usb-rescue tpt-usb-rescue
# after a release exists, this fetches the prebuilt binary instead of compiling:
cargo binstall tpt-usb-rescue

Reading a raw disk needs administrator rights on Windows and root on Linux and macOS. Shell completions and man pages: tpt-usb-rescue completions <shell>, tpt-usb-rescue man --out-dir <dir> (see Usage).

Usage

# List devices (physical drives usually need administrator or root)
tpt-usb-rescue list-devices

# Image a device or file. Progress is saved in recovery.img.map; Ctrl-C stops cleanly
tpt-usb-rescue image /dev/sdb recovery.img
tpt-usb-rescue image /dev/sdb recovery.img --resume
tpt-usb-rescue image /dev/sdb recovery.img --hash   # also writes recovery.img.sha256

# Inspect or export the map
tpt-usb-rescue mapfile recovery.img.map
tpt-usb-rescue mapfile recovery.img.map --export ddrescue --out recovery.ddr

# Partition table, volumes and files; optionally extract them
tpt-usb-rescue analyze recovery.img --extract ./volumes

# Carve files, rejecting structurally invalid candidates, then verify them
tpt-usb-rescue carve recovery.img ./carved --validate-media
tpt-usb-rescue verify ./carved recovery.img

Exit codes: 0 success, 3 stopped with progress saved (resume with --resume), 4 verification failed, 5 finished with unrecoverable sectors. See Usage.

Safety: the imager opens sources read-only. It refuses an output path that is a device node or lives on the source disk, and refuses the system disk unless --allow-system-disk is given.

GUI (Windows)

tpt-usb-rescue-gui.exe is a plain Win32 window with no third-party GUI dependencies. It runs the same operations as the CLI through a four-step guide: choose the source, choose the output, copy the disk, then find files. Physical drives need a window started as Administrator. See Usage and the GUI crate.

Workspace

CratePurpose
tpt-usb-rescue-halRaw read-only device access (Linux, Windows, macOS)
tpt-usb-rescue-imagerMulti-pass imager + mapfile
tpt-usb-rescue-carverSignature carver + validation + verification
tpt-usb-rescue-fsFAT32, exFAT and NTFS parsers, volume detection
tpt-usb-rescueCLI
tpt-usb-rescue-guiWindows GUI

Each crate has its own README and CHANGELOG under crates/.

Documentation

  • Usage: imaging, resume, carving, analysis, verification, exit codes and the GUI
  • Recovery playbook: the order of work for a failing drive, and when to stop and call a lab
  • Troubleshooting: common errors, slow drives, what the exit codes mean
  • Examples: practice image, one-command recovery scripts (bash and PowerShell), chain-of-custody form
  • Architecture: crates, mapfile format, carving and filesystem design, safety model
  • Supported formats: the 20 carved types and the filesystems read
  • Testing guide: what is verified, what is not, and what testers should try
  • Release process: how a version gets from master to a GitHub Release
  • Release notes draft for 1.0.0 (not published)
  • CHANGELOG: all user-visible changes

Contributing

Contributions are handled through GitHub issues only; pull requests are not accepted. See CONTRIBUTING.md.

License

Licensed under either of Apache-2.0 or MIT at your option. Copyright (c) 2026 TPT Solutions. Unless you state otherwise, contributions are dual-licensed as above.