I have found the command r2 -c 'pi $s'
to dump a binary with radare2. I have tried this redirecting the output to a file: r2 -c 'pi $s' binary > dump.txt
. The dump is created but radare2 gets unresponsive. Is this a bug, or am I doing something wrong?
2 Answers
This is because you're not passing the -q
flag to radare2:
$ r2 -h | grep -- -q
-q quiet mode (no prompt) and quit after -i
The -c
flag will execute a command in radare2, and then land you in the radare shell, but since you're redirecting stdout
to a file, you can't see this. But if you hit q
(as in q
uit) and Enter, radare2 will exit.
This is the command that you should use: r2 -q -c 'pi $s' ./a.out > out.txt
if you want radare2 to dump the entire binary, then exit.
I would suggest you tried working with OllyDbg and WINE. Kali linux has this combo pre-installed in its toolbox. It works fine in many platforms (ubuntu, open-suse, etc).