Cool idea to load actual object code into memory and execute it from python using ctypes

Credits for idea: Luke Campagnola

class ppci.utils.codepage.MemoryPage(size)

Allocate a memory slab in the current process.


Fill page with the given data

class ppci.utils.codepage.Mod(obj, imports=None)

Container for machine code


Get the memory address of a symbol

class ppci.utils.codepage.WinPage(size)

Nice windows hack to emulate mmap.

Copied from:

ppci.utils.codepage.load_code_as_module(source_file, reporter=None)

Load c3 code as a module

ppci.utils.codepage.load_obj(obj, imports=None)

Load an object into memory.

  • obj – the code object to load.
  • imports – A dictionary of functions to attach.

Optionally a dictionary of functions that must be imported can be provided.