4

I want to use pwntools with Radare2, since this is my debugger of choice.

However, I can only find GDB-related library calls in pwntools' documentation (pwnlib.gdb).

Anyone with experience in integration Radare2 with pwntools?

1 Answer 1

1

There is no integrated way to debug using radare2, but there is 2 workarounds :

1. Tell the script to wait for a debbuger

You can use util.proc.wait_for_debugger start the process when a debugger is connected.

Exploit script :

io = process('my_binary')
pid = util.proc.pidof(io)[0]
print("The pid is " + str(pid))
util.proc.wait_for_debugger(pid)

Launch Radare2:

r2 -A -d pid

See here for an example : https://ret2libc.com/article/19/pwntools-radare2-debugger

2. Use pwndbg

Radare2 can be called from pwndbg. It's possible to use the gdb integration in pwntools, and the use the command r2 to switch to radare.

enter image description here

https://github.com/pwndbg/pwndbg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.