miasm
Reverse engineering framework
miasm.jitter.loader.elf Namespace Reference

Classes

class  libimp_elf
 

Functions

def get_import_address_elf (e)
 
def preload_elf (vm, e, runtime_lib, patch_vm_imp=True, loc_db=None)
 
def fill_loc_db_with_symbols (elf, loc_db, base_addr=0)
 
def apply_reloc_x86 (elf, vm, section, base_addr, loc_db)
 
def vm_load_elf (vm, fdata, name="", base_addr=0, loc_db=None, apply_reloc=False, **kargs)
 
def guess_arch (elf)
 

Variables

 log = logging.getLogger('loader_elf')
 
 hnd = logging.StreamHandler()
 
dictionary ELF_machine
 

Function Documentation

◆ apply_reloc_x86()

def miasm.jitter.loader.elf.apply_reloc_x86 (   elf,
  vm,
  section,
  base_addr,
  loc_db 
)
Apply relocation for x86 ELF contained in the section @section
@elf: miasm.loader's ELF instance
@vm: VmMngr instance
@section: elf's section containing relocation to perform
@base_addr: addr to reloc to
@loc_db: LocationDB used to retrieve symbols'offset
Here is the caller graph for this function:

◆ fill_loc_db_with_symbols()

def miasm.jitter.loader.elf.fill_loc_db_with_symbols (   elf,
  loc_db,
  base_addr = 0 
)
Parse the miasm.loader's ELF @elf to extract symbols, and fill the LocationDB
instance @loc_db with parsed symbols.

The ELF is considered mapped at @base_addr
@elf: miasm.loader's ELF instance
@loc_db: LocationDB used to retrieve symbols'offset
@base_addr: addr to reloc to (if any)
Here is the caller graph for this function:

◆ get_import_address_elf()

def miasm.jitter.loader.elf.get_import_address_elf (   e)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ guess_arch()

def miasm.jitter.loader.elf.guess_arch (   elf)
Return the architecture specified by the ELF container @elf.
If unknown, return None
Here is the caller graph for this function:

◆ preload_elf()

def miasm.jitter.loader.elf.preload_elf (   vm,
  e,
  runtime_lib,
  patch_vm_imp = True,
  loc_db = None 
)
Here is the call graph for this function:

◆ vm_load_elf()

def miasm.jitter.loader.elf.vm_load_elf (   vm,
  fdata,
  name = "",
  base_addr = 0,
  loc_db = None,
  apply_reloc = False,
**  kargs 
)
Very dirty elf loader
TODO XXX: implement real loader
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ELF_machine

dictionary miasm.jitter.loader.elf.ELF_machine
Initial value:
1 = {(elf_csts.EM_ARM, 32, elf_csts.ELFDATA2LSB): "arml",
2  (elf_csts.EM_ARM, 32, elf_csts.ELFDATA2MSB): "armb",
3  (elf_csts.EM_AARCH64, 64, elf_csts.ELFDATA2LSB): "aarch64l",
4  (elf_csts.EM_AARCH64, 64, elf_csts.ELFDATA2MSB): "aarch64b",
5  (elf_csts.EM_MIPS, 32, elf_csts.ELFDATA2MSB): "mips32b",
6  (elf_csts.EM_MIPS, 32, elf_csts.ELFDATA2LSB): "mips32l",
7  (elf_csts.EM_386, 32, elf_csts.ELFDATA2LSB): "x86_32",
8  (elf_csts.EM_X86_64, 64, elf_csts.ELFDATA2LSB): "x86_64",
9  (elf_csts.EM_SH, 32, elf_csts.ELFDATA2LSB): "sh4",
10  (elf_csts.EM_PPC, 32, elf_csts.ELFDATA2MSB): "ppc32b",
11  }

◆ hnd

miasm.jitter.loader.elf.hnd = logging.StreamHandler()

◆ log

miasm.jitter.loader.elf.log = logging.getLogger('loader_elf')