Tools

Advanced RE Toolkit (4/5): radare2 and Rizin — command-line reverse engineering and automation with r2pipe

TL;DR

radare2 and its 2020 fork Rizin are open-source reversing frameworks that run in the terminal, with GUIs (iaito, Cutter) and Ghidra's decompiler via the pdg command. Commands are learned by first letter (a = analyze, p = print, i = info) plus the ~, j and @ operators. The real power is r2pipe/rz-pipe: drive them from Python, get JSON back and triage hundreds of files in CI.

On this page

Ghidra and IDA are powerful, but both are heavy GUI applications. When all you have is an SSH session on a server, you are inside a container, or you need to analyse 500 sample files in a CI pipeline, a scriptable command-line tool fits better. That is where radare2 (r2 for short) and its fork Rizin come in: two open-source reverse engineering frameworks that run from the terminal, each with its own GUI, a decompiler, and a library for driving it from Python.

This post covers both ecosystems, the story of the fork, a cheat sheet of commands you can remember by their first letters, a walkthrough that finds the key in the familiar keycheck binary from the fundamentals post (1/5), and an r2pipe script for triaging files in bulk.

Tool map

radare2C core · r2, rabin2, rasm2, radiff2…Rizinforked 8 Dec 2020 · rz-bin, rz-asm, rz-diff…forkradare2 (radareorg)Rizin (rizinorg)iaitoofficial Qt GUIr2ghidradecompiler · pdg commandr2pipescripting: Python, Node…r2pmplugin managerCutterQt GUI + Python pluginsrz-ghidradecompiler · pdg commandrz-pipescripting: Python, Go…rz-pmplugin managerSame roots, so the basic commands (aaa, afl, pdf, iz, axt…) match; the differences grow over time.
radare2 and Rizin share their roots; each has its own GUI, Ghidra-based decompiler, scripting library and plugin manager.
ToolRoleUse it when
radare2CLI framework: analysis, disassembly, debugging, hex editing, binary patchingYou need very broad architecture/format support and many plugins (r2frida, r2ai…)
RizinA radare2 fork focused on stability and usabilityYou want Cutter, or a more stable API between releases
iaito / CutterQt graphical interfaces for r2 / RizinYou want control-flow graphs and a visual workflow
r2ghidra / rz-ghidraEmbeds Ghidra's decompiler, the pdg commandYou'd rather read C-like pseudocode than assembly
r2pipe / rz-pipeSend commands and get JSON back from Python, Node, Go, Rust…Automating, processing many files

radare2: a reversing framework for terminal lovers

According to its README, radare started as a command-line hex editor for forensics. Today's r2 is a set of libraries, tools and plugins: analysis, emulation, local or remote debugging via gdb/windbg, and patching and disassembling binaries for a huge range of architectures (x86, ARM, MIPS, RISC-V, AVR, WebAssembly, Dalvik…). Besides the main r2 command there are standalone tools such as rabin2 (file info), rasm2 (assembler) and radiff2 (binary diffing).

GitHub page of radareorg/radare2
radareorg/radare2 on GitHub (captured 11/2026)

GitHub: https://github.com/radareorg/radare2 · about 25k stars · C · LGPLv3 (individual plugins may have their own licenses)

To install, grab a prebuilt package from Releases (the latest at the time of writing is 6.2.6, from 5 November 2026), or build from git, which is the method the README recommends:

git clone https://github.com/radareorg/radare2
radare2/sys/install.sh

# Plugins come through r2pm
r2pm -U              # update the package list
r2pm -ci r2ghidra    # install the Ghidra decompiler
r2pm -s frida        # search packages by keyword

Note: r2 releases very often and the master branch moves constantly. Pin a specific version in CI. If you redistribute r2 inside a product, run r2 -Lj to see each plugin's license.

Rizin: the fork from radare2

On 8 December 2020, a group of radare2 core developers and the entire Cutter team announced Rizin. In the announcement they said the radare2 environment had left many of them feeling stressed and unwelcome, so they decided to go their own way: prioritising usability and stability, adding tests, cleaning up the API and removing redundant features. That is the Rizin side's account. radare2 continues to be actively developed in parallel.

GitHub page of rizinorg/rizin
rizinorg/rizin on GitHub (captured 11/2026)

GitHub: https://github.com/rizinorg/rizin · about 4.2k stars · C · LGPL-3.0

Rizin builds with Meson (the latest release at the time of writing is v0.9.1, from June 2026), or you can follow the instructions on rizin.re. The standalone tools are renamed with an rz- prefix: rz-bin, rz-asm, rz-diff, rz-hash, rz-find.

git clone https://github.com/rizinorg/rizin
cd rizin
meson setup build
meson compile -C build
sudo meson install -C build

Which one? Every basic command in this post exists in both (checked against the command descriptions in both projects' source code). radare2 has more community plugins and extremely broad architecture support. Rizin suits you if you want Cutter or an API that changes less. For beginners, picking the GUI you like is reason enough.

GUIs: iaito and Cutter

  • iaito is radare2's official Qt GUI. Its README notes that “iaito” was the project's original name before it was forked as Cutter. Install it with Flatpak (flatpak install flathub org.radare.iaito) or from Releases.
  • Cutter (about 20k stars, GPL-3.0) runs on Rizin and supports Python and C++ plugins, including the rz-ghidra decompiler plugin. Install it on macOS with brew install --cask cutter, on Windows with choco install cutter, or on Linux as an AppImage. Cutter was mentioned in RE Toolkit (2/5).

Cheat sheet: learn by first letter

r2 commands look cryptic until you notice that each letter is a verb: a = analyze, p = print, i = info, s = seek. Append ? to any command for help, for example afl?.

CommandRead asWhat it does
aaaanalyze all (deep)Analyses functions, references and calls. Same as opening with r2 -A
aflanalyze function listLists the functions found
s sym.mainseekJumps to an address or name
pdfprint disassembly functionPrints the whole current function's assembly
iz / izzinfo stringsStrings in data sections / in the whole file
iiinfo importsFunctions imported from external libraries
axtxrefs toWho references this address
px 32print hexHexdump of 32 bytes
VVvisual graphThe function's block graph, right in the terminal
pdgdecompile (Ghidra)C pseudocode; needs r2ghidra or rz-ghidra

Three “operators” work with every command: ~ is an internal grep (afl~main), a j suffix returns JSON (aflj), and @ runs a command at another address without moving the cursor (pdf @ sym.main). Per the documentation, the order is command, then ~filter, then @address.

Walkthrough: finding the key in keycheck.O0

We reuse version 2 of keycheck.c from the fundamentals post: the program XORs each key byte with 0x5A + i and compares the result with a constant array EXPECTED. Build your own binary (the zig cc command is in that post), then open it in r2:

r2: finding keycheck.O0's key in 6 commands$ r2 -A ./keycheck.O0# 1) Strings: the messages show up, the key does NOT (v2 uses XOR)[0x00401040]> iz0 .rodata ascii usage: %s <license-key>\n1 .rodata ascii License OK - welcome!2 .rodata ascii Invalid license key# 2) Find the key-check function and the XOR inside it[0x00401040]> afl~check0x00401140 5 98 sym.check_key[0x00401040]> pdf~xor @ sym.check_key│ 0x0040117a 31c8 xor eax, ecx# 3) Read the 8 EXPECTED bytes, then undo the XOR[0x00401040]> px 8 @ obj.EXPECTED0x00402010 1812 1215 1f16 5257 ......RW[0x00401040]> !python3 solve.pyBINHAI26Illustrative, trimmed · addresses and opcodes are examples
An illustrative session: strings → check function → XOR instruction → constant array → key.
  1. iz shows the “License OK” message but no key, because v2 doesn't store the key as text. To find which function prints that message, take the string's address and run axt @ address.
  2. afl~check filters out sym.check_key. pdf~xor @ sym.check_key confirms there is an XOR inside the loop. Type VV @ sym.check_key to see the loop as a graph.
  3. px 8 @ obj.EXPECTED dumps the 8 constant bytes. Undo the XOR with a few lines of Python:
# solve.py
expected = bytes.fromhex("181212151f165257")
print("".join(chr(b ^ (0x5A + i)) for i, b in enumerate(expected)))

With r2ghidra installed, pdg @ sym.check_key shows the loop as C, which is much faster than reading assembly.

Automation with r2pipe and rz-pipe

r2pipe sends command strings to r2 and returns the output. Add j to a command to get JSON, and use cmdj() to get a ready-made Python object. The script below triages every file in a directory: format, function count, imports, the first few strings and the five largest functions.

# pip install r2pipe
import json, sys, pathlib
import r2pipe

def triage(path):
    r2 = r2pipe.open(str(path), flags=["-N"])   # -N: skip personal config
    r2.cmd("aaa")
    info = r2.cmdj("ij") or {}
    funcs = r2.cmdj("aflj") or []
    imports = r2.cmdj("iij") or []
    strings = r2.cmdj("izj") or []
    r2.quit()
    return {
        "file": path.name,
        "format": info.get("core", {}).get("format"),
        "functions": len(funcs),
        "imports": sorted({i["name"] for i in imports}),
        "strings": [s["string"] for s in strings[:20]],
        "largest": sorted(((f["size"], f["name"]) for f in funcs), reverse=True)[:5],
    }

for p in sorted(pathlib.Path(sys.argv[1]).iterdir()):
    if p.is_file():
        print(json.dumps(triage(p), ensure_ascii=False))

Run python3 triage.py samples/ > report.jsonl, then filter with jq, for example to find files that import VirtualAlloc. For Rizin, swap in rz-pipe (pip install rzpipe, rzpipe.open(...)); the API is nearly identical. If you don't need Python, a shell one-liner works: r2 -q -c 'aaa; aflj' ./file > funcs.json (-q quits once the commands have run).

Tips for bulk runs: aaa can be very slow on large binaries, and the r2 docs also warn that deep analysis sometimes produces false positives. Try aa first (it only analyses symbols and entry points), set a timeout per file, and pin your r2 version. To let an AI agent drive r2, see radare2-mcp in RE Toolkit (1/5).

Risks, legality and ethics

  • Static analysis doesn't run the sample; debugging does: r2 -d executes the program. Open unknown samples only in an isolated VM; see the lab setup post (3/5).
  • The tool itself parses untrusted data: keep r2/Rizin up to date, and don't run bulk analysis under a privileged account.
  • Write mode: r2 -w modifies the file in place. Always work on a copy.
  • Legality: only reverse engineer software you own or are authorised to analyse. License terms and laws differ by country. See also the post on REA.

What should you do?

  • Dev: practise the 10 commands in the table on a binary you built yourself and compare against the source. Use rabin2 -I or rz-bin -I to check a release binary quickly (protection flags, architecture) before shipping.
  • Tech Lead: package r2 or Rizin at a pinned version in a Docker image. Write r2pipe checks for CI, for example to flag release binaries that still carry debug symbols or leak sensitive strings.
  • PM: this toolkit is free, open source and runs on headless servers, which makes it a good fit for an automated triage pipeline before experts step in with Ghidra or IDA.

The Advanced RE Toolkit series

  1. Decompiling Java and Python: Recaf, Vineflower, pyinstxtractor
  2. Emulation and instrumentation: Unicorn, Qiling, Speakeasy, DynamoRIO
  3. Building a malware analysis lab: FLARE-VM, REMnux, CAPEv2, PE-sieve
  4. radare2 and Rizin: the command line and r2pipe (this post)
  5. AI-assisted reversing: LLM4Decompile, Gepetto, ReVa, Decompiler Explorer

New to this? Start with the fundamentals series at Reverse Engineering (1/5) and the tools series at RE Toolkit (1/5).

Sources & references

  1. radare2 README — radareorg (GitHub)
  2. The Official Radare2 Book — radareorg
  3. R2pipe (Radare2 Book) — radareorg
  4. Announcing Rizin! — Rizin
  5. rizin README — rizinorg (GitHub)
  6. Cutter README — rizinorg (GitHub)
  7. iaito README — radareorg (GitHub)
  8. r2ghidra README — radareorg (GitHub)
  9. rz-ghidra README — rizinorg (GitHub)
  10. r2pipe for Python — radareorg (GitHub)
  11. rz-pipe — rizinorg (GitHub)