Skip to content

jakka351/Python-KZB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Python-KZB — Python Unpacker/Repacker for .kzb / .kzbf Archives

Python-KZB is a Python utility that extracts and rebuilds KZB/KZBF archives found inside embedded firmware blobs (QNX images, bitmaps.bin, cluster assets, etc.). It handles the full pipeline: parse headers, walk the file table, decompress payloads, fix alignment/padding, and reassemble a byte-perfect archive on the way back. It’s built to be loud about errors and to produce valid outputs that actually boot/display, not just “some bytes on disk”.


Features

  • Unpack: Validates magic, sizes, and alignment; extracts entries with correct filenames, offsets, and lengths. Supports zlib/deflate; unknown codecs are dumped raw for later.
  • Repack: Builds .kzb/.kzbf from a folder + manifest with recomputed offsets, sizes, checksums, and padding that mirrors the original layout.
  • Integrity checks: Optional CRC/hash verification (when present). Strict bounds checks on every read to kill “unpack requires a buffer of 4 bytes” bugs before they happen.
  • Metadata preservation: Keeps original order, alignment, and naming to stay diff-friendly and drop-in compatible.
  • Error-tolerant extraction: Salvages good entries and pinpoints the exact broken offset instead of face-planting the whole run.
  • PNG sanity: Auto-repairs common PNG/zlib edge cases (IHDR lengths, CRCs) and clearly flags genuinely corrupted images.
  • 4-byte discipline: Every 32-bit field is read with preflight len(buf) >= 4 checks and explicit offset reporting.

Thanks to user BigUncleMax for his kzbTools repo which this is based on.

Unpacking

image

Packing

The program can repack a kzb folder back into .kzb format, I am still currently testing the output to validate if it is creating a good file.
image

About

A python program to unpack or repack a .kzb file.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages