Reading and writing binary formats is hard, especially if
it's interchange format that should work across multitude of
platforms and languages.

Have you ever found yourself writing repetitive,
error-prone and hard-to-debug code that reads binary data structures
from file / network stream and somehow represents them in memory for
easier access?

Kaitai Struct tries to make this job easier — you only have to
describe binary format once and then everybody can use it from their
programming languages — cross-language, cross-platform.

What is Kaitai Struct?

Kaitai Struct is a declarative language used to describe various
binary data structures, laid out in files or in memory: i.e. binary
file formats, network stream packet formats, etc.

The main idea is that a particular format is described in Kaitai
Struct language (.ksy file) and then can be compiled with
ksc into source files in one of the supported programming
languages. These modules will include a generated code for a parser
that can read described data structure from a file / stream and give
access to it in a nice, easy-to-comprehend API.

Using KS in your project

Typically, using formats described in KS in your project, involves the
following steps:

Describe the format — i.e. create a .ksy file

Use visualizer to debug the format and ensure that it parses data properly

Compile .ksy file into target language source file and include
that file into your project

Downloading and installing

There is an official .deb repository
available for Debian / Ubuntu-based
distributions. The repository is hosted at BinTray
and signed with BinTray GPG key
(379CE192D401AB61), so it's necessary
to import that key first if your box haven't used
any BinTray repositories beforehand:

Requirements

"Universal" builds are downloadable as
a .zip file that includes all the required
.jar files bundled and launcher scripts
for Linux / Mac OS X / Windows systems. No
installation required, one can just unpack
and run it.

Requirements

If you prefer to build your tools from source, or just want to see how KS works, the easiest way to check out whole project is to download main (umbrella) project repository that already includes all other parts as sub-modules. Use:

git clone --recursive https://github.com/kaitai-io/kaitai_struct.git

Note the --recursive option.

Alternatively, one can check out individual sub-projects that consitute Kaitai Struct suite. See GitHub project page for details.

Built with Kaitai Struct

We maintain a
growing free
/ open source repository of file formats
and protocols specifications. Visit our format
gallery to view the showcase of that
repository with documentation, block diagrams
and ready-made parser libraries in all
supported target languages.