MCPcopy
hub / github.com/Gallopsled/pwntools / run_shellcode_exitcode

Function run_shellcode_exitcode

pwnlib/runner.py:93–110  ·  view source on GitHub ↗

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

(bytes)

Source from the content-addressed store, hash-verified

91
92@LocalContext
93def run_shellcode_exitcode(bytes):
94 """
95 Given assembled machine code bytes, execute them, and wait for
96 the process to die.
97
98 Returns:
99
100 The exit code of the process.
101
102 Example:
103
104 >>> insn_bytes = asm('mov ebx, 3; mov eax, SYS_exit; int 0x80;')
105 >>> run_shellcode_exitcode(insn_bytes)
106 3
107 """
108 p = run_shellcode(bytes)
109 p.wait_for_close()
110 return p.poll()

Callers

nothing calls this directly

Calls 3

run_shellcodeFunction · 0.85
wait_for_closeMethod · 0.80
pollMethod · 0.45

Tested by

no test coverage detected