Pyasm generates runable x86 machine code and uses ctypes to execute it.
- Runtime Assembly
- Syscall interface
- callbacks to python from assembly
- many common assembly operations coded
pyasm is a python package installable by any of the following commands:
cd pyasm; python setup.py install easy_install pyasm
from pyasm import Program from pyasm.data import String from pyasm.macro import syscall from pyasm.instructions import mov, ret, push, add from pyasm.registers import eax, ebx, ecx, edx, ebp import sys def example(): msg = 'Hello World!' prog = Program( mov(ebx, 1), mov(ecx, String(msg)), mov(edx, len(msg)), syscall('write'), ret(), ) fun = prog.compile() fun() if __name__ == '__main__': example()