Introduction

The purpose of this project is to provide a cross-platform library to parse, modify, and abstract 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.

Hence, you can use LIEF with 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")

This project is also attached to provide comprehensive documentation as well as development best practices:

  • A regular test suite associated with test coverage and non-regression testing

  • Address sanitizer checks (ASAN)

  • CI for testing and releasing packages

  • Dockerization of the different CI steps

  • A comprehensive changelog

  • Nightly builds

LIEF Architecture

To get started with LIEF functionalities, you can check the documentation of one of these formats: ELF, PE, or Mach-O and to start integrating LIEF in your project it should be pretty straightforward:

With pip

$ pip install lief

Using a requirement.txt file

lief==0.16.0

You can also find additional content in the LIEF’s blog post among those:

As well as in the examples/ directory

Extended Version

For those who seek for enhanced support for PDB, DWARF or Objective-C (and more), you can check the extended section.

Additional Documentation