Introduction

The purpose of this project is to provide a cross-platform library to parse, modify, and abstract the ELF, PE, and Mach-O formats.

From a technical standpoint, the library is written in C++ with a C++11 public interface and exposes bindings for Python and Rust.

As a result, you can use LIEF through an idiomatic API in these languages:

import lief

elf: lief.ELF.Binary = lief.ELF.parse("libc.so")

for symbol in elf.symbols:
    print(symbol.address, symbol.name)

print(elf.header)

for entry in elf.dynamic_entries:

  if isinstance(entry, lief.ELF.DynamicEntryLibrary):
      entry.name = "libhello.so"

elf.write("modified.elf")

The project is also dedicated to providing comprehensive documentation and maintaining strong development standards, including:

  • A test suite with code coverage and non-regression testing

  • Address Sanitizer checks (ASAN)

  • Continuous Integration for testing and releasing packages

  • Dockerization of various CI steps

  • A comprehensive changelog

  • Nightly builds

LIEF Architecture

To get started with LIEF’s features, you can check the documentation for specific formats: ELF, PE, or Mach-O. Integrating LIEF into your project is also straightforward:

With pip

$ pip install lief

Using a requirements.txt file

lief==0.17.5

You can find additional content, including release notes, on the LIEF blog:

Additional practical examples are available in the examples/ directory.

Extended Version

For those seeking enhanced support for PDB, DWARF, or Objective-C (and more), check out the extended section.

Additional Documentation