3

With Radare2, I love the iI command.

I want to limit the output with grep or radare's own grep syntax.

How do I run a iI | grep -E 'bits | pic | stripped' against my binary?

[0x100001200]> iI
arch     x86
binsz    38688
bintype  mach0
bits     64
....
..
.

My intention is to run this command inside a python script using r2pipe.

5

Radare's grep is done by using the ~ character.

 ~?<br>
|Usage: [command]~[modifier][word,word][endmodifier][[column]][:line]

So to have the output you want just run:

iI~bits,pic,stripped

[0x100001200]> iI~bits,pic,stripped
bits     64
pic      true
stripped true

The same command you should run in your script. There's a lot of more that this grep can do. To get the help of it just run the ~?

  • Thanks. Just what I was looking for. Next I will try and work out why the json flag + grep instruction doesn't work with: iIj~bits,pic,stripped. But I can do that solo. Thanks again. – rustyMagnet Jul 25 '18 at 7:17
  • 1
    json supports a limited grep in a form: iIj~{bits} but you would have to grep for the three things separately. – Paweł Łukasik Jul 25 '18 at 14:59
  • That actually gives me a better answer. I can now use iIj~{stripped} as it return the value (true / false) instead of the Key Value Pair you get with iI~stripped (stripped true) – rustyMagnet Jul 26 '18 at 6:41

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.