Skip to main content

Forensically-sound disk-image ingest on The Sleuth Kit (Python/Linux CLI).

Project description

PyAutopsy

Forensically-sound disk-image ingest and analysis on The Sleuth Kit — a read-only Python/Linux CLI that turns a raw (dd) or E01/EWF disk image into a defensible case directory: integrity hashes, a filesystem inventory (including deleted entries), deleted-file recovery, a merged MACB + system-log super-timeline, content/IOC search, and byte-deterministic HTML + JSON reports.

Forensic soundness is non-negotiable. Evidence is opened read-only at the byte layer via The Sleuth Kit — it is never mounted and never modified. All output goes to a separate case directory, and the source hash is re-verified at the end of every run.

Installation

The Python bindings wrap native C libraries. pytsk3 ships binary wheels that bundle libtsk, so a raw/dd-only install usually needs no system packages. The optional E01/EWF support (libewf-python) is sdist-only and must compile against libewf-dev, so it requires the native development headers below.

Native system dependencies (only needed for the [ewf] extra):

# Fedora / RHEL
sudo dnf install -y sleuthkit sleuthkit-devel libewf libewf-devel \
    gcc gcc-c++ python3-devel

# Debian / Ubuntu / Kali
sudo apt install -y libtsk-dev libewf-dev build-essential python3-dev

Python package (requires Python >= 3.11):

# Core (raw/dd images only — light install, no system libewf required)
pip install pyautopsy

# With E01/EWF support (requires the native libewf-dev headers above)
pip install "pyautopsy[ewf]"

# Development (tests, linting, type checking)
pip install -e ".[dev]"

If the host lacks libewf-dev, the core (raw/dd) install still works; only the [ewf] extra needs the native library.

Quick start

# One command: ingest → walk → timeline → report.
pyautopsy analyze evidence.dd \
    --case ./case --examiner "Your Name" --evidence-id E1

# Outputs land under the case directory:
#   case/reports/report.html   (human-readable, byte-deterministic)
#   case/reports/report.json   (structured/exportable, byte-deterministic)
ls ./case/reports/

analyze requires a fresh case directory — a pre-existing case.db fails loudly so a prior case is never silently overwritten.

Usage

PyAutopsy exposes one all-in-one command (analyze) plus the individual stages it composes, so you can run the full pipeline or drive each step against an existing case.

Command What it does
analyze Full single-command pipeline: read-only ingest → filesystem walk → MACB timeline → HTML + JSON report. Recovery, known-file filtering, log parsing, and search are opt-in flags.
ingest Open the image read-only, hash it (MD5 + SHA-256), record the chain of custody, write the audit log, and re-verify the source hash at end of run. Creates the case directory.
walk Inventory every volume's filesystem into normalized per-file rows — including deleted entries, with allocated/unallocated status and inode/MFT addressing.
recover Recover deleted/orphan file content into a confined recovered/ tree with an honest intact-vs-partial confidence tier. The evidence source is never written.
logs Parse the image's auth.log/secure (incl. rotated .gz members) into the shared super-timeline, time-resolved to UTC with the inferred year flagged per event.
search Search allocated content, unallocated space, and file hashes for literal/regex terms or IOC lists, reporting hits by file and absolute byte offset.

Full analysis with recovery, known-file filtering, logs, and a search term:

pyautopsy analyze evidence.E01 \
    --case ./case --examiner "Your Name" --evidence-id E1 \
    --recover \
    --nsrl /path/to/nsrl-rds.sqlite \
    --logs \
    --search "password"

Drive individual stages against an existing case (created by ingest):

pyautopsy ingest evidence.dd --case ./case --examiner "Your Name" --evidence-id E1
pyautopsy walk    evidence.dd --case ./case
pyautopsy recover evidence.dd --case ./case
pyautopsy search  evidence.dd --case ./case --term "secret" --regex

Every command opens the source read-only, records each operation in an append-only audit log, and exits non-zero on any integrity or read-only-boundary failure after recording a FAIL audit event. Run pyautopsy --help (or pyautopsy <command> --help) for the complete option set.

Case directory layout

A case directory is self-contained and separate from the evidence:

case/
├── case.db                  # SQLite case store (chain of custody, inventory, timeline)
├── logs/
│   └── audit.jsonl          # append-only audit log
├── exports/                 # exported artifacts
├── recovered/               # recovered deleted/orphan file content (recover/--recover)
└── reports/
    ├── report.html          # byte-deterministic human-readable report
    ├── report.json          # byte-deterministic structured/exportable report
    └── run_metadata.json     # volatile sidecar (timestamps, host, durations)

report.html and report.json are whole-file byte-deterministic across runs; all volatile run metadata is isolated in the run_metadata.json sidecar so reports remain reproducible and hashable.

Container

A Containerfile is provided that bakes sleuthkit + libewf and installs the package with the [ewf] extra, so both raw and E01 ingest work out of the box. It runs as a non-root user and expects evidence mounted read-only:

podman build -t pyautopsy -f Containerfile .
# or: docker build -t pyautopsy -f Containerfile .

podman run --rm -v "$PWD:/data:ro,Z" pyautopsy \
    pyautopsy ingest /data/evidence.dd --case /data/case --examiner you --evidence-id E1

Development

pip install -e ".[dev]"
pytest -q              # run the test suite (src layout via pythonpath=["src"])
ruff check src tests   # lint + import sort
mypy src               # static type checking

License

PyAutopsy is released under the MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyautopsy-0.1.0.tar.gz (145.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyautopsy-0.1.0-py3-none-any.whl (177.3 kB view details)

Uploaded Python 3

File details

Details for the file pyautopsy-0.1.0.tar.gz.

File metadata

  • Download URL: pyautopsy-0.1.0.tar.gz
  • Upload date:
  • Size: 145.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyautopsy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0ca92f124f3f3dd3d5d53ce9a73a64790673be926f0fd1817eee9d12d9b81eb1
MD5 825f7c83bff1155ff5d68a04db834a0e
BLAKE2b-256 059f2cfe329713eeee8f6f4913d5adb642cd388b7a0b66a580ce97aa07b6568a

See more details on using hashes here.

File details

Details for the file pyautopsy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyautopsy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 177.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyautopsy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87e1d7e9164f284a5a40691d13ba09b5dfbb3440f4c19a4cb4d44d87a78cb6f4
MD5 d14838e2f7510afc511a82ce9624e774
BLAKE2b-256 0b4349162bca7d3c022e810b0f63bfd9ba2c642a9b5f2e17603f329af7a40468

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page