18 releases (1 stable)

Uses new Rust 2024

1.0.0 Jul 12, 2026
0.17.6 Mar 18, 2026
0.17.4 Feb 21, 2026
0.17.1 Oct 25, 2025
0.0.1 Jul 3, 2022

#112 in Debugging

Download history 764/week @ 2026-04-12 410/week @ 2026-04-19 509/week @ 2026-04-26 446/week @ 2026-05-03 502/week @ 2026-05-10 196/week @ 2026-05-17 417/week @ 2026-05-24 227/week @ 2026-05-31 348/week @ 2026-06-07 359/week @ 2026-06-14 394/week @ 2026-06-21 347/week @ 2026-06-28 290/week @ 2026-07-05 370/week @ 2026-07-12 441/week @ 2026-07-19 364/week @ 2026-07-26

1,472 downloads per month

Apache-2.0

5.5MB
162K SLoC

LIEF

LIEF Design

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 /MT and /MD linking)
  • Windows arm64 (support /MT and /MD linking)
  • 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-64 and aarch64 with 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 = 1.0.0
fn 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


LIEF Rust Bindings

These are the offical rust bindings for LIEF.

LIEF Architecture

Getting Started

[dependencies]
lief = "1.0.0"

The bindings require Rust edition 2024 and rustc >= 1.85.0

use lief;

if let Some(lief::Binary::ELF(elf)) = lief::Binary::from(&mut file) {
    println!("Dependencies:");
    for entry in elf.dynamic_entries() {
        if let dynamic::Entries::Library(lib) = entry {
            println!("  - {}", lib.name());
        }
    }
    println!("Versions:");
    for version in elf.symbols_version_requirement() {
        println!("  From {}", version.name());
        for aux in version.auxiliary_symbols() {
            println!("    - {}", aux.name());
        }
    }
}

Documentation

Dependencies

~2.6–6.5MB
~121K SLoC