#! /usr/bin/env python2 """This script is just a short example of common usages for miasm.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 __future__ import print_function from miasm.core.utils import iterbytes from miasm.analysis.machine import Machine from miasm.core.types import MemStruct, Self, Void, Str, Array, Ptr, \ Num, Array, set_allocator from miasm.os_dep.common import heap from miasm.core.locationdb import LocationDB loc_db = LocationDB() # 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 "