$ show rbakbashev/elfcat
elfcat is a zero-dependency Rust CLI tool that transforms ELF binary files into interactive, self-contained HTML visualizations. It parses the full ELF structureβfile header, program headers, section headers, segments, sections, notes, and string tablesβand generates an HTML page with a hex dump where bytes are color-coded by their structural role (e.g., ident, header fields, segments, sections). The output includes interactive features: hovering highlights the corresponding bytes in the hex dump, clicking fields with cross-references (like e_phoff or sh_offset) jumps to the referenced area and draws SVG arrows, and detailed info tables appear on hover for headers, segments, and sections. The tool is purely client-side; no server is involved, and the HTML report works offline in any modern browser. The codebase is well-structured, using Rust's trait system to abstract over 32-bit and 64-bit ELF formats without duplication, and it depends only on the Rust standard library.
The LLM identified 1 files worth highlighting for reuse:
The core parsing module that reads ELF binary data into structured representations (ParsedElf, ParsedPhdr, ParsedShdr, Note, StrTab). It also defines the Ranges data structureβa vector-of-vectors that tracks which byte ranges belong to which structural elements (e.g., header fields, segments, sections) by marking start and end indices. This design enables the report generator to emit HTML with nested <span> tags for interactive highlighting. The parser handles both 32-bit and 64-bit ELF via a generic trait approach (ElfXX in elfxx.rs) and supports both endiannesses. The StrTab helper efficiently extracts null-terminated strings from section data. Although tightly coupled to the rest of the tool, the parsing logic and range tracking pattern are well-architected and demonstrate solid Rust error handling and trait usage.