5

I'm debugging a file with radare2 and when I come to scanf function I want to forward input from a .txt file. In gdb I would do this by typing r < text.txt.

Is something like that possible in radare2? I've tried dc < text.txt but it seems that it's not working.

jvoisin
  • 2,516
  • 16
  • 23
newbie
  • 139
  • 2
  • 9

2 Answers2

11

Always ensure you use radare2 git version.

For that purpose you can use rarun2:

For stdio check what is the tty using tty for stdin just add what file you want to add, then in your rarun2 config file:

#!/usr/bin/rarun2
stdio=/dev/pts/1
stdin=./pattern.txt

Then just r2 -d /bin/ls -e dbg.profile=bla.rr2

Maijin
  • 880
  • 5
  • 14
1

I don't have enough reputation to comment maijin answer, but due to that answer(r2 issue #9788) passing params after -d flag can get side effects.

... don't pass flags after -d or may be taken as args of the program in some systems.

slinkin
  • 144
  • 3