A general format for rizin commands is as follows:
People who use Vim daily and are familiar with its commands will find themselves at home. You will see this format used throughout the book. Commands are identified by a single case-sensitive character [a-zA-Z].
To repeatedly execute a command, prefix the command with a number:
px # run px 3px # run px 3 times
! prefix is used to execute a command in shell context. If you want to use the cmd callback from the I/O plugin you must prefix with
Note that a single exclamation mark will run the command and print the output through the RCons API. This means that the execution will be blocking and not interactive. Use double exclamation marks --
!! -- to run a standard system call.
All the socket, filesystem and execution APIs can be restricted with the
cfg.sandbox configuration variable.
A few examples:
ds ; call the debugger's 'step' command px 200 @ esp ; show 200 hex bytes at esp pc > file.c ; dump buffer as a C byte array to file.c wx 90 @@is ; write a nop on every symbol pd 2000 | grep eax ; grep opcodes that use the 'eax' register px 20 ; pd 3 ; px 40 ; multiple commands in a single line
The standard UNIX pipe
| is also available in the rizin shell. You can use it to filter the output of an rizin command with any shell program that reads from stdin, such as
wc. If you do not want to spawn anything, or you can't, or the target system does not have the basic UNIX tools you need (Windows or embedded users), you can also use the built-in grep (
~? for help.
~ character enables internal grep-like function used to filter output of any command:
pd 20~call ; disassemble 20 instructions and grep output for 'call'
Additionally, you can grep either for columns or for rows:
pd 20~call:0 ; get first row pd 20~call:1 ; get second row pd 20~call ; get first column pd 20~call ; get second column
Or even combine them:
pd 20~call:0 ; grep the first column of the first row matching 'call'
This internal grep function is a key feature for scripting rizin, because it can be used to iterate over a list of offsets or data generated by disassembler, ranges, or any other command. Refer to the loops section (iterators) for more information.
@ character is used to specify a temporary offset at which the command to its left will be executed.
The original seek position in a file is then restored.
pd 5 @ 0x100000fce to disassemble 5 instructions at address 0x100000fce.
Most of the commands offer autocompletion support using
<TAB> key, for example
It offers autocompletion using all possible values, taking flag names in this case.
Note that it is possible to see the history of the commands
!~... command - it offers a visual mode to scroll through the rizin command history.
To extend the autocompletion support to handle more commands or enable autocompletion to your own commands defined in core, I/O plugins you must use the