#!/usr/bin/env python """This script is just a short example of common usages for miasm2.analysis.mem. For a more complete view of what is possible, tests/analysis/mem.py covers most of the module possibilities, and the module doc gives useful information as well. """ from miasm2.analysis.machine import Machine from miasm2.analysis.mem import PinnedStruct, Self, Void, Str, Array, Ptr, \ Num, Array, set_allocator from miasm2.os_dep.common import heap # Instanciate a heap my_heap = heap() # And set it as the default memory allocator, to avoid manual allocation and # explicit address passing to the PinnedStruct 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(PinnedStruct): fields = [ # The "