Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Classes | Functions | Variables
miasm2.os_dep.common Namespace Reference

Classes

class  heap
 

Functions

def get_str_ansi
 
def get_str_unic
 
def set_str_ansi
 
def set_str_unic
 
def windows_to_sbpath
 
def unix_to_sbpath
 

Variables

string BASE_SB_PATH = "file_sb"
 

Function Documentation

def miasm2.os_dep.common.get_str_ansi (   jitter,
  ad_str,
  max_char = None 
)

Definition at line 8 of file common.py.

8 
9 def get_str_ansi(jitter, ad_str, max_char=None):
10  l = 0
11  tmp = ad_str
12  while ((max_char is None or l < max_char) and
13  jitter.vm.get_mem(tmp, 1) != "\x00"):
14  tmp += 1
15  l += 1
16  return jitter.vm.get_mem(ad_str, l)
17 

+ Here is the caller graph for this function:

def miasm2.os_dep.common.get_str_unic (   jitter,
  ad_str,
  max_char = None 
)

Definition at line 18 of file common.py.

18 
19 def get_str_unic(jitter, ad_str, max_char=None):
20  l = 0
21  tmp = ad_str
22  while ((max_char is None or l < max_char) and
23  jitter.vm.get_mem(tmp, 2) != "\x00\x00"):
24  tmp += 2
25  l += 2
26  s = jitter.vm.get_mem(ad_str, l)
27  # TODO: real unicode decoding
28  s = s[::2]
29  return s
30 

+ Here is the caller graph for this function:

def miasm2.os_dep.common.set_str_ansi (   s)

Definition at line 31 of file common.py.

31 
32 def set_str_ansi(s):
33  return s + "\x00"
34 
def miasm2.os_dep.common.set_str_unic (   s)

Definition at line 35 of file common.py.

35 
36 def set_str_unic(s):
37  # TODO: real unicode encoding
38  return "\x00".join(list(s)) + '\x00' * 3
39 

+ Here is the caller graph for this function:

def miasm2.os_dep.common.unix_to_sbpath (   path)
Convert a POSIX path to a valid filename within the sandbox
base directory.

Definition at line 78 of file common.py.

78 
79 def unix_to_sbpath(path):
80  """Convert a POSIX path to a valid filename within the sandbox
81  base directory.
82 
83  """
84  path = [elt for elt in path.split('/') if elt]
85  return os.path.join(BASE_SB_PATH, *path)
def miasm2.os_dep.common.windows_to_sbpath (   path)
Convert a Windows path to a valid filename within the sandbox
base directory.

Definition at line 69 of file common.py.

69 
70 def windows_to_sbpath(path):
71  """Convert a Windows path to a valid filename within the sandbox
72  base directory.
73 
74  """
75  path = [elt for elt in path.lower().replace('/', '_').split('\\') if elt]
76  return os.path.join(BASE_SB_PATH, *path)
77 

+ Here is the caller graph for this function:

Variable Documentation

string miasm2.os_dep.common.BASE_SB_PATH = "file_sb"

Definition at line 5 of file common.py.