0

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

[0x5579ca2e2196]> afl~[0]
0x5579ca2e2060
0x5579ca2e4fe0
0x5579ca2e2090
0x5579ca2e20c0
0x5579ca2e2100

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.

2
  • 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, 2020 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, 2020 at 20:33

1 Answer 1

2

@@ 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]`

1
  • Does @@ also do a temporary seek? Why is it not px 4 @ @@=afl~[0]`? Jan 9, 2022 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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