8 comments

  • genewitch7 hours ago
    I have a strong memory that AFL - american fuzzy lop the binary fuzzer had a feature similar to what this was doing based on the highlighted portions and screenshots. It wasn&#x27;t the AFL status screen, it was (may have been a) third party app, and it would color code parts of the input files based on the outputs or whatever from afl&#x27;s processing.<p>For example, there was a color key that explained that say, purple meant &quot;magic bytes&quot;, like &quot;0x4a46494600&quot; for JFIF0, and if any part of the input file caused errors it meant it was probably a checksum and needed to be &quot;fixed&quot; so afl could properly fuzz all the functions in the source code.<p>I&#x27;m not super in to fuzzing or that realm anymore, so i doubt i could describe it better than i did, here. I clicked through to see if someone have leveraged the AFL stuff for use in another tool, which would be cool.<p>edit: i think it was afl-analyze - i had a go at the source code for aflplusplus:<p>&gt; A nifty utility that grabs an input file and takes a stab at explaining its structure by observing how changes to it affect the execution path.<p>&gt; Another tool in AFL++ is the afl-analyze tool. It takes an input file, attempts to sequentially flip bytes and observes the behavior of the tested program. It then color-codes the input based on which sections appear to be critical and which are not; while not bulletproof, it can often offer quick insights into complex file formats.
  • dloss7 hours ago
    Other tools for parsing and analyzing binary data are listed here: <a href="https:&#x2F;&#x2F;github.com&#x2F;dloss&#x2F;binary-parsing">https:&#x2F;&#x2F;github.com&#x2F;dloss&#x2F;binary-parsing</a>
  • jcul12 hours ago
    Great write up!<p>I looked at ImHex a good while back and I think I had some runtime issues or maybe even compilation issues and didn&#x27;t dig deeper. Even though the definition language piqued my curiosity.<p>These days I tend to just use xxd, bless, ghex, or seldom wxHexEditor, depending on what I need. But ImHex looks really powerful, like it could replace all the GUI ones. I&#x27;m looking forward to giving it another go tomorrow.<p>Though these days I spend most of my time in wireshark, which is kind of a hex viewer in a way.<p>How does it manage with huge files? Does it try to load the entire thing into memory. I remember wxHexEditor being good for that, and even being able to open block devices directly and process memory IIRC. Might be getting mixed up with HxD.<p>The decompression and combining compressed with decompressed sections looks very cool. Is the decompression in memory or written to disk?<p>&#x2F;&#x2F; TagRecord Tags[while(!std::mem::eof())];<p>This loop based length stuff is very cool too, though for large files I&#x27;d imagine it could be slow as it will need to iterate through all records to determine the offset for records at the end of the file.<p>To be fair, wireshark &#x2F; pcap files have this problem too.
    • viraptor10 hours ago
      &gt; though for large files I&#x27;d imagine it could be slow as it will need to iterate through all records to determine the offset for records at the end of the file.<p>Yeah, it&#x27;s not doing lazy evaluation, so you need to watch out. It&#x27;s probably not the solution you want for (for example) looking at 500GB disk images.
  • dannas57 minutes ago
    There&#x27;s an ImHex WebAssembly build accessible online at: <a href="https:&#x2F;&#x2F;web.imhex.werwolv.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;web.imhex.werwolv.net&#x2F;</a>.
  • rixtox6 hours ago
    Kind of related, a tool that allows you to hand write ASCII-art-annotated hex dump files, while also able to generate the original binary file from such text file: <a href="https:&#x2F;&#x2F;github.com&#x2F;netspooky&#x2F;xx&#x2F;blob&#x2F;main&#x2F;examples&#x2F;elf.xx">https:&#x2F;&#x2F;github.com&#x2F;netspooky&#x2F;xx&#x2F;blob&#x2F;main&#x2F;examples&#x2F;elf.xx</a>
  • netsharc3 hours ago
    Wow, I&#x27;ve never thought of it, but &quot;syntax&quot;-highlighting for binary files would be awesome.. e.g. &quot;these bytes indicate the beginning of the next frame&quot; (when talking about MP3&#x2F;video files), maybe with mouseover support where it says e.g. &quot;this value at this location indicates it&#x27;s a $FOO variant of the file&quot;.<p>Anyone know of such a tool?
    • tripflag2 hours ago
      Kaitai Struct has an online demo which basically does this; <a href="https:&#x2F;&#x2F;ide.kaitai.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ide.kaitai.io&#x2F;</a>
    • pie_flavor3 hours ago
      I deal with a lot of cryptographic documents (e.g. public keys) and <a href="https:&#x2F;&#x2F;lapo.it&#x2F;asn1js&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lapo.it&#x2F;asn1js&#x2F;</a> is a godsend for making sense of them. You just paste in hex or pem, and it shows the full deconstructed format along with two-way &#x27;syntax highlighting&#x27; where if you hover over part of the deconstruction it highlights the equivalent part of the binary data. Hit the &#x27;load&#x27; button for a representative example.
    • frabert3 hours ago
      010 editor has something like this. Okteta too. They both use DSLs to represent formats
  • octagons12 hours ago
    I wasn’t aware that ImHex had this feature - perhaps I’ll try it!<p>I’ve been singing the praises of 010 Editor for years specifically because of its template and scripting features, the former of which is nearly identical to this DSL.
  • fragmede11 hours ago
    Looks slightly more expressive than Kaitai&#x27;s binary format DSL.