src / ferdios / admp

Open in Gitea
a046bf6 2026-09-04
src
.gitignore 48 B
admp 283 KB
LICENSE 1.1 KB
README.md 5 KB
VERSION 6 B

admp (archive-dump)

Zero dependency, standalone Python 3 script to inspect, traverse, and extract files from disk images, and archives. It simulates shell utilities like find, ls, du, xxd, cat, cp on an in-memory filesystem, supporting a wide-range of flags, useful for quickly verifying the contents of disks/archives, extracting files, and as part of a CI pipeline for verification.

Sander <code@kroket.io> - https://git.ferdios.kroket.io/ferdios/admp

Installation

Copy admp into your PATH.

sudo cp admp /usr/local/bin/admp

Support

  • iso files - ISO9660
  • img files - disk type (MBR layout) with fat, fvat, ext4 partition(s)
  • deb files - Debian package
  • apk files - Alpine v2 and v3 packages (uncompressed, deflate, zstd (Python 3.14+))
  • pck files - Godot 4 resource (unencrypted)
  • cpio files - CPIO (gzipped, non-gzipped, and u-boot style (uInitrd))
  • fpk files - Ferdi package

Examples

$ admp devuan-keyring_2025.08.09_all.deb
Archive type: DEB
Found 1 driver(s):
Archive-level driver: DebDriver

$ admp devuan-keyring_2025.08.09_all.deb ls -al
drwxr-xr-x 1 user user 4096 etc
drwxr-xr-x 1 user user 4096 usr

$ admp devuan-keyring_2025.08.09_all.deb find -type f /etc
/etc/apt/trusted.gpg.d/devuan-keyring-2016-archive.asc
/etc/apt/trusted.gpg.d/devuan-keyring-2022-archive.asc
/etc/apt/trusted.gpg.d/devuan-keyring-amprolla-2022-archive.asc
/etc/apt/trusted.gpg.d/devuan-keyring-daedalus-archive.asc
/etc/apt/trusted.gpg.d/devuan-keyring-dak-2025-archive.asc
/etc/apt/trusted.gpg.d/devuan-keyring-excalibur-archive.asc
/etc/apt/trusted.gpg.d/devuan-keyring-freia-archive.asc
/etc/apt/trusted.gpg.d/devuan-keyring-gryphon-archive.asc

$ admp chimera-linux-x86_64-LIVE-20251220-gnome.iso du -h /live/filesystem.erofs
1.5G	/live/filesystem.erofs

$ admp chimera-linux-x86_64-LIVE-20251220-gnome.iso du -ch /
508.0K	/EFI/BOOT
508.0K	/EFI
817.0	/boot/grub
817.0	/boot
1.7G	/live
1.7G	/
1.7G	total

$ admp godot4_assets.pck xxd /icon.svg | head -n 10
00000000: 3c 73 76 67 20 78 6d 6c 6e 73 3d 22 68 74 74 70  <svg xmlns="http
00000010: 3a 2f 2f 77 77 77 2e 77 33 2e 6f 72 67 2f 32 30  ://www.w3.org/20
00000020: 30 30 2f 73 76 67 22 20 77 69 64 74 68 3d 22 31  00/svg" width="1
00000030: 32 38 22 20 68 65 69 67 68 74 3d 22 31 32 38 22  28" height="128"
00000040: 3e 3c 72 65 63 74 20 77 69 64 74 68 3d 22 31 32  ><rect width="12
00000050: 34 22 20 68 65 69 67 68 74 3d 22 31 32 34 22 20  4" height="124" 
00000060: 78 3d 22 32 22 20 79 3d 22 32 22 20 66 69 6c 6c  x="2" y="2" fill
00000070: 3d 22 23 33 36 33 64 35 32 22 20 73 74 72 6f 6b  ="#363d52" strok
00000080: 65 3d 22 23 32 31 32 35 33 32 22 20 73 74 72 6f  e="#212532" stro
00000090: 6b 65 2d 77 69 64 74 68 3d 22 34 22 20 72 78 3d  ke-width="4" rx=

$ admp -p1 maemo-leste-excalibur-droid4-20260305.img cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin

$ admp /boot/uInitrd cp -r /etc /tmp/armbian_initrd/etc
/tmp/armbian_initrd/etc/console-setup/Uni2-Fixed16.psf.gz
/tmp/armbian_initrd/etc/console-setup/cached_UTF-8_del.kmap.gz
/tmp/armbian_initrd/etc/default/console-setup
/tmp/armbian_initrd/etc/dhcpcd.conf
/tmp/armbian_initrd/etc/default/keyboard
/tmp/armbian_initrd/etc/fonts/conf.d/60-latin.conf
/tmp/armbian_initrd/etc/fonts/fonts.conf
/tmp/armbian_initrd/etc/ld.so.cache

$ admp test2.img 
Archive type: DISK_MBR
Found 2 driver(s):
  Partition 0: type=EXT4 (start=8192 sectors / 4.0M, size=253952 sectors / 124.0M), driver=Ext4Driver
  Partition 1: type=EXT4 (start=262144 sectors / 128.0M, size=9503481 sectors / 4.5G), driver=Ext4Driver

Features

  • Tries to prevent loading the whole disk/archive into memory*
  • Multithreaded file/directory extraction*
  • Symlinks are supported, and file permissions (modes) are kept*
  • Follows NO_COLOR env. variable for colored output

* if the driver supports this

Compilation

From the root of the source repository:

cd src
python3 make_dist.py > admp
mv admp /usr/local/bin/

Creating a new driver

Drivers go into src/nd/drivers/<name>/__init__.py and should inherit from Driver (src/nd/drivers/__init__.py).

Look at what methods Driver defines - you can choose to override them.

Whilst in development, you can use src/cli.py as entry point.

TODO

  • autocomplete paths for zsh shells
  • rpm driver
  • ext2 driver

Credits