miasm
Reverse engineering framework
miasm.core.types.Array Class Reference
Inheritance diagram for miasm.core.types.Array:
Collaboration diagram for miasm.core.types.Array:

Public Member Functions

def __init__ (self, field_type, array_len=None)
 
def set (self, vm, addr, val)
 
def get (self, vm, addr)
 
def size (self)
 
def get_offset (self, idx)
 
def get_item (self, vm, addr, idx)
 
def set_item (self, vm, addr, idx, item)
 
def is_sized (self)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __hash__ (self)
 
- Public Member Functions inherited from miasm.core.types.Type
def lval (self)
 
def __len__ (self)
 
def __neq__ (self, other)
 

Public Attributes

 field_type
 
 array_len
 

Detailed Description

An array (contiguous sequence) of a Type subclass elements.

Can be sized (similar to something like the char[10] type in C) or unsized
if no @array_len is given to the constructor (similar to char* used as an
array).

Mapped to MemArray or MemSizedArray, depending on if the Array is
sized or not.

Getting an array field actually returns a MemSizedArray. Setting it is
possible with either a list or a MemSizedArray instance. Examples of
syntax:

    class Example(MemStruct):
        fields = [("array", Array(Num("B"), 4))]

    mystruct = Example(vm, addr)
    mystruct.array[3] = 27
    mystruct.array = [1, 4, 8, 9]
    mystruct.array = MemSizedArray(vm, addr2, Num("B"), 4)

Constructor & Destructor Documentation

◆ __init__()

def miasm.core.types.Array.__init__ (   self,
  field_type,
  array_len = None 
)

Member Function Documentation

◆ __eq__()

def miasm.core.types.Array.__eq__ (   self,
  other 
)

Reimplemented from miasm.core.types.Type.

Here is the caller graph for this function:

◆ __hash__()

def miasm.core.types.Array.__hash__ (   self)

◆ __ne__()

def miasm.core.types.Array.__ne__ (   self,
  other 
)

Reimplemented from miasm.core.types.Type.

◆ __repr__()

def miasm.core.types.Array.__repr__ (   self)

◆ get()

def miasm.core.types.Array.get (   self,
  vm,
  addr 
)
Get the python value of a field from a VmMngr memory at @addr.

Reimplemented from miasm.core.types.Type.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_item()

def miasm.core.types.Array.get_item (   self,
  vm,
  addr,
  idx 
)
Get the item(s) at index @idx.

@idx: int, long or slice
Here is the call graph for this function:

◆ get_offset()

def miasm.core.types.Array.get_offset (   self,
  idx 
)
Returns the offset of the item at index @idx.
Here is the caller graph for this function:

◆ is_sized()

def miasm.core.types.Array.is_sized (   self)
True if this is a sized array (non None self.array_len), False
otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set()

def miasm.core.types.Array.set (   self,
  vm,
  addr,
  val 
)
Set a VmMngr memory from a value.

@vm: VmMngr instance
@addr: the start address in memory to set
@val: the python value to serialize in @vm at @addr

Reimplemented from miasm.core.types.Type.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_item()

def miasm.core.types.Array.set_item (   self,
  vm,
  addr,
  idx,
  item 
)
Sets one or multiple items in this array (@idx can be an int, long
or slice).
Here is the call graph for this function:

◆ size()

def miasm.core.types.Array.size (   self)
Return the size in bytes of the serialized version of this field

Reimplemented from miasm.core.types.Type.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ array_len

miasm.core.types.Array.array_len

◆ field_type

miasm.core.types.Array.field_type

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