Node.js 绑定为非官方且由 AI 生成;Extended 功能需通过 extended.lief.re 单独获取;nightly 版本需指定专用 index-url 与 dev 版本号

LIEF
lief-projectApache-2.0活跃维护解析和修改 ELF、PE、Mach-O、DEX 等可执行文件格式的跨语言库,支持 C++、Python、Rust,常用于二进制分析与恶意软件研究。
LIEF - Library to Instrument Executable Formats (C++, Python, Rust)
1.0.0发布于 2026-07-12 13:55 UTC5,652star +13 / 7 天762fork同步于 2026-11-10 17:36 UTC
跨平台可执行文件格式解析与修改库,统一抽象 ELF、PE、MachO 等格式
解析和修改 ELF、PE、Mach-O、DEX 等可执行文件格式的跨语言库,支持 C++、Python、Rust,常用于二进制分析与恶意软件研究。
核心能力
- 解析 ELF、PE、MachO、COFF、OAT、DEX、VDEX、ART 内部结构
- 修改格式内容,如增删 section、改符号名
- 统一抽象三种格式的 section、symbol、入口点等共性
- 提供 C++、Python、Rust 及非官方 Node.js API
- 内置 AArch64、x86、ARM、RISC-V 等多架构反汇编器
容易踩的坑
内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README
- 1.0.0最新正式版2026-07-12 · 2026-07-12 13:55 UTC
- 0.17.62026-03-18 · 2026-03-18 07:03 UTC
- 0.17.52026-03-08 · 2026-03-08 10:23 UTC
- 0.17.42026-02-21 · 2026-02-21 09:40 UTC
- 0.17.32026-01-24 · 2026-01-24 16:04 UTC
用户点评
登录用户的真实使用记录,可按版本和硬件筛选共 0 条
还没有人点评。第一个说出真实体验的人最有价值。
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:
- Parsing: LIEF can parse ELF, PE, MachO, COFF, OAT, DEX, VDEX, ART and provides a user-friendly API to access their internals.
- Modify: LIEF can be used to modify some parts of these formats (adding a section, changing a symbol's name, ...)
- Abstract: Three formats have common features like sections, symbols, entry point... LIEF factors them.
- API: You can use LIEF via C++, Python, Rust, and Node.js (unofficial, AI-generated)
Extended features:
- Runtime
- DWARF/PDB Support
- Objective-C Metadata
- Dyld Shared Cache with support for extracting Dylib
- Disassembler: AArch64, x86/x86-64, ARM, RISC-V, Mips, PowerPC, eBPF
- Assembler: AArch64, x86/x86-64, RISC-V
Plugins:
Sponsors
Content
Downloads / Install
C++
find_package(LIEF REQUIRED)
target_link_libraries(my-project LIEF::LIEF)
Rust
[package]
name = "my-awesome-project"
version = "0.0.1"
edition = "2024"
[dependencies]
lief = "1.0.0"
Homebrew
brew install lief
Python
To install the latest version (release):
pip install lief
To install nightly build:
pip install [--user] --force-reinstall --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==2.0.0.dev0
Packages
- LIEF Extended: https://extended.lief.re (GitHub OAuth)
- Nightly:
- v1.0.0: https://github.com/lief-project/LIEF/releases/tag/1.0.0
Here are guides to install or integrate LIEF:
Getting started
Python
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)
Rust
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());
}
}
}
C++
#include <iostream>
#include <LIEF/LIEF.hpp>
int main(int argc, char** argv) {
// ELF
if (std::unique_ptr<const LIEF::ELF::Binary> elf = LIEF::ELF::Parser::parse("/bin/ls")) {
for (const LIEF::ELF::Section& section : elf->sections()) {
std::cout << section.name() << ' ' << section.virtual_address() << '\n';
}
}
// PE
if (std::unique_ptr<const LIEF::PE::Binary> pe = LIEF::PE::Parser::parse("C:\\Windows\\explorer.exe")) {
if (const LIEF::PE::RichHeader* rheader = pe->rich_header()) {
std::cout << rheader->key() << '\n';
}
}
// Mach-O
if (std::unique_ptr<LIEF::MachO::FatBinary> macho = LIEF::MachO::Parser::parse("/bin/ls")) {
for (const LIEF::MachO::Binary& bin : *macho) {
if (const LIEF::MachO::DyldChainedFixups* fixups = bin.dyld_chained_fixups()) {
std::cout << *fixups << '\n';
}
}
}
return 0;
}
Documentation
Contact
- Mail: contact at lief re
- Discord: LIEF
About
Authors
Romain Thomas (@rh0main) - Formerly at Quarkslab
License
BibTeX
@MISC {LIEF,
author = "Romain Thomas",
title = "LIEF - Library to Instrument Executable Formats",
howpublished = "https://lief.quarkslab.com/",
month = "apr",
year = "2017"
}