#! /usr/bin/env python2 """This script is just a short example of common usages for miasm2.core.types. For a more complete view of what is possible, tests/core/types.py covers most of the module possibilities, and the module doc gives useful information as well. """ from miasm2.analysis.machine import Machine from miasm2.core.types import MemStruct, Self, Void, Str, Array, Ptr, \ Num, Array, set_allocator from miasm2.os_dep.common import heap # Instantiate a heap my_heap = heap() # And set it as the default memory allocator, to avoid manual allocation and # explicit address passing to the MemType subclasses (like MemStruct) # constructor set_allocator(my_heap.vm_alloc) # Let's reimplement a simple C generic linked list mapped on a VmMngr. # All the structures and methods will use the python objects but all the data # is in fact stored in the VmMngr class ListNode(MemStruct): fields = [ # The "