miasm
Reverse engineering framework
miasm.os_dep.linux.environment.AuxVec Class Reference
Inheritance diagram for miasm.os_dep.linux.environment.AuxVec:
Collaboration diagram for miasm.os_dep.linux.environment.AuxVec:

Public Member Functions

def __init__ (self, elf_phdr_vaddr, entry_point, linux_env, **kwargs)
 
def data_to_map (self)
 
def iteritems (self)
 

Public Attributes

 info
 
 ptrs
 

Static Public Attributes

int AT_PHDR = 3
 
int AT_PHNUM = 5
 
int AT_PAGESZ = 6
 
int AT_ENTRY = 9
 
int AT_UID = 11
 
int AT_EUID = 12
 
int AT_GID = 13
 
int AT_EGID = 14
 
int AT_PLATFORM = 15
 
int AT_HWCAP = 16
 
int AT_SECURE = 23
 
int AT_RANDOM = 25
 
int AT_SYSINFO_EHDR = 33
 
def items = iteritems
 

Detailed Description

Auxiliary vector abstraction, filled with default values
(mainly based on https://lwn.net/Articles/519085)

# Standard usage
>>> auxv = AuxVec(elf_base_addr, cont_target.entry_point, linux_env)

# Enable AT_SECURE
>>> auxv = AuxVec(..., AuxVec.AT_SECURE=1)
# Modify AT_RANDOM
>>> auxv = AuxVec(..., AuxVec.AT_RANDOM="\x00"*0x10)

# Using AuxVec instance for stack preparation
# First, fill memory with vectors data
>>> for AT_number, data in auxv.data_to_map():
        dest_ptr = ...
        copy_to_dest(data, dest_ptr)
        auxv.ptrs[AT_number] = dest_ptr
# Then, get the key: value (with value being sometime a pointer)
>>> for auxid, auxval in auxv.iteritems():
        ...

Constructor & Destructor Documentation

◆ __init__()

def miasm.os_dep.linux.environment.AuxVec.__init__ (   self,
  elf_phdr_vaddr,
  entry_point,
  linux_env,
**  kwargs 
)
Instantiate an AuxVec, with required elements:
- elf_phdr_vaddr: virtual address of the ELF's PHDR in memory
- entry_point: virtual address of the ELF entry point
- linux_env: LinuxEnvironment instance, used to provides some of the
  option values

Others options can be overridden by named arguments

Member Function Documentation

◆ data_to_map()

def miasm.os_dep.linux.environment.AuxVec.data_to_map (   self)
Iterator on (AT_number, data)
Once the data has been mapped, the corresponding ptr must be set in
'self.ptrs[AT_number]'

◆ iteritems()

def miasm.os_dep.linux.environment.AuxVec.iteritems (   self)
Iterator on auxiliary vector id and values

Member Data Documentation

◆ AT_EGID

int miasm.os_dep.linux.environment.AuxVec.AT_EGID = 14
static

◆ AT_ENTRY

int miasm.os_dep.linux.environment.AuxVec.AT_ENTRY = 9
static

◆ AT_EUID

int miasm.os_dep.linux.environment.AuxVec.AT_EUID = 12
static

◆ AT_GID

int miasm.os_dep.linux.environment.AuxVec.AT_GID = 13
static

◆ AT_HWCAP

int miasm.os_dep.linux.environment.AuxVec.AT_HWCAP = 16
static

◆ AT_PAGESZ

int miasm.os_dep.linux.environment.AuxVec.AT_PAGESZ = 6
static

◆ AT_PHDR

int miasm.os_dep.linux.environment.AuxVec.AT_PHDR = 3
static

◆ AT_PHNUM

int miasm.os_dep.linux.environment.AuxVec.AT_PHNUM = 5
static

◆ AT_PLATFORM

int miasm.os_dep.linux.environment.AuxVec.AT_PLATFORM = 15
static

◆ AT_RANDOM

int miasm.os_dep.linux.environment.AuxVec.AT_RANDOM = 25
static

◆ AT_SECURE

int miasm.os_dep.linux.environment.AuxVec.AT_SECURE = 23
static

◆ AT_SYSINFO_EHDR

int miasm.os_dep.linux.environment.AuxVec.AT_SYSINFO_EHDR = 33
static

◆ AT_UID

int miasm.os_dep.linux.environment.AuxVec.AT_UID = 11
static

◆ info

miasm.os_dep.linux.environment.AuxVec.info

◆ items

def miasm.os_dep.linux.environment.AuxVec.items = iteritems
static

◆ ptrs

miasm.os_dep.linux.environment.AuxVec.ptrs

The documentation for this class was generated from the following file: