radare2 CLI analysis
When it applies
You need fast, scriptable analysis of an in-scope binary (scope.txt / client-owned / your own sample —
tradecraft-scope-roe) from a terminal: first-pass recon before opening a heavyweight decompiler,
CI/SSH environments with no GUI, quick patches and diffs, or r2 automation. When you need
pseudocode-grade reading, hand off to reverse-eng-ida or reverse-eng-ghidra — r2's job is speed
and scriptability, not decompilation. For obfuscated JavaScript, that's reverse-eng-deobfuscation,
not this skill.
Why it works
Every r2 operation is a composable command — the same one-liners work interactively, in batch
(-c "..."), over HTTP, or via r2pipe from any language — so recon that costs minutes in a GUI costs
seconds here, and every step is reproducible by construction.
Method
- Check the install, don't assume it:
r2 -v/rabin2 -v. On Windows the binaries are
radare2.exe, rabin2.exe, rasm2.exe, radiff2.exe, rahash2.exe, rax2.exe, r2pm.exe.
- Recon before analysis. Minimum first pass:
```
rabin2 -I sample.exe # format, arch, bits, entry point
rabin2 -z sample.exe # strings
rabin2 -i sample.exe # imports (required — never skip to function-level work without it)
rabin2 -E sample.exe # exports (required too for DLL/SYS)
```
Classify the imports (network / file / crypto / injection / registry) in your notes. An empty or
"too clean" import table means likely dynamic loading — plan to catch APIs at runtime instead of
concluding statically. No traditional IAT (.NET) → use IL/metadata inspection as the equivalent.
Packed sample: repair the IAT (ImportREC on x86, Scylla on x64); if repair fails, go dynamic rather
than grinding on a broken static view.
- Interact only after recon.
r2 sample.exe, thenaaa(not the heavieraaaa),aflto list
functions, iz strings, s entry0 / pdf to disassemble a function, VV for graph view.
- Locate the key logic:
afl~main,iz~http, thenaxt <addr>to find who references a string
or address, s <addr> + pdf to read it. Full command reference: