package owee

  1. Overview
  2. Docs

Minimalist ELF 64 decoder

type identification = {
  1. elf_class : Owee_buf.u8;
  2. elf_data : Owee_buf.u8;
  3. elf_version : Owee_buf.u8;
  4. elf_osabi : Owee_buf.u8;
  5. elf_abiversion : Owee_buf.u8;
}
type header = {
  1. e_ident : identification;
  2. e_type : Owee_buf.u16;
  3. e_machine : Owee_buf.u16;
  4. e_version : Owee_buf.u32;
  5. e_entry : Owee_buf.u64;
  6. e_phoff : Owee_buf.u64;
  7. e_shoff : Owee_buf.u64;
  8. e_flags : Owee_buf.u32;
  9. e_ehsize : Owee_buf.u16;
  10. e_phentsize : Owee_buf.u16;
  11. e_phnum : Owee_buf.u16;
  12. e_shentsize : Owee_buf.u16;
  13. e_shnum : Owee_buf.u16;
  14. e_shstrndx : Owee_buf.u16;
}
type section = {
  1. sh_name : Owee_buf.u32;
  2. sh_type : Owee_buf.u32;
  3. sh_flags : Owee_buf.u64;
  4. sh_addr : Owee_buf.u64;
  5. sh_offset : Owee_buf.u64;
  6. sh_size : Owee_buf.u64;
  7. sh_info : Owee_buf.u32;
  8. sh_addralign : Owee_buf.u64;
  9. sh_entsize : Owee_buf.u64;
  10. sh_name_str : string;
}
val read_elf : Owee_buf.t -> header * section array

From a buffer pointing to an ELF image, read_elf decodes the header and section table.

val section_body : Owee_buf.t -> section -> Owee_buf.t

From a buffer pointing to an ELF image, section_body elf section returns a sub-buffer with the contents of the section of the ELF image.

val find_section : section array -> string -> section option

Convenience function to find a section in the section table given its name.

val find_section_body : Owee_buf.t -> section array -> section_name:string -> Owee_buf.t option

From a buffer pointing to an ELF image, find the body of a section given its name.

val debug_line_pointers : Owee_buf.t -> section array -> Owee_debug_line.pointers_to_other_sections
module String_table : sig ... end
val find_string_table : Owee_buf.t -> section array -> String_table.t option

Fish out the string table from the given ELF buffer and section array.

module Symbol_table : sig ... end
val find_symbol_table : Owee_buf.t -> section array -> Symbol_table.t option

Fish out both the dynamic and static symbol tables (.dynsym and .symtab) from the given ELF buffer and section array.

OCaml

Innovation. Community. Security.