pub trait Binary {
// Provided methods
fn entrypoint(&self) -> u64 { ... }
fn imagebase(&self) -> u64 { ... }
fn is_pie(&self) -> bool { ... }
fn has_nx(&self) -> bool { ... }
fn original_size(&self) -> u64 { ... }
fn debug_info(&self) -> Option<DebugInfo<'_>> { ... }
fn disassemble(&self, address: u64, size: u64) -> InstructionsIt<'_> ⓘ { ... }
fn disassemble_symbol(&self, name: &str) -> InstructionsIt<'_> ⓘ { ... }
fn disassemble_address(&self, address: u64) -> InstructionsIt<'_> ⓘ { ... }
fn disassemble_slice(
&self,
slice: &[u8],
address: u64
) -> InstructionsIt<'_> ⓘ { ... }
fn assemble(&mut self, address: u64, asm: &str) -> Vec<u8> { ... }
}
Provided Methods§
fn entrypoint(&self) -> u64
fn entrypoint(&self) -> u64
Binary’s entrypoint
fn original_size(&self) -> u64
fn original_size(&self) -> u64
Original file size of the binary
fn debug_info(&self) -> Option<DebugInfo<'_>>
fn debug_info(&self) -> Option<DebugInfo<'_>>
Return the debug info if present. It can be either a
crate::pdb::DebugInfo
or crate::dwarf::DebugInfo
.
For ELF and Mach-O binaries, it returns the given DebugInfo object only if the binary embeds the DWARF debug info in the binary itself.
For PE file, this function tries to find the external PDB using
the crate::pe::debug::CodeViewPDB::filename
output (if present). One can also
use crate::pdb::load
or crate::pdb::DebugInfo::from
to get PDB debug
info.
fn disassemble(&self, address: u64, size: u64) -> InstructionsIt<'_> ⓘ
fn disassemble(&self, address: u64, size: u64) -> InstructionsIt<'_> ⓘ
Disassemble code starting a the given virtual address and with the given size.
let insts = binary.disassemble(0xacde, 100);
for inst in insts {
println!("{}", inst.to_string());
}
See also crate::assembly::Instruction
and crate::assembly::Instructions
fn disassemble_symbol(&self, name: &str) -> InstructionsIt<'_> ⓘ
fn disassemble_symbol(&self, name: &str) -> InstructionsIt<'_> ⓘ
Disassemble code for the given symbol name
let insts = binary.disassemble_symbol("__libc_start_main");
for inst in insts {
println!("{}", inst.to_string());
}
See also crate::assembly::Instruction
and crate::assembly::Instructions
fn disassemble_address(&self, address: u64) -> InstructionsIt<'_> ⓘ
fn disassemble_address(&self, address: u64) -> InstructionsIt<'_> ⓘ
Disassemble code at the given virtual address
let insts = binary.disassemble_address(0xacde);
for inst in insts {
println!("{}", inst.to_string());
}
See also crate::assembly::Instruction
and crate::assembly::Instructions
fn disassemble_slice(&self, slice: &[u8], address: u64) -> InstructionsIt<'_> ⓘ
fn disassemble_slice(&self, slice: &[u8], address: u64) -> InstructionsIt<'_> ⓘ
Disassemble code provided by the given slice at the specified address
parameter.
See also crate::assembly::Instruction
and crate::assembly::Instructions