miasm
Reverse engineering framework
miasm.os_dep.linux.environment Namespace Reference

Classes

class  AuxVec
 
class  FileDescriptor
 
class  FileDescriptorCharDevice
 
class  FileDescriptorDirectory
 
class  FileDescriptorRegularFile
 
class  FileDescriptorSocket
 
class  FileDescriptorSTDERR
 
class  FileDescriptorSTDIN
 
class  FileDescriptorSTDOUT
 
class  FileSystem
 
class  LinuxEnvironment
 
class  LinuxEnvironment_arml
 
class  LinuxEnvironment_x86_32
 
class  LinuxEnvironment_x86_64
 
class  Networking
 

Functions

def prepare_loader_x86_64 (jitter, argv, envp, auxv, linux_env, hlt_address=0x13371acc)
 
def prepare_loader_arml (jitter, argv, envp, auxv, linux_env, hlt_address=0x13371acc)
 

Variables

 REGEXP_T = type(re.compile(''))
 
 StatInfo
 
 StatFSInfo
 
 log = logging.getLogger("environment")
 
 console_handler = logging.StreamHandler()
 

Function Documentation

◆ prepare_loader_arml()

def miasm.os_dep.linux.environment.prepare_loader_arml (   jitter,
  argv,
  envp,
  auxv,
  linux_env,
  hlt_address = 0x13371acc 
)
Fill the environment with enough information to run a linux loader

@jitter: Jitter instance
@argv: list of strings
@envp: dict of environment variables names to their values
@auxv: AuxVec instance
@hlt_address (default to 0x13371acc): stopping address

Example of use:
>>> jitter = machine.jitter()
>>> jitter.init_stack()
>>> linux_env = LinuxEnvironment_arml()
>>> argv = ["/bin/ls", "-lah"]
>>> envp = {"PATH": "/usr/local/bin", "USER": linux_env.user_name}
>>> auxv = AuxVec(elf_base_addr, entry_point, linux_env)
>>> prepare_loader_arml(jitter, argv, envp, auxv, linux_env)
# One may want to enable syscall handling here
# The program can now run from the loader
>>> jitter.init_run(ld_entry_point)
>>> jitter.continue_run()

◆ prepare_loader_x86_64()

def miasm.os_dep.linux.environment.prepare_loader_x86_64 (   jitter,
  argv,
  envp,
  auxv,
  linux_env,
  hlt_address = 0x13371acc 
)
Fill the environment with enough information to run a linux loader

@jitter: Jitter instance
@argv: list of strings
@envp: dict of environment variables names to their values
@auxv: AuxVec instance
@hlt_address (default to 0x13371acc): stopping address

Example of use:
>>> jitter = machine.jitter()
>>> jitter.init_stack()
>>> linux_env = LinuxEnvironment_x86_64()
>>> argv = ["/bin/ls", "-lah"]
>>> envp = {"PATH": "/usr/local/bin", "USER": linux_env.user_name}
>>> auxv = AuxVec(elf_base_addr, entry_point, linux_env)
>>> prepare_loader_x86_64(jitter, argv, envp, auxv, linux_env)
# One may want to enable syscall handling here
# The program can now run from the loader
>>> jitter.init_run(ld_entry_point)
>>> jitter.continue_run()

Variable Documentation

◆ console_handler

miasm.os_dep.linux.environment.console_handler = logging.StreamHandler()

◆ log

miasm.os_dep.linux.environment.log = logging.getLogger("environment")

◆ REGEXP_T

miasm.os_dep.linux.environment.REGEXP_T = type(re.compile(''))

◆ StatFSInfo

miasm.os_dep.linux.environment.StatFSInfo
Initial value:
1 = namedtuple("StatFSInfo", [
2  "f_type", "f_bsize", "f_blocks", "f_bfree", "f_bavail", "f_files",
3  "f_ffree", "f_fsid", "f_namelen", "f_frsize", "f_flags", "f_spare",
4 ])

◆ StatInfo

miasm.os_dep.linux.environment.StatInfo
Initial value:
1 = namedtuple("StatInfo", [
2  "st_dev", "st_ino", "st_nlink", "st_mode", "st_uid", "st_gid", "st_rdev",
3  "st_size", "st_blksize", "st_blocks", "st_atime", "st_atimensec",
4  "st_mtime", "st_mtimensec", "st_ctime", "st_ctimensec"
5 ])