def run_shellcode(bytes, **kw): """Given assembled machine code bytes, execute them. Example: >>> bytes = asm('mov ebx, 3; mov eax, SYS_exit; int 0x80;') >>> p = run_shellcode(bytes) >>> p.wait_for_close() >>> p.poll() 3 >>> bytes = asm('mov r0, #12; mov r7, #1; svc #0', arch='arm') >>> p = run_shellcode(bytes, arch='arm') >>> p.wait_for_close() >>> p.poll() 12 """ return ELF.from_bytes(bytes, **kw).process()
def from_blob(blob, *a, **kw): return ROP(ELF.from_bytes(blob, *a, **kw))