Radare2 Comprehensive Cheatsheet
Installation Instructions
# Using Git
git clone https:// github.com / radareorg/ radare2
cd radare2
sys/ install.sh
# Using Binary
Download Windows installer from rada.re/ r
# Using apt
sudo apt-get install radare2
# Building from source
git clone https://github.com/radareorg/radare2
cd radare2
sys/install.sh
# Using Homebrew
brew install radare2
# Using source
git clone https://github.com/radareorg/radare2
sys/install.sh
Open Binary
Open Binary in Debug Mode
Open Binary in Write Mode
Analyze All
Analyze More
Analyze Even More
List Functions
Seek to Address
Print Disassembly
pd
pdf # Print disassembly of function
pdf @main # Print main function
Visual Mode
V # Enter visual mode
VV # Enter visual graph mode
v # Enter visual panels mode
Write String
Write Hex
Read Memory
x # Read hexdump
px # Print hexdump
ps # Print string
Set Breakpoint
Remove Breakpoint
List Breakpoints
Continue Execution
Step Into
Step Over
File Information
i # Info
iz # Strings in data sections
ii # Imports
ie # Entries (entrypoints)
Headers
ih # Headers
iH # Verbose Headers
Search String
/ string
/x pattern # Search hex
/w string # Search wide string
References
axt address # Find references to address
axf address # Find references from address
Graph Commands
VV # Enter graph mode
p # Cycle through different views
. # Seek to program counter
: # Enter command mode
Visual Panels
v # Enter visual panels mode
! # Run shell command
+ # Add new panel
- # Remove current panel
Function Analysis
af # Analyze function
afr # Analyze references
afl # List functions
afi # Function information
Type Analysis
ta # Type analysis
te # List enums
tc # List types
Run Script
Write Script
#! pipe python
import r2pipe
r2 = r2pipe.open ()
print(r2.cmd(" pi 5" ))
Save Project
Ps name # Save project
Po name # Open project
Binary Patching
w # Write bytes
wa # Write assembly
wc # Write cache
Binary Diffing
Debugging with ESIL
aei # Initialize ESIL
aeim # Initialize ESIL memory
aeip # Initialize ESIL program counter
Set Configuration
e key=value
e asm.syntax=intel
e asm.bytes=false
Graph Settings
e graph.depth=4
e graph.font=Helvetica
# Full analysis script
aa
pdf @main
afl
s sym.main
VV
# Replace instruction with NOP
s address
wa nop
# Analyze function and generate graph
af @main
agf
hjkl: Move around
p: Rotate through modes
x: References
v: Variable analysis
g: Goto command
F7: Step into
F8: Step over
F9: Continue
F2: Toggle breakpoint
Start with 'aa' analysis
Use 'aaa' for deeper analysis
Check strings with 'iz'
Use 'axt' to find xrefs
#! /usr/bin/env rarun2
program=./binary
arg1=argument
# Analysis commands
e asm.syntax=intel
aa
s main
pdf
# Search for pattern
/x 90909090
# Follow memory references
axf
Use minimal analysis when possible
Cache analysis results
Use projects for large binaries
Use projects for complex analysis
Document findings inline
Use meaningful flags and comments
Use r2pipe for scripting
Create custom r2 scripts
Use radare2 plugins
Common Issues and Solutions
# Load symbols
is
# Analyze symbols
aa
# Force binary format
r2 -f format binary
# Set bigger memory map
e dbg.bep=entry
e dbg.maps=true