Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Lightweight elf binary parser with no external dependencies - Sections, Symbols, Relocations, Segments

License

NotificationsYou must be signed in to change notification settings

finixbit/elf-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightweight elf binary parser with no external dependencies - Sections, Symbols, Relocations, Segments

Required libraries

No dependencies

Usage

Sections (readelf -S executable)

parse sections header table from elf binary and return vector of section_t below

typedefstruct {int section_index =0;     std::intptr_t section_offset, section_addr;    std::string section_name;    std::string section_type;int section_size, section_ent_size, section_addr_align;}section_t;

get elf sections using elf-parser

#include<elf-parser.h>elf_parser::Elf_parserelf_parser(executable_path);std::vector<elf_parser::section_t> secs = elf_parser.get_sections();

seeexample

Segments (readelf -l executable)

parse program header table from elf binary and return vector of segment_t below

typedefstruct {    std::string segment_type, segment_flags;long segment_offset, segment_virtaddr, segment_physaddr, segment_filesize, segment_memsize;int segment_align;}segment_t;

get elf segments using elf-parser

#include<elf-parser.h>elf_parser::Elf_parserelf_parser(executable_path);std::vector<elf_parser::segment_t> segs = elf_parser.get_segments();

seeexample

Symbols (readelf -s executable)

parse symbols table from elf binary and return vector of symbol_t below

typedefstruct {    std::string symbol_index;    std::intptr_t symbol_value;int symbol_num =0, symbol_size =0;    std::string symbol_type, symbol_bind, symbol_visibility, symbol_name, symbol_section;      }symbol_t;

get elf symbols using elf-parser

#include<elf-parser.h>elf_parser::Elf_parserelf_parser(executable_path);std::vector<elf_parser::symbol_t> syms = elf_parser.get_symbols();

seeexample

Relocations (readelf -r executable)

parse relocations with plt address from elf binary and return vector of relocation_t below

typedefstruct {    std::intptr_t relocation_offset, relocation_info, relocation_symbol_value;    std::string   relocation_type, relocation_symbol_name, relocation_section_name;    std::intptr_t relocation_plt_address;}relocation_t;

get elf relocations using elf-parser

#include<elf-parser.h>elf_parser::Elf_parserelf_parser(executable_path);std::vector<elf_parser::relocation_t> relocs = elf_parser.get_relocations();

seeexample

Supported Architecture

amd64

Projects using elf-parser

finixbit / ltrace - Library call tracer

finixbit / ftrace - Function call tracer

About

Lightweight elf binary parser with no external dependencies - Sections, Symbols, Relocations, Segments

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp