Say, I have a command in radare which produces multiple input, say afl. I can run it and extract many addresses:

[0x5579ca2e2196]> afl~[0]

How do I do run another command on each of those addresses? Let's say I want to print first byte of each of them or set a breakpoint with db on each address.

I read about iteration, but it looks like it only works on flags with something like sym.*, but not on arbitrary outputs, so I can't do this:

p8 1 @@ `some command which produces many addresses`

I know that I can save output to a file and then use something like p8 1 @@.my_file, but it looks strange that I need to create a file for that.

Basically, I want a way to run a single radare command (possibly with parameters) for every line of output of another radare command.

  • Sounds like a job for xargs if for some reason that doesn't work, a bash while loop and if that doesn't work, python... Sep 10 '20 at 19:59
  • Well, of course it's trivial to do in bash or python, I am interested in native radare solution. It's a shame to pass text to bash/python and back (and takes a lot of typing): just typing 'while' is already longer than most of radare commands :) Sep 10 '20 at 20:33

@@ is indeed for flags [not only those that are prefixed with sym. though]. It looks like you need to use the @@= iterator.

For example: px 4 @@=`afl~[0]`

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.