Voltar ao ranking

lief-project/LIEF

C++lief.re

LIEF - Library to Instrument Executable Formats (C++, Python, Rust)

reverse-engineeringmalware-analysisbinary-analysisparsermodificationexecutable-formatselfmachopeliefparsingsdk
Crescimento de estrelas
Estrelas
5.5k
Forks
739
Crescimento semanal
Issues
27
2k4k
abr. de 2017mai. de 2020jun. de 2023jul. de 2026
README



BlogDocumentationAbout


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, C and Node.js (unofficial, AI-generated)

Extended features:

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

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

Apache 2.0.

Bibtex

@MISC {LIEF,
  author       = "Romain Thomas",
  title        = "LIEF - Library to Instrument Executable Formats",
  howpublished = "https://lief.quarkslab.com/",
  month        = "apr",
  year         = "2017"
}
Repositórios relacionados
Hack-with-Github/Awesome-Hacking

A collection of various awesome lists for hackers, pentesters and security researchers

Creative Commons Zero v1.0 Universalhackingsecurity
116.6k10.5k
NationalSecurityAgency/ghidra

Ghidra is a software reverse engineering (SRE) framework

JavaMavenApache License 2.0software-analysisdisassembler
nsa.gov/ghidra
71.1k7.8k
xtekky/gpt4free

The official gpt4free repository | various collection of powerful language models | opus 4.6 gpt 5.3 kimi 2.5 deepseek v3.2 gemini 3

PythonPyPIGNU General Public License v3.0chatgptchatgpt-4
t.me/g4f_channel
66.5k13.5k
WerWolv/ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.

C++GNU General Public License v2.0hex-editorreverse-engineering
imhex.werwolv.net
54.2k2.4k
x64dbg/x64dbg

An open-source user mode debugger for Windows. Optimized for reverse engineering and malware analysis.

C++Otherdebuggerwindows
x64dbg.com
48.9k2.8k
JCodesMore/ai-website-cloner-template

Clone any website with one command using AI coding agents

TypeScriptnpmMIT Licenseaiai-agents
dsc.gg/jcodesmore
29.1k4.2k
librepods-org/librepods

AirPods liberated from Apple's ecosystem.

KotlinGNU General Public License v3.0airpodslinux
29.1k1.6k
iBotPeaches/Apktool

A tool for reverse engineering Android apk files

JavaMavenApache License 2.0apktoolapk
apktool.org
25.1k4k
radareorg/radare2

UNIX-like reverse engineering framework and command-line toolset

COtherradare2c
radare.org
24.4k3.3k
rizinorg/cutter

Free and Open Source Reverse Engineering Platform powered by rizin

C++GNU General Public License v3.0cuttergui
cutter.re
19.4k1.4k
vitalysim/Awesome-Hacking-Resources

A collection of hacking / penetration testing resources to make you better!

GNU General Public License v3.0ctfhacking
17.3k2.2k
Tyrrrz/YoutubeDownloader

Downloads videos and playlists from YouTube

C#MIT Licenseyoutubedownload
github.com/Tyrrrz/YoutubeDownloader/releases
15.7k2k