RARUN2_ARGS
Useful to run "rarun2" but parse arguments from environment var
Radare2 utility to run programs in exotic environments
rarun2 [-vt]
[directives ...]
[script.rr2]
[Fl-
program
args ...]
A launcher for executing programs with custom environments, arguments, permissions, working directories, and redirected file descriptors.
Supports inline directive arguments, script files, or program specifications after the '--' separator.
Ideal for simplifying complex command lines, preparing specialized environments, and automating testing or exploitation scenarios.
-v
Show version
-t
Show terminal name
--
Use remaining arguments as program and program arguments
The rr2 (rarun2) configuration file accepts the following directives, described as key=value entries and comments defined as lines starting with '#'.
Path to program to be executed
Set values for arguments passed to the program
Enable or disable ASLR (yes|no)
Set 32 or 64 bit (if the architecture supports it)
Change directory before executing the program
Run the program in chroot (requires some previous setup)
Unset the whole environment (true|false)
Connect stdin/stdout/stderr to a socket (host:port)
Set no limit to the core file size (true|false)
Run in background, detached from terminal (default: false)
Set a file with lines like 'var=value' to be used as env
Use execve instead of posix_spawn (osx tricks)
Allow spawning different process for each connection with 'listen'
Set string to be passed to the program via stdin
Override path where the dynamic loader looks for shared libraries
Bind stdin/stdout/stderr to a listening socket (port)
Set the maximum number of file descriptors
Set the maximum number of processes
Set the maximum size for the stack
Set the niceness level of the process
Set process pid
Write pid to a file
Preload a library (not supported on Windows, only linux,osx,bsd)
Use a pty for connection over socket (true|false)
Preload with libr2, kill -USR1 for r2 shell, -USR2 for webserver
Run webserver in a thread at start with r2preload
Path to the library to be executed
Function name to call from runlib library
Set effective process group id
Set effective process uid
Set value for given environment variable (NAME=VALUE)
Set process group id
Set process uid
Sleep for the given amount of seconds before execution
Redirect stderr file descriptor to stdout (true|false)
Select file or terminal for stdout/stderr/stdin
Select file to read data from stdin
Select file to replace stdout file descriptor
Select file to replace stderr file descriptor
Execute the given command
Set a timeout in seconds
Signal to use when killing child on timeout (SIGTERM)
Print runtime in milliseconds to stderr (true|false)
Unset one environment variable
Every value in this configuration file can contain a special prefix:
Slurp contents of file and put them inside the key
Escape characters useful for hex chars
Escape characters useful for hex chars
Run command to store the output in the variable
Parse hexpair string and store it in the variable
Parse hexpair string from output of command and store it in the variable
Parses the input string and returns it as integer
300 characters filled with ABCD pattern
RARUN2_ARGS
Useful to run "rarun2" but parse arguments from environment var
Sample rarun2 script:
$ cat foo.rr2
#!/usr/bin/rarun2
program=./pp400
arg0=10
stdin=foo.txt
chdir=/tmp
clearenv=true
setenv=EGG=eggsy
setenv=NOFUN=nogames
unsetenv=NOFUN
# EGG will be the only env variable
#chroot=.
$ ./foo.rr2
Connecting a program to a socket:
$ nc -l 9999
$ rarun2 program=/bin/ls connect=localhost:9999
Debugging a program redirecting IO to another terminal:
## open a new terminal and type 'tty' to get
$ tty ; clear ; sleep 999999
/dev/ttyS010
## in another terminal run r2
$ r2 -r foo.rr2 -d ls
$ cat foo.rr2
#!/usr/bin/rarun2
stdio=/dev/ttys010
## Or you can use -R to set a key=value
r2 -R stdio=/dev/ttys010 -d ls
You can also use the -- flag to specify program and arguments:
$ rarun2 timeout=2 -- sleep 4
Run a library function:
$ rarun2 runlib=/lib/libc-2.25.so runlib.fcn=system arg1="ls /"
3 releases since Debian 7 (Wheezy); the text changed 2 times.
-- since Arch Linux 2026-11-01;
-t since Arch Linux 2026-11-01;
-v since Arch Linux 2026-11-01.