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-npk

The 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.

Enter the dojo for free I am already registered

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/npk

The 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.

Enter the dojo for free I am already registered

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);          // JsonSerializable

What 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

VersionNewsFile
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 .npk is untrusted input and a few-KB compressed part could expand to GB (zip-bomb). Over the cap → error, no memory exhaustion. No API change.

  • dojo-npk-0.1.1.zip 14.7 KB
    sha256 02a4b0066cab679bf83532d204a56c1714752be700d43f507c16e52171ab8edf
    .ots · confirmed in Bitcoin block 976,436
    🔏 GPG verification valid MikroTik Dojo signature · signed on 20 November 2026

    Key fingerprint:
    337F B37B 9464 B4A1 15F5 CDE7 5DD1 F777 F630 1B89

    dojo-npk-0.1.1.zip.asc · public key · how to verify

    gpg --verify dojo-npk-0.1.1.zip.asc dojo-npk-0.1.1.zip
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 .npk is untrusted input and a few-KB compressed part could expand to GB (zip-bomb). Over the cap → error, no memory exhaustion. No API change.

  • dojo_npk-0.1.1-py3-none-any.whl 10.7 KB
    sha256 1eb301e14c600756bc5ddaa3f5110a6405c723a465c4787750adfd1fca860cef
    .ots · confirmed in Bitcoin block 976,436
    🔏 GPG verification valid MikroTik Dojo signature · signed on 20 November 2026

    Key fingerprint:
    337F B37B 9464 B4A1 15F5 CDE7 5DD1 F777 F630 1B89

    dojo_npk-0.1.1-py3-none-any.whl.asc · public key · how to verify

    gpg --verify dojo_npk-0.1.1-py3-none-any.whl.asc dojo_npk-0.1.1-py3-none-any.whl
  • dojo_npk-0.1.1.tar.gz 16.3 KB
    sha256 f43802b33b2019c5d165cab1da09119fb185dbe7a9884bc4ddd355f4e4fd136f
    .ots · confirmed in Bitcoin block 976,436
    🔏 GPG verification valid MikroTik Dojo signature · signed on 20 November 2026

    Key fingerprint:
    337F B37B 9464 B4A1 15F5 CDE7 5DD1 F777 F630 1B89

    dojo_npk-0.1.1.tar.gz.asc · public key · how to verify

    gpg --verify dojo_npk-0.1.1.tar.gz.asc dojo_npk-0.1.1.tar.gz
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.

VersionNewsFile
0.1.0 PHP
16 November 2026

First public release (PHP). Namespace Dojo\Npk, core extensions only (json, zlib). Same behaviour as the Python variant, verified: identical JSON and byte-identical extracted images.

  • dojo-npk-0.1.0.zip 14.6 KB
    sha256 6b502f16717b02fb165eebb742b2d441f123c72aa7ec246d4af9d9b0f26cf0f6
    .ots · confirmed in Bitcoin block 976,177
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.

  • dojo_npk-0.1.0-py3-none-any.whl 10.5 KB
    sha256 1150461c44bd2b250b96a0ae466a8eacc082489fc68eef9d3546b4d651bc5b4f
    .ots · confirmed in Bitcoin block 976,177
  • dojo_npk-0.1.0.tar.gz 15.7 KB
    sha256 4ee7742c33657d369f04a7089a070b692b2490c87bba179ea35a4cc6c4b77241
    .ots · confirmed in Bitcoin block 976,177

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.

How-tos that use it