LIEF
v0.15.1
블로그 • 문서 • 정보
이 프로젝트의 목적은 ELF, PE 및 MachO 형식을 구문 분석, 수정 및 추상화하는 크로스 플랫폼 라이브러리를 제공하는 것입니다.
주요 특징 :
확장된 기능 :
find_package (LIEF REQUIRED)
target_link_libraries (my-project LIEF::LIEF)
[ package ]
name = " my-awesome-project "
version = " 0.0.1 "
edition = " 2021 "
[ dependencies ]
lief = " 0.15.1 "
최신 버전 (릴리스)을 설치하려면:
pip install lief
Nightly 빌드를 설치하려면 다음 안내를 따르세요.
pip install [--user] --force-reinstall --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==0.16.0.dev0
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 ( "C: \ Windows \ explorer.exe" )
if rheader := pe . rich_header :
print ( rheader . key )
# Mach-O
binary = lief . parse ( "/usr/bin/ls" )
for fixup in binary . dyld_chained_fixups :
print ( fixup )
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 ( ) ) ;
}
}
}
# 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::DyldChainedFixups& fixup : macho-> dyld_chained_fixups ()) {
std::cout << fixup << ' n ' ;
}
}
return 0 ;
}
# include < LIEF/LIEF.h >
int main ( int argc, char ** argv) {
Elf_Binary_t* elf = elf_parse ( " /usr/bin/ls " );
Elf_Section_t** sections = elf-> sections ;
for ( size_t i = 0 ; sections[i] != NULL ; ++i) {
printf ( " %s n " , sections[i]-> name );
}
elf_binary_destroy (elf);
return 0 ;
}
Romain Thomas(@rh0main) - Quarkslab
LIEF는 Apache 2.0 라이센스에 따라 제공됩니다.
@MISC { LIEF ,
author = " Romain Thomas " ,
title = " LIEF - Library to Instrument Executable Formats " ,
howpublished = " https://lief.quarkslab.com/ " ,
month = " apr " ,
year = " 2017 "
}