I want to continue the python script do things, when the program crashes/exits. But it does not work. For example:
from pwn import *
p = process("./proc")
p.interactive()
<do stuff and exit>
print("Some stuff")
But when the progam proc
exits/crashes, the part below p.interactive()
is not executed. Can someone help?
you should use a "try except" which allows you to run code in the try part, and once the program crashes it moves on to the except. read more here.
an example:
try:
print(x)
except NameError:
print("Variable x is not defined")
except:
print("Something else went wrong")