Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

102.11. sleuthkit-4.15.0

Filesystem forensics tools that read disk images directly

Version 4.15.0, release 1
Shelf security — Security applications: GnuPG and front-ends, password and secret managers, certificates, scanners, forensics and audit
Phase 41_system (System), 935 of 1047 in build order
Licence IPL-1.0 AND CPL-1.0 AND GPL-2.0-or-later
Homepage https://www.sleuthkit.org/
Build time 1.1 SBU
Installed size 2.6 MiB in 139 files
Recipe ports/core/security/sleuthkit/kpkgbuild

About

The Sleuth Kit is a library and a set of command-line tools for file-system forensics: mmls lists the partitions in a disk image, fls lists the files of a file system, including deleted ones, icat copies a file out by its metadata address, and tsk_recover, sigfind, fiwalk and the rest build on the same library. It never asks the kernel to mount anything. It reads the metadata straight out of the image, so a file system too damaged for mount to accept still gives up its files; testdisk, by contrast, repairs a partition table so that the kernel can mount it.

Images are opened through the image-format libraries the tree carries: raw and split raw images and devices directly, E01 through libewf, AFF through afflib, VHD and VHDX through libvhdi, VMDK through libvmdk, and an LVM volume group inside an image through libvslvm and libbfio.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/security.txt:

testdisk repairs a partition table so the kernel will mount the thing; this never asks the kernel at all and walks the metadata out of the image.

Sources

Dependencies

Depends on: autoconf, automake, libtool, pkgconf, zlib, sqlite, perl, libewf, afflib, libbfio, libvhdi, libvmdk, libvslvm.

Required by: no port names it.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install sleuthkit'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/security/sleuthkit.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/security/sleuthkit
echo '3a8c1e7d18a9b81f3e5e8aa78313974aceaafc6e051d636bc92cd7168286eca9  sleuthkit-4.15.0.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/sleuthkit
SRC=$SRC_ROOT/sleuthkit-4.15.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf sleuthkit-4.15.0.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

export CFLAGS="$CFLAGS -Wno-error"
export CXXFLAGS="$CXXFLAGS -Wno-error"

patch -p1 -i "$PORT_SRC/lvm-header.patch"

autoreconf -f -i

export CPPFLAGS="$CPPFLAGS -Dlibewf_handle_read_random=libewf_handle_read_buffer_at_offset"

./configure \
	--prefix=/usr \
	--libdir=/usr/lib \
	--disable-static \
	--disable-java \
	--disable-cppunit \
	--with-afflib \
	--with-libbfio \
	--with-libvhdi \
	--with-libvmdk \
	--with-libvslvm \
	--with-libewf \
	--with-zlib

for def in HAVE_LIBEWF HAVE_LIBAFFLIB HAVE_LIBBFIO HAVE_LIBVHDI HAVE_LIBVMDK \
	HAVE_LIBVSLVM HAVE_LIBZ HAVE_LIBSQLITE3; do
	grep -q "^#define $def 1" tsk/tsk_config.h || {
		echo "sleuthkit: $def not set by configure" >&2
		exit 1
	}
done

make LDFLAGS="$LDFLAGS" sigfind_LDFLAGS=
make DESTDIR=$PKG LDFLAGS="$LDFLAGS" sigfind_LDFLAGS= install
find "$PKG" -type f | while read -r f; do
	if readelf -d "$f" 2>/dev/null | grep -q /var/cache; then
		echo "sleuthkit: $f has an RPATH into the build tree" >&2
		exit 1
	fi
done

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/sleuthkit, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf sleuthkit-4.15.0-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/sleuthkit, and runs the triggers its paths call for.

Contents

Installed programs: blkcalc, blkcat, blkls, blkstat, fcat, ffind, fiwalk, fls, fsstat, hfind, icat, ifind, ils, img_cat, img_stat, istat, jcat, jls, jpeg_extract, mactime, mmcat, mmls, mmstat, pstat, sigfind, sorter, srch_strings, tsk_comparedir, tsk_gettimes, tsk_imageinfo, tsk_loaddb, tsk_recover, usnjls.

Installed libraries: libtsk.so.

Installed directories: /usr/include/tsk, /usr/share/licenses/sleuthkit, /usr/share/tsk.

Short descriptions

blkcalc Converts between unallocated disk unit numbers and regular disk unit numbers.
blkcat Display the contents of file system data unit in a disk image.
blkls List or output file system data units.
blkstat Display details of a file system data unit (i.e. block or sector)
fcat Output the contents of a file based on its name.
ffind Finds the name of the file or directory using a given inode
fls List file and directory names in a disk image.
fsstat Display general details of a file system
hfind Lookup a hash value in a hash database
icat Output the contents of a file based on its inode number.
ifind Find the meta-data structure that has allocated a given disk unit or file name.
ils List inode information
img_cat Output contents of an image file.
img_stat Display details of an image file
istat Display details of a meta-data structure (i.e. inode)
jcat Show the contents of a block in the file system journal.
jls List the contents of a file system journal
mactime Create an ASCII time line of file activity
mmcat Output the contents of a partition to stdout
mmls Display the partition layout of a volume system (partition tables)
mmstat Display details about the volume system (partition tables)
sigfind Find a binary signature in a file
sorter Sort files in an image into categories based on file type
tsk_comparedir compare the contents of a directory with the contents of an image or local device.
tsk_gettimes Collect MAC times from a disk image into a body file.
tsk_loaddb populate a SQLite database with metadata from a disk image
tsk_recover Export files from an image into a local directory
usnjls List the contents of a NTFS Update Sequence Number journal
tsk.pc An open source forensic toolkit

Notes

autoreconf -f -i regenerates configure and every Makefile.in with the tree’s autotools before configure runs.

The loop after configure reads tsk/tsk_config.h and stops the build unless each of HAVE_LIBEWF, HAVE_LIBAFFLIB, HAVE_LIBBFIO, HAVE_LIBVHDI, HAVE_LIBVMDK, HAVE_LIBVSLVM, HAVE_LIBZ and HAVE_LIBSQLITE3 is defined. sqlite has no switch at all: without a system sqlite configure compiles the copy sleuthkit bundles (tsk/auto/sqlite3.c), and the check holds it to the port.

The last loop runs readelf -d over every installed file and fails the build if any names a directory under /var/cache, the build tree, which the package lint also refuses (see What the package lint refuses).