Skip to content

alessandrograssi-dev/elfinfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ELFInfo --- A Native ELF Binary Inspector in C++

C++
License

A lightweight ELF file inspector written in modern C++, inspired by tools like readelf and objdump.

This project parses and displays key parts of the ELF (Executable and Linkable Format), including:

  • ELF header
  • Section headers
  • Program headers
  • Section โ†” Segment mapping

It supports both 32โ€‘bit and 64โ€‘bit ELF formats and handles endianness correctly.


๐Ÿง  Motivation

ELF (Executable and Linkable Format) is the standard binary format on Unixโ€‘like systems (Linux, BSD, etc.).

This project is a pedagogical reimplementation in pure C++ to:

โœ” Understand lowโ€‘level binary layout
โœ” Learn endianness, ABI differences, and file parsing
โœ” Build your own inspection tools
โœ” Demonstrate systems programming skills


๐Ÿ›  Features

Feature Status


ELF Header Parsing โœ… Section Header Table โœ… Program Header Table โœ… Section โ†” Segment Mapping โœ… CLI Interface โœ… Supports 32 & 64โ€‘bit โœ… Endianness Awareness โœ… Dynamic Sections / Symbols ๐Ÿšง (Planned)


๐Ÿ“ฆ Build

Requires a C++17โ€‘compatible compiler:

git clone https://github.com/alessandrograssi-dev/elfinfo.git
cd elfinfo
mkdir build && cd build
cmake ..
make -j$(nproc)

๐Ÿ“Œ Usage

./elfinfo <filename> [options]

Example:

./elfinfo /bin/ls --headers --section-headers --program-headers

๐Ÿงฉ How It Works

  1. Reads the ELF header to determine format (32/64 bit + endianness)
  2. Parses section headers
  3. Parses program headers
  4. Maps sections to segments based on offset ranges
  5. Prints formatted tables similar to readelf

๐Ÿš€ Why This Is Interesting

This project demonstrates:

โœ” Lowโ€‘level file I/O
โœ” Safe binary parsing in C++
โœ” Template-based typed reads
โœ” Endianness handling
โœ” Understanding of executable internals

Ideal for systems programming, compiler tooling, or infrastructure roles.


๐Ÿ“œ License

MIT License.