mirror of
https://github.com/radareorg/radare2-r2pipe.git
synced 2026-11-08 09:39:32 -10:00
21 lines
411 B
Python
21 lines
411 B
Python
#!/usr/bin/env python3
|
|
|
|
import r2pipe
|
|
import sys
|
|
|
|
r = r2pipe.open("/bin/ls")
|
|
try:
|
|
print("r2 version: %s" % r.cmd("?V"))
|
|
pid = int(r.cmd("?vi $p"))
|
|
print("Killing r2 PID %d" % (pid))
|
|
r.cmd('"!(sleep 1; kill -9 %d) &"' % pid)
|
|
r.cmd("!sleep 3")
|
|
print(r.cmd("x"))
|
|
r.cmd("q")
|
|
print("This was not expected!")
|
|
except:
|
|
print("r2 was killed as expected")
|
|
sys.exit(0)
|
|
|
|
sys.exit(1)
|