- Language
- 🐍 Python
- Package
dojo-npk·import dojo.npk- Latest version
- 0.1.1 · 18 November 2026
- Requires
- Python ≥ 3.9
- Dependencies
- none
- License
- MIT
- Language
- 🐘 PHP
- Package
dojo/npk·Dojo\Npk- Latest version
- 0.1.1 · 18 November 2026
- Requires
- PHP ≥ 8.1
- Dependencies
ext-json *,ext-zlib *- License
- MIT
Works with: Python 3.9+, zero dependencies (stdlib only). PHP variant >= 8.1 with ext-json and ext-zlib (core).
Independent MikroTik Dojo project library: it is not MikroTik software nor is it approved by MikroTik. Test it in a lab first.
Installation and usage
Installation (Python)
pip install --index-url https://mikrotikdojo.com/en/pypi/<your-address>/simple/ dojo-npkThe library is installed with pip from the dojo index, using a personal URL reserved for dojo members. Joining is free: you only need your email.
Usage example (Python)
from dojo.npk import Npk
n = Npk.load("routeros-x86-7.24.5.npk")
print(n.info()) # versione, architettura, canale, digest...
print(n.verify_all()) # integrita' di ogni pacchetto
for f in n.boot_files(): # kernel, bootloader, initrd...
print(f["name"], f["size"])
n.extract_squashfs("routeros.img") # pronta per unsquashfs
n.extract_boot_file("boot/kernel", "kernel.bin")Installation (PHP)
composer config repositories.dojo composer https://mikrotikdojo.com/en/composer/<your-address>/
composer require dojo/npkThe library is installed with Composer from the dojo repository, using a personal URL reserved for dojo members. Joining is free: you only need your email.
Usage example (PHP)
use Dojo\Npk\Npk;
$n = Npk::load('routeros-x86-7.24.5.npk');
print_r($n->info()); // versione, architettura, canale, digest...
print_r($n->verifyAll()); // integrita' di ogni pacchetto
foreach ($n->bootFiles() as $f) { // kernel, bootloader, initrd...
echo $f['name'], ' ', $f['size'], "\n";
}
$n->extractSquashfs('routeros.img'); // pronta per unsquashfs
$n->extractBootFile('boot/kernel', 'kernel.bin');
echo json_encode($n, JSON_PRETTY_PRINT); // JsonSerializableWhat it does
dojo.npk opens RouterOS .npk files and tells you what is inside, without mounting anything and without trusting the file name: package name and version, architecture, channel, build git commit, dependencies, and the SHA1 digest verification that the router itself checks at install time.
The format is a container of parts [u16 id][u32 len][payload] with magic 0xBAD0F11E. The library walks all of it: a v7 file holds one package, a v6 routeros-<arch> bundle holds a header plus N sub-packages (system, ipv6, wireless, hotspot…), each with its own signature. For each one you can:
1. read the metadata (version decoded from the 4 raw bytes, e.g. 7.24.5 and 7.26beta5, build timestamp, description, dependencies);
2. verify integrity: the SHA1 digest is recomputed over the header and data of every part, from the info part up to the signature header, and compared with the stored one — a single tampered byte is detected;
3. list and extract the boot files from the internal zlib archive (kernel, BOOTX64.EFI, initrd.rgz, milo.conf…), with Unix mode and size;
4. extract the valid squashfs image (real size from the superblock, without the part padding), ready for unsquashfs or mount -o loop,ro.
The format, the digest rule and the boot archive are lab-verified on real firmware: v7 x86 7.18.2 / 7.24.5 / 7.26beta5, v7 arm64 7.26beta5 and v6 x86 6.49.17 (11 sub-packages, 11 recomputed digests, 11 matches). Extracted images were listed with unsquashfs; extracted kernels are valid ELF files. Python and PHP produce the same JSON and byte-identical images.
Honesty first: the digest verifies integrity, not authenticity — the KCDSA/EdDSA signatures cannot be verified without MikroTik’s public keys. A file with a matching digest is not thereby authentic.
Versions
| Version | News | File |
|---|---|---|
| 0.1.1 PHP latest 18 November 2026 | 0.1.1 — security fix. Boot-archive (part 0x04) decompression now has a 256 MiB cap: a |
|
| 0.1.1 Python latest 18 November 2026 | 0.1.1 — security fix. Boot-archive (part 0x04) decompression now has a 256 MiB cap: a |
|
Previous versions (2, superseded)
They remain downloadable, with their fingerprint and OpenTimestamps proof, for anyone who pinned a version in their project. Use the latest: GPG signatures are only on the current versions.
| Version | News | File |
|---|---|---|
| 0.1.0 PHP 16 November 2026 | First public release (PHP). Namespace |
|
| 0.1.0 Python 16 November 2026 | First public release (Python). NPK format, SHA1 digest rule and boot archive lab-verified on real v6 and v7 firmware. KCDSA/EdDSA signature verification (authenticity) is not included: integrity only. |
Each file has its SHA-256 fingerprint (pip and Composer check it automatically) and an OpenTimestamps proof registered on Bitcoin: anyone can verify that the file is the one published on that date. Signed files also carry the MikroTik Dojo GPG signature: it says who published them, OpenTimestamps says when. Key and instructions → Files are downloaded only if you are in the dojo.