kaitai-io/kaitai_struct

Just sharing a node cli app for Kaitai Struct JSON dump

Thell opened this issue · 0 comments

Thank you for the awesome tools! I'd like to share-back a lightweight tool I made to dump binaries to json using Kaitai Struct and Kaitai Struct Compiler along with json-stream-stringify in order to get away from browser/tab memory limits when dumping large binaries to JSON.

The repo is https://github.com/Thell/ksdumpjs and it is on npm at https://www.npmjs.com/package/ksdumpjs

When installed via npm install -g ksdumpjs the output looks like this:

> ksdumpjs .\test\formats\zip.ksy .\test\samples\sample1.zip -s
►  ksdump           Initialized timer...

Processing:      .\test\formats\zip.ksy
⚙️  Generating:      Zip
  -> Importing common/dos_datetime
     Parsing common/dos_datetime
🔍  Parsing binary:  .\test\samples\sample1.zip
📤  Transforming:    .\test\samples\sample1.zip
📤  Exporting:       jsons\sample1.json
✅  Success          jsons\sample1.json

[█] ksdump           Timer run for: 129ms

The keys for instance values are output in a different order than the web-ide or ksdump but when sorted (using jq) the outputs are equal between ksdumpjs and the web-ide. Perhaps an 'official' dumper that didn't require the Visualizer (along with Ruby) will someday make an appearance but in the meantime this will hopefully help others. :)

Anyhow, just want to say thanks again for the cool tools.