1.0 KiB
1.0 KiB
rust-elf
Pure-Rust library for parsing ELF files
Example:
extern crate elf;
fn main() {
let path: std::path::PathBuf = From::from("some_file");
let mut io = match std::fs::File::open(path) {
Ok(f) => f,
Err(e) => panic!("Error: {:?}", e),
};
let elf_file = match elf::File::open_stream(&mut io) {
Ok(f) => f,
Err(e) => panic!("Error: {:?}", e),
};
println!("ELF: {}", elf_file.ehdr);
let text_scn = match elf_file.get_section(".text") {
Some(s) => s,
None => panic!("Failed to find .text section"),
};
println!("{:?}", text_scn.data);
}