ewf-image
Read, verify, and write Expert Witness Format (EWF) forensic images in pure Rust.

ewf-image opens EnCase-style .E01, .L01, .S01, .Ex01, and .Lx01
images and exposes their decoded media as ordinary Rust readers. The library
forbids unsafe code and runs without libewf or any other external tool.
- Read physical, logical, and SMART images, including split segment sets.
- Verify decoded media against stored and independently recorded MD5, SHA1, and SHA256 digests.
- Browse logical file catalogs, then verify and extract individual files.
- Write EWF1 and EWF2 images, with resumable E01 acquisition and bounded streaming writers.
- Analyze damaged images and recover readable data with a provenance map.
The examples below target version 0.5.0. See the changelog for its changes and the migration guide for upgrades from 0.4.
This workspace also includes the experimental
aff4-image
crate for reading, verifying, and writing supported AFF4 containers, plus
ewf-cli for EWF, AFF4, and raw images.
Installation
[]
= "0.5"
The crate requires Rust 1.96 or later. Its runtime features are:
| Feature | Effect |
|---|---|
verify |
Media verification, per-file verification, and integrity analysis. Enabled by default. |
parallel |
Verification across multiple worker threads. Enables verify. |
serde |
Serialization of reports and metadata types. |
Stored-hash parsing, section integrity checks, and writer hashing remain available
with default-features = false.
Read an image
Open the first segment. The remaining segments are found automatically.
use Read;
Image is a cheap, shareable handle. Clones and cursors share bounded caches,
so one image can serve many readers. OpenOptions adjusts cache sizes, handle
limits, and strictness. Segment files must remain unchanged while an image is open.
Verify an image
verify decodes the complete media and compares it with the digests stored in
the image. Verification bypasses caches, so corrupt data cannot pass as valid.
use ;
A match value of None means the image stores no digest of that type. A match
shows that the decoded media equals what was hashed at acquisition. It cannot
show whether unreadable source sectors were replaced with zeros at that time. See
verification, analysis, and recovery.
Work with logical files
Logical images (.L01 and .Lx01) contain a catalog of files and folders.
use ;
use ;
Extraction copies file content only. Timestamps and other recorded metadata
remain available on each catalog entry but are not applied to extracted files.
The ewf-cli extract --restore-times option applies recorded file access and
modification times to a selected new output file.
Write an image
EwfWriter creates EWF1 or EWF2 images from any readable source.
use ;
use ;
EwfWriter supports every output format and positioned writes, but it spools
the complete source to temporary storage. Specialized writers cover large or
long-running jobs:
AcquisitionWriteracquires physical E01 images with checkpoints and can resume after an interruption.SequentialWriterstreams known-length E01, Ex01, and Lx01 output and stages one segment at a time. The CLI uses it for E01 conversion.LogicalWriterbuilds L01 and Lx01 file catalogs from files you supply.
Writers return computed MD5, SHA1, and SHA256 digests but do not reread their output. Acquisition and writing explains resume, publication, and recovery for each writer.
Supported formats
| Format | Read | Write |
|---|---|---|
EWF1 physical .E01 |
Raw and zlib; X-Ways Zstandard; X-Ways AES-128/AES-256 encryption | Raw and zlib |
EWF1 logical .L01 |
Media and file catalog | Media and file catalog |
EWF1 SMART .S01 |
Media | Media |
EWF2 physical .Ex01 |
Raw, zlib, BZip2, and pattern-fill | Raw, zlib, BZip2, and pattern-fill |
EWF2 logical .Lx01 |
Media and file catalog | Media and file catalog |
Encrypted X-Ways images open with Image::open_with_password. Encrypted EWF2
images, encrypted output, and delta (overlay) images are not supported.
Compatibility describes tested producers and consumers,
and limitations lists unsupported workflows.
For supported AFF4 profiles and limitations, see
aff4-image.
ewf-image has no AFF4 dependencies.
Command-line tool
The workspace includes ewf-cli, an unpublished command-line tool for EWF, AFF4,
and raw images. Build it from this repository:
ewf-cli info case.E01
ewf-cli verify case.E01
ewf-cli acquire /dev/sdb case.E01
ewf-cli convert case.E01 case.aff4
ewf-cli collect evidence-folder files.Lx01
ewf-cli extract files.Lx01 2 recovered.bin
The output file extension selects the format. Commands never overwrite existing files. Acquisition requires a stable source, and directory collection does not create a filesystem snapshot. See the CLI guide for device acquisition, conversion, JSON output, and exit codes, and the EWF command guide for advanced acquisition and recovery options.
Documentation
- API reference and runnable examples
- Verification, analysis, and recovery
- Acquisition and writing
- CLI guide and EWF command guide
- Compatibility and limitations
- Architecture
- Testing
- Release process
- Upgrading: 0.5 guide, 0.4 release notes, 0.3 guide, 0.2 guide
Contributing and security
Read Contributing before opening a pull request. Report vulnerabilities privately as described in the security policy.
License
Licensed under the Apache License 2.0.