Introduction
This section covers the basics of using radare2
: finding the help pages for each module, the basic command format for each command, and using expressions.
Help Commands
I don't think there exists anyone that knows every radare2
command by heart. Thankfully, radare2
has a well-built help system.
The question mark command (?
) is used for accessing the help pages.
This can be combined with the modules to provide information on the available submodules and the commands inside each module. For example, if we want information on the debugger module (d
), we can use d?
to access the help page for the debugger module:
Basic Command Format
Commands in radare2
are organized into modules. The official documentation marks the format of a radare2
command as:
Here are some examples of some commands that are commonly used:
Most commands offer autocompletion using the Tab
key. To extend autocompletion, use the !!!
submodule command.
When using the grep
command, you can grep
for either rows or columns. Use :
for rows and []
for columns.
Expressions: The ? Module
Expressions are prepended with the ?
command. This module handles the evaluation of expressions and other miscellaneous features. We will cover the most common uses of the ?
module.
To access the help pages for the ?
module, use ???
.
Evaluating Expressions
The ?v
submodule is responsible for viewing the output of expressions. There are three formats for viewing the output of expressions:
?v
- View the output of the expression in hexadecimal.?vi
- View the output of the expression in decimal.?vx
- View the output of the expression in 8-byte padded hexadecimal.
To understand the outputs, let's look at the same expression for each output:
The supported arithmetic operations are addition (+
), subtraction (-
), multiplication (*
), division (/
), modulus (%
), shifting (<<
and >>
), and bitwise operations (&
, |
, and ^
).
You can use the raw ?
operator to get the output in several forms.
What-Is
?w
is used for determining what is at an address. We can use this to determine if the address is an instruction or data and the permissions of that address.
Shell Commands: The ! Module
You can use shell commands inside radare2
using the !
module. The !
command is used to execute commands.
grep
can be used in combination with shell commands. However, two exclamations must be used.
Last updated