2

I'm using radare2 in a loop that looks similar to this:

for item in `r2 -c "aaaa" -c "afl" -qq 67b79382375cc5169d869dccca033be3786aa06a71b9bc1245cd4b935a603dc2.bin | grep -Eo "fcn.*"`; do r2 -c "e scr.color=0" -c "aaaa" -c "s $item" -c "pdf" -qq 67b79382375cc5169d869dccca033be3786aa06a71b9bc1245cd4b935a603dc2.bin >> results.asm; done

What I need to do is get the output from this:

┌ 8: fcn.00401000 (int32_t arg_8h);
│           ; arg int32_t arg_8h @ ebp+0x8
│           0x00401000      55             push ebp                    ; [00] -r-x section size 4096 named .text
│           0x00401001      8bec           mov ebp, esp
│           0x00401003      ff5508         call dword [arg_8h]         ; 8
│           0x00401006      5d             pop ebp
└           0x00401007      c3             ret

To just look like this:

; 8: fcn.00401000 (int32_t arg_8h);
; arg int32_t arg_8h @ ebp+0x8
push ebp                    ; [00] -r-x section size 4096 named .text
mov ebp, esp
call dword [arg_8h]         ; 8
pop ebp
ret

IS this possible?

1 Answer 1

1

You can use pif:

Output for main() using pif:

[0x00001060]> pif @ main
endbr64
push rbp
mov rbp, rsp
lea rdi, str.hello
call sym.imp.puts
mov eax, 0
pop rbp
ret

Output for main() using pdf:

[0x00001060]> pdf @ main
            ; DATA XREF from entry0 @ 0x1081(r)
┌ 27: int main (int argc, char **argv, char **envp);
│           0x00001149      f30f1efa       endbr64
│           0x0000114d      55             push rbp
│           0x0000114e      4889e5         mov rbp, rsp
│           0x00001151      488d3dac0e00.  lea rdi, str.hello          ; 0x2004 ; "hello" ; const char *s
│           0x00001158      e8f3feffff     call sym.imp.puts           ; int puts(const char *s)
│           0x0000115d      b800000000     mov eax, 0
│           0x00001162      5d             pop rbp
└           0x00001163      c3             ret

Your Answer

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

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