GNU poke: The extensible editor for structured binary data
jemarch.net
jemarch.net
Poke is actually not only an editor, it's a domain specific language.
This language is built on top of something called GNU Jitter.
https://www.gnu.org/software/jitter/
Jitter is a very interesting project! It's a kind of generic interpreter that is—as the name suggests—almost a JIT compiler. It's something more or less "in between". Technically it's more an interpreter + VM. But it uses all kinds of (I think novel) tricks to remove the overhead of interpretation, which makes the code at runtime almost look like what a JIT compiler would have produced.
Some more internal info than on the GNU page on how this works can be found in the following slides:
http://ageinghacker.net/talks/jitter-slides--saiu--ghm2017--...
Because people will be compromising your GNU poke or Jitter code?
I feel like a good "how powerful is this tool, really?" test would be to model the Adobe PSD format with it. That format is bananas, and is what got me into this topic in the first place.
But for those interested, here are some other tools in this vein:
* fq - like jq for binary data: https://github.com/wader/fq
* Kaitai Struct - https://kaitai.io/
** visualizer, for the above: https://github.com/kaitai-io/kaitai_struct_visualizer/
* HexFiend - a hex editor, but with "binary templates" feature : https://github.com/HexFiend/HexFiend
** binary templates, for the above: https://github.com/HexFiend/HexFiend/blob/master/templates/T...
* binspector - https://github.com/binspector/binspector
* binary-parsing - a collection of links to similar such tools : https://github.com/dloss/binary-parsing
* unblob - https://github.com/onekey-sec/unblob
** previous HN thread, for the above: https://news.ycombinator.com/item?id=34434249
I started looking at Kaitai Struct not too long ago. I purposely started with a pretty simple format, but I think I'm not smart enough to figure out the input format. Also, I'm pretty sure I hate YAML.
I tried building Poke just last week, having resolved to try it since 1.0, but hit problems with the Boehm GC on my old Mac, and then what looks like Readline problems on my new Mac. I haven't given up, but I'm off to a slow start.
Hachoir, mentioned in another comment, looks promising, although the input looks suspiciously similar to a program I'd write myself.
Bootstrap Pkgsrc:
git clone https://github.com/NetBSD/pkgsrc.git
cd pkgsrc/bootstrap
./bootstrap --unprivileged
And then build and install Poke:
cd ~/pkgsrc/editors/poke
bmake install package clean clean-depends
* Synalyze It! - Hex Editor for Mac: https://www.synalysis.net/
I am not affiliated Synalyze It!, but have been a customer for several years. Generally, I've been happy with it, though it crashes occasionally. The support has been responsive when I've had licensing issues.
Maybe it could do that and I just couldn't figure it out at the time, but if you have say a zip file with different file formats, you couldn't tell the language to switch between different structures based on like an index or a header that tells you the format of a subsection. It was a limitation of the pattern language.
I wonder if GNU poke is more advanced in that regard? A tool like this would be super useful for debugging custom binary formats, but some formats can get pretty complex.
https://github.com/EUA/wxHexEditor / http://www.wxhexeditor.org/
I've been using 010 Editor, which similarly lets you define templates with c-like syntax, run it against a file, and edit the fields from there.
(Cross platform too, which is nice. It is a paid product though)
Reminds me of ResEdit, from classic Mac OS, and its template resources.
> Pickling is the process of preserving or extending the shelf life of food by either anaerobic fermentation in brine or immersion in vinegar.
The capabilities of hex editors on Linux is strongly underwhelming when compared to, say, WinHex almost 30 years ago!