Codepage

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.

write(data)

Fill page with the given data

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

Container for machine code

class ppci.utils.codepage.WinPage(size)

Nice windows hack to emulate mmap.

Copied from: https://github.com/campagnola/pycca/blob/master/pycca/asm/codepage.py

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.

Parameters:
  • 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.