# `pwnlib.runner` — Running Shellcode

pwnlib.runner.run_assembly(assembly)

  Given an assembly listing, assemble and execute it.

  Returns:

    A `pwnlib.tubes.process.process` tube to interact with the process.

  Example

      >>> p = run_assembly('mov ebx, 3; mov eax, SYS_exit; int 0x80;')
      >>> p.wait_for_close()
      >>> p.poll()
      3

      >>> p = run_assembly('mov r0, #12; mov r7, #1; svc #0', arch='arm')
      >>> p.wait_for_close()
      >>> p.poll()
      12

pwnlib.runner.run_assembly_exitcode(assembly)

  Given an assembly listing, assemble and execute it, and wait for the process to die.

  Returns:

    The exit code of the process.

  Example

      >>> run_assembly_exitcode('mov ebx, 3; mov eax, SYS_exit; int 0x80;')
      3

pwnlib.runner.run_shellcode(bytes, **kw)

  Given assembled machine code bytes, execute them.

  Example

      >>> insn_bytes = asm('mov ebx, 3; mov eax, SYS_exit; int 0x80;')
      >>> p = run_shellcode(insn_bytes)
      >>> p.wait_for_close()
      >>> p.poll()
      3

      >>> insn_bytes = asm('mov r0, #12; mov r7, #1; svc #0', arch='arm')
      >>> p = run_shellcode(insn_bytes, arch='arm')
      >>> p.wait_for_close()
      >>> p.poll()
      12

pwnlib.runner.run_shellcode_exitcode(bytes)

  Given assembled machine code bytes, execute them, and wait for the process to die.

  Returns:

    The exit code of the process.

  Example

      >>> insn_bytes = asm('mov ebx, 3; mov eax, SYS_exit; int 0x80;')
      >>> run_shellcode_exitcode(insn_bytes)
      3