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

Public Member Functions

def __init__ (self)
 
def next_fd (self)
 
def clock_gettime (self)
 
def open_ (self, path, flags, follow_link=True)
 
def socket (self, family, type_, protocol)
 
def fstat (self, fd)
 
def stat (self, path)
 
def lstat (self, path)
 
def close (self, fd)
 
def write (self, fd, data)
 
def read (self, fd, count)
 
def getdents (self, fd, count, packing_callback)
 
def ioctl (self, fd, cmd, arg)
 
def mmap (self, addr, len_, prot, flags, fd, off, vmmngr)
 
def brk (self, addr, vmmngr)
 

Public Attributes

 filesystem
 
 network
 
 brk_current
 

Static Public Attributes

 platform_arch = None
 
int user_uid = 1000
 
int user_euid = 1000
 
int user_gid = 1000
 
int user_egid = 1000
 
string user_name = b"user"
 
int brk_current = 0x74000000
 
int mmap_current = 0x75000000
 
string sys_sysname = b"Linux"
 
string sys_nodename = b"user-pc"
 
string sys_release = b"4.13.0-19-generic"
 
string sys_version = b"#22-Ubuntu"
 
 sys_machine = None
 
string filesystem_base = "file_sb"
 
 file_descriptors = None
 
int process_tid = 1000
 
int process_pid = 1000
 
 ioctl_allowed = None
 
 ioctl_disallowed = None
 
int base_time = 1531900000
 
 O_ACCMODE = None
 
 O_CLOEXEC = None
 
 O_DIRECTORY = None
 
 O_LARGEFILE = None
 
 O_NONBLOCK = None
 
 O_RDONLY = None
 

Detailed Description

A LinuxEnvironment regroups information to simulate a Linux-like
environment

Constructor & Destructor Documentation

◆ __init__()

def miasm.os_dep.linux.environment.LinuxEnvironment.__init__ (   self)

Member Function Documentation

◆ brk()

def miasm.os_dep.linux.environment.LinuxEnvironment.brk (   self,
  addr,
  vmmngr 
)
Stub for 'brk' syscall

◆ clock_gettime()

def miasm.os_dep.linux.environment.LinuxEnvironment.clock_gettime (   self)

◆ close()

def miasm.os_dep.linux.environment.LinuxEnvironment.close (   self,
  fd 
)
Stub for 'close' syscall

◆ fstat()

def miasm.os_dep.linux.environment.LinuxEnvironment.fstat (   self,
  fd 
)
Get file status through fd

◆ getdents()

def miasm.os_dep.linux.environment.LinuxEnvironment.getdents (   self,
  fd,
  count,
  packing_callback 
)
Stub for 'getdents' syscall

'getdents64' must be handled by caller (only the structure layout is
modified)

@fd: getdents' fd argument
@count: getdents' count argument
@packing_callback(cur_len, d_ino, d_type, name) -> entry

◆ ioctl()

def miasm.os_dep.linux.environment.LinuxEnvironment.ioctl (   self,
  fd,
  cmd,
  arg 
)
Stub for 'ioctl' syscall
Return the list of element to pack back depending on target ioctl
If the ioctl is disallowed, return False

◆ lstat()

def miasm.os_dep.linux.environment.LinuxEnvironment.lstat (   self,
  path 
)
Get file status through path (not following links)

◆ mmap()

def miasm.os_dep.linux.environment.LinuxEnvironment.mmap (   self,
  addr,
  len_,
  prot,
  flags,
  fd,
  off,
  vmmngr 
)
Stub for 'mmap' syscall

'mmap2' must be implemented by calling this function with off * 4096

◆ next_fd()

def miasm.os_dep.linux.environment.LinuxEnvironment.next_fd (   self)

◆ open_()

def miasm.os_dep.linux.environment.LinuxEnvironment.open_ (   self,
  path,
  flags,
  follow_link = True 
)
Stub for 'open' syscall

◆ read()

def miasm.os_dep.linux.environment.LinuxEnvironment.read (   self,
  fd,
  count 
)
Stub for 'read' syscall

◆ socket()

def miasm.os_dep.linux.environment.LinuxEnvironment.socket (   self,
  family,
  type_,
  protocol 
)
Stub for 'socket' syscall

◆ stat()

def miasm.os_dep.linux.environment.LinuxEnvironment.stat (   self,
  path 
)
Get file status through path

◆ write()

def miasm.os_dep.linux.environment.LinuxEnvironment.write (   self,
  fd,
  data 
)
Stub for 'write' syscall

Member Data Documentation

◆ base_time

int miasm.os_dep.linux.environment.LinuxEnvironment.base_time = 1531900000
static

◆ brk_current [1/2]

int miasm.os_dep.linux.environment.LinuxEnvironment.brk_current = 0x74000000
static

◆ brk_current [2/2]

miasm.os_dep.linux.environment.LinuxEnvironment.brk_current

◆ file_descriptors

miasm.os_dep.linux.environment.LinuxEnvironment.file_descriptors = None
static

◆ filesystem

miasm.os_dep.linux.environment.LinuxEnvironment.filesystem

◆ filesystem_base

string miasm.os_dep.linux.environment.LinuxEnvironment.filesystem_base = "file_sb"
static

◆ ioctl_allowed

miasm.os_dep.linux.environment.LinuxEnvironment.ioctl_allowed = None
static

◆ ioctl_disallowed

miasm.os_dep.linux.environment.LinuxEnvironment.ioctl_disallowed = None
static

◆ mmap_current

int miasm.os_dep.linux.environment.LinuxEnvironment.mmap_current = 0x75000000
static

◆ network

miasm.os_dep.linux.environment.LinuxEnvironment.network

◆ O_ACCMODE

miasm.os_dep.linux.environment.LinuxEnvironment.O_ACCMODE = None
static

◆ O_CLOEXEC

miasm.os_dep.linux.environment.LinuxEnvironment.O_CLOEXEC = None
static

◆ O_DIRECTORY

miasm.os_dep.linux.environment.LinuxEnvironment.O_DIRECTORY = None
static

◆ O_LARGEFILE

miasm.os_dep.linux.environment.LinuxEnvironment.O_LARGEFILE = None
static

◆ O_NONBLOCK

miasm.os_dep.linux.environment.LinuxEnvironment.O_NONBLOCK = None
static

◆ O_RDONLY

miasm.os_dep.linux.environment.LinuxEnvironment.O_RDONLY = None
static

◆ platform_arch

miasm.os_dep.linux.environment.LinuxEnvironment.platform_arch = None
static

◆ process_pid

int miasm.os_dep.linux.environment.LinuxEnvironment.process_pid = 1000
static

◆ process_tid

int miasm.os_dep.linux.environment.LinuxEnvironment.process_tid = 1000
static

◆ sys_machine

miasm.os_dep.linux.environment.LinuxEnvironment.sys_machine = None
static

◆ sys_nodename

string miasm.os_dep.linux.environment.LinuxEnvironment.sys_nodename = b"user-pc"
static

◆ sys_release

string miasm.os_dep.linux.environment.LinuxEnvironment.sys_release = b"4.13.0-19-generic"
static

◆ sys_sysname

string miasm.os_dep.linux.environment.LinuxEnvironment.sys_sysname = b"Linux"
static

◆ sys_version

string miasm.os_dep.linux.environment.LinuxEnvironment.sys_version = b"#22-Ubuntu"
static

◆ user_egid

int miasm.os_dep.linux.environment.LinuxEnvironment.user_egid = 1000
static

◆ user_euid

int miasm.os_dep.linux.environment.LinuxEnvironment.user_euid = 1000
static

◆ user_gid

int miasm.os_dep.linux.environment.LinuxEnvironment.user_gid = 1000
static

◆ user_name

string miasm.os_dep.linux.environment.LinuxEnvironment.user_name = b"user"
static

◆ user_uid

int miasm.os_dep.linux.environment.LinuxEnvironment.user_uid = 1000
static

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