Crate lief
Expand description
§LIEF

This package provides Rust bindings for LIEF. It exposes most of the LIEF API to read these formats:
- ELF
- PE
- Mach-O
The bindings require at least Rust version 1.85.0 with the 2024 edition and support:
- Windows x86-64 (support
/MTand/MDlinking) - Windows arm64 (support
/MTand/MDlinking) - Linux x86-64 (+gnu/musl): Ubuntu 21.10+, Debian 12+, Fedora 35+, CentOS/RHEL 9+
- Linux i686 (+gnu/musl): Ubuntu 19.10+, Debian 10+
- Linux aarch64 (+gnu/musl): Ubuntu 21.10+, Debian 12+
- Android: API 30+
- macOS (
x86-64andaarch64with at least OSX Big Sur: 11.0) - iOS (
aarch64): 12+
§Getting Started
[package]
name = "my-awesome-project"
version = "0.0.1"
edition = "2024"
[dependencies]
# For nightly
lief = { git = "https://github.com/lief-project/LIEF", branch = "main" }
# For releases
lief = 2.0.0fn main() {
let path = std::env::args().last().unwrap();
let mut file = std::fs::File::open(path).expect("Can't open the file");
match lief::Binary::from(&mut file) {
Some(lief::Binary::ELF(elf)) => {
// Process ELF file
},
Some(lief::Binary::PE(pe)) => {
// Process PE file
},
Some(lief::Binary::MachO(macho)) => {
// Process Mach-O file (including FatMachO)
},
Some(lief::Binary::COFF(coff)) => {
// Process coff file
},
None => {
// Parsing error
}
}
return;
}Note that the generic module implements the different traits shared by different structure
of executable formats (symbols, relocations, â¦)
§Additional Information
For more details about the install procedure and the configuration, please check: https://lief.re/doc/latest/api/rust/index.html
Modules§
- Assembly/Disassembly Module
- Module for the COFF file format support in LIEF.
- Module for Dyld shared cache support
- Module for processing DWARF debug info
- Module for the ELF file format support in LIEF.
- Module for LIEFâs error
- Executable formats generic traits (LIEFâs abstract layer)
- LIEFâs logging API
- Module for the Mach-O file format support in LIEF.
- Module for Objective-C metadata
- Module for processing PDB file
- Module for the PE file format support in LIEF.
- This module contains all LIEFâs runtime API
Macros§
Structs§
- This structure represents a location in the different debug formats (DWARF/PDB)
- Configuration options for generated code from debug info.
- Structure that represents a binaryâs function
Enums§
- Enum that wraps all the executable formats supported by LIEF
- This enum wraps either a PDB or a DWARF debug info
Traits§
Functions§
- Try to demangle the given input.
- Hexdump the provided buffer.
- Same as
dumpbut with a limit on the number of bytes to dump - Return the extended version
- Return details about the extended version
- Whether it is an extended version of LIEF
- Return the current version