An unusual question...

sturlamolden sturlamolden at
Sun Apr 17 18:13:55 CEST 2011

On Apr 17, 2:15 pm, <wisecrac... at> wrote:

> I can also find out where it is EXACTLY just as
> easily so this is not my problem.
> The problem is calling it!

You'll need to mmap or valloc a page-alligned memory
buffer (for which the size must be a multiple of the system
page size), and call mprotect to make it executable.
Copy your binary code into this buffer. Then you will
need to do some magic with ctypes, Cython or C to call
it; i.e. cast or memcpy the address of the excutable buffer
into a function pointer, and dereference/call the function
pointer. If that sounds gibberish, see Steven's comment
about heart transplants.


More information about the Python-list mailing list