elf 0.1.0

A pure-rust library for parsing ELF files
Documentation

Build Status

rust-elf

Pure-Rust library for parsing ELF files

Documentation

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.sections.get_by_name(".text") {
        Some(s) => s,
        None => panic!("Failed to find .text section"),
    };

    println!("{:?}", text_scn.data);
}