Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Public Member Functions | Public Attributes | List of all members
miasm2.jitter.loader.elf.libimp_elf Class Reference
+ Inheritance diagram for miasm2.jitter.loader.elf.libimp_elf:
+ Collaboration diagram for miasm2.jitter.loader.elf.libimp_elf:

Public Member Functions

def lib_get_add_base
 
def lib_get_add_func
 
def check_dst_ad
 

Public Attributes

 name2off
 
 libbase2lastad
 
 libbase_ad
 
 lib_imp2ad
 
 lib_imp2dstad
 
 fad2cname
 
 fad2info
 
 all_exported_lib
 

Detailed Description

Definition at line 81 of file elf.py.

Member Function Documentation

def miasm2.jitter.loader.utils.libimp.check_dst_ad (   self)
inherited

Definition at line 76 of file utils.py.

76 
77  def check_dst_ad(self):
78  for ad in self.lib_imp2dstad:
79  all_ads = self.lib_imp2dstad[ad].values()
80  all_ads.sort()
81  for i, x in enumerate(all_ads[:-1]):
82  if x is None or all_ads[i + 1] is None:
83  return False
84  if x + 4 != all_ads[i + 1]:
85  return False
86  return True
87 
88 
def miasm2.jitter.loader.utils.libimp.lib_get_add_base (   self,
  name 
)
inherited

Definition at line 30 of file utils.py.

30 
31  def lib_get_add_base(self, name):
32  name = name.lower().strip(' ')
33  if not "." in name:
34  log.debug('warning adding .dll to modulename')
35  name += '.dll'
36  log.debug(name)
37 
38  if name in self.name2off:
39  ad = self.name2off[name]
40  else:
41  ad = self.libbase_ad
42  log.debug('new lib %s 0x%x', name, ad)
43  self.name2off[name] = ad
44  self.libbase2lastad[ad] = ad + 0x1
45  self.lib_imp2ad[ad] = {}
46  self.lib_imp2dstad[ad] = {}
47  self.libbase_ad += 0x1000
48  return ad
def miasm2.jitter.loader.utils.libimp.lib_get_add_func (   self,
  libad,
  imp_ord_or_name,
  dst_ad = None 
)
inherited

Definition at line 49 of file utils.py.

49 
50  def lib_get_add_func(self, libad, imp_ord_or_name, dst_ad=None):
51  if not libad in self.name2off.values():
52  raise ValueError('unknown lib base!', hex(libad))
53 
54  # test if not ordinatl
55  # if imp_ord_or_name >0x10000:
56  # imp_ord_or_name = vm_get_str(imp_ord_or_name, 0x100)
57  # imp_ord_or_name = imp_ord_or_name[:imp_ord_or_name.find('\x00')]
58 
59  #/!\ can have multiple dst ad
60  if not imp_ord_or_name in self.lib_imp2dstad[libad]:
61  self.lib_imp2dstad[libad][imp_ord_or_name] = set()
62  self.lib_imp2dstad[libad][imp_ord_or_name].add(dst_ad)
63 
64  if imp_ord_or_name in self.lib_imp2ad[libad]:
65  return self.lib_imp2ad[libad][imp_ord_or_name]
66  # log.debug('new imp %s %s' % (imp_ord_or_name, dst_ad))
67  ad = self.libbase2lastad[libad]
68  self.libbase2lastad[libad] += 0x11 # arbitrary
69  self.lib_imp2ad[libad][imp_ord_or_name] = ad
70 
71  name_inv = dict([(x[1], x[0]) for x in self.name2off.items()])
72  c_name = canon_libname_libfunc(name_inv[libad], imp_ord_or_name)
73  self.fad2cname[ad] = c_name
74  self.fad2info[ad] = libad, imp_ord_or_name
75  return ad

+ Here is the call graph for this function:

Member Data Documentation

miasm2.jitter.loader.utils.libimp.all_exported_lib
inherited

Definition at line 28 of file utils.py.

miasm2.jitter.loader.utils.libimp.fad2cname
inherited

Definition at line 26 of file utils.py.

miasm2.jitter.loader.utils.libimp.fad2info
inherited

Definition at line 27 of file utils.py.

miasm2.jitter.loader.utils.libimp.lib_imp2ad
inherited

Definition at line 24 of file utils.py.

miasm2.jitter.loader.utils.libimp.lib_imp2dstad
inherited

Definition at line 25 of file utils.py.

miasm2.jitter.loader.utils.libimp.libbase2lastad
inherited

Definition at line 22 of file utils.py.

miasm2.jitter.loader.utils.libimp.libbase_ad
inherited

Definition at line 23 of file utils.py.

miasm2.jitter.loader.utils.libimp.name2off
inherited

Definition at line 21 of file utils.py.


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