When running gdb cmd
I can manually stop cmd
via Ctrl-C. This invokes the debugger and lets me inspect memory.
In pwntools, I can attach gdb, and can manually stop the process by hitting Ctrl-C in the gdb window. I'd like to be able to do this programatically from pwntools script: something like:
if output != expected:
io.gdb.ctrlc() # break, let me use gdb
This doesn't necessarily require a pwntools answer. GDB has a powerful Python API, but I can't find in it the equivalent of a "Interrupt the process, as if someone hit Ctrl-C". Is there a way to do that, either via the GDB Python API or via a pwntools method?