LIEF - Library to Instrument Executable Formats (C++, Python, Rust)
LIEF - Library to Instrument Executable Formats (C++, Python, Rust)
Blog • Documentation • About
The purpose of this project is to provide a cross-platform library to parse, modify and abstract ELF, PE and MachO formats.
Main features:
Extended features:
Plugins:
find_package(LIEF REQUIRED)
target_link_libraries(my-project LIEF::LIEF)[package]
name = "my-awesome-project"
version = "0.0.1"
edition = "2024"
[dependencies]
lief = "1.0.0"brew install liefTo install the latest version (release):
pip install liefTo install nightly build:
pip install [--user] --force-reinstall --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==2.0.0.dev0Here are guides to install or integrate LIEF:
import lief
# ELF
binary = lief.parse("/usr/bin/ls")
for section in binary.sections:
print(section.name, section.virtual_address)
# PE
binary = lief.parse(r"C:\Windows\explorer.exe")
if (rheader := binary.rich_header) is not None:
print(rheader.key)
# Mach-O
binary = lief.parse("/usr/bin/ls")
if (fixups := binary.dyld_chained_fixups) is not None:
print(fixups)use lief::Binary;
use lief::pe::debug::Entries::CodeViewPDB;
if let Some(Binary::PE(pe)) = Binary::parse(path.as_str()) {
for entry in pe.debug() {
if let CodeViewPDB(pdb_view) = entry {
println!("{}", pdb_view.filename());
}
}
}…Romain Thomas (@rh0main) - Formerly at Quarkslab
@MISC {LIEF,
author = "Romain Thomas",
title = "LIEF - Library to Instrument Executable Formats",
howpublished = "https://lief.quarkslab.com/",
month = "apr",
year = "2017"
}No open issues yet, or sync has not completed.