2016-03-27 12:13:26 +00:00
.Dd Mar 27 , 2016
2014-09-30 09:01:45 +00:00
.Dt RARUN2 1
2014-09-30 09:37:26 +00:00
.Sh NAME
.Nm rarun2
.Nd radare2 utility to run programs in exotic environments
2011-10-12 01:24:19 +00:00
.Sh SYNOPSIS
.Nm rarun2
.Op [script.rr2]
.Sh DESCRIPTION
2011-10-12 23:00:07 +00:00
This program is used as a launcher for running programs with different environment, arguments, permissions, directories and overridden default filedescriptors.
2011-10-12 01:24:19 +00:00
.Pp
The program just accepts a single argument which is the filename of the configuration file to run the program.
.Pp
It is useful when you have to run a program using long arguments or pass long data to stdin or things like that usually required for exploiting crackmes :)
.Sh DIRECTIVES
.Pp
The rr2 (rarun2) configuration file accepts the following directives, described as key=value entries and comments defined as lines starting with '#'.
.Bl -tag -width Fl
2015-04-27 20:08:58 +00:00
.It Ar arg[0-3]
set value for argument N passed to the program
.It Ar aslr
enable or disable ASLR
.It Ar bits
set 32 or 64 bit (if the architecture supports it)
2011-10-12 01:24:19 +00:00
.It Ar chdir
change directory before executing the program
.It Ar chroot
run the program in chroot. requires some previous setup
2015-08-28 22:15:41 +00:00
.It Ar clearenv
unset the whole environment
2015-04-27 20:08:58 +00:00
.It Ar core
2015-08-28 22:15:41 +00:00
set no limit the core file size
2015-04-27 20:08:58 +00:00
.It Ar connect
connect stdin/stdout/stderr to a socket
.It Ar envfile
set a file with lines like `var=value` to be used as env
2015-09-12 17:36:15 +00:00
.It Ar fork
used with the listen option, allow to spawn a different process for each connection. Ignored when debugging.
2015-04-27 20:08:58 +00:00
.It Ar input
set string to be passed to the program via stdin
2014-10-05 14:09:38 +00:00
.It Ar libpath
override path where the dynamic loader will look for shared libraries
2015-04-27 20:08:58 +00:00
.It Ar listen
bound stdin/stdout/stderr to a listening socket
.It Ar maxstack
set the maximum size for the stack
.It Ar maxproc
set the maximum number of processes
.It Ar maxfd
set the maximum number of file descriptors
.It Ar nice
set the niceness level of the process
.It Ar preload
preload a library (not supported on Windows, only linux,osx,bsd)
.It Ar program
path to program to be executed
2016-03-27 12:17:39 +00:00
.It Ar execve
use execve instead of posix_spawn (osx tricks)
2015-04-27 20:08:58 +00:00
.It Ar r2preload
2015-06-02 02:05:32 +00:00
preload with libr2, kill -USR1 to get an r2 shell or -USR2 to spawn a webserver in a thread
2015-06-02 01:54:26 +00:00
.It Ar r2preweb
run the webserver in a thread just at starting the r2preload
2015-04-27 20:08:58 +00:00
.It Ar setenv
set value for given environment variable
.It Ar setegid
set effective process group id
2011-10-12 01:24:19 +00:00
.It Ar seteuid
set effective process uid
.It Ar setgid
set process group id
2015-04-27 20:08:58 +00:00
.It Ar setuid
set process uid
.It Ar sleep
sleep for the given amount of seconds
.It Ar stdin
select file to read data from stdin
.It Ar stdout
select file to replace stdout file descriptor
.It Ar system
execute the given command
.It Ar timeout
set a timeout
.It Ar unsetenv
2015-08-28 22:15:41 +00:00
unset one environment variable
2011-10-12 01:24:19 +00:00
.El
2016-03-27 12:13:26 +00:00
.Sh VALUE PREFIXES
Every value in this configuration file can contain a special
.Pp
.Bl -tag -width Fl
.It Ar @filename
Slurp contents of file and put them inside the key
.It Ar "text"
Escape characters useful for hex chars
.It Ar 'string'
Escape characters useful for hex chars
.It Ar !cmd
Run command to store the output in the variable
.It Ar :102030
Parse hexpair string and store it in the variable
.It Ar :!102030
Parse hexpair string from output of command and store it in the variable
.El
2012-10-22 00:28:42 +00:00
.Sh EXAMPLES
Sample rarun2 script
2011-10-12 01:24:19 +00:00
.Pp
$ cat foo.rr2
#!/usr/bin/rarun2
program=./pp400
arg0=10
stdin=foo.txt
chdir=/tmp
2015-08-28 22:15:41 +00:00
clearenv=true
setenv=EGG=eggsy
setenv=NOFUN=nogames
unsetenv=NOFUN
# EGG will be the only env variable
2011-10-12 01:24:19 +00:00
#chroot=.
./foo.rr2
.Pp
2012-10-22 00:28:42 +00:00
Connecting a program to a socket
.Pp
2014-01-01 07:52:46 +00:00
$ nc \- l 9999
2012-10-22 00:28:42 +00:00
$ rarun2 program=/bin/ls connect=localhost:9999
.Pp
2013-05-05 17:39:01 +00:00
Debugging a program redirecting io to another terminal
.Pp
## open a new terminal and type 'tty' to get
$ tty ; clear ; sleep 999999
/dev/ttyS010
## in another terminal run r2
2016-05-10 15:04:53 +00:00
$ r2 \- e dbg.profile=foo.rr2 -d ls
2016-05-10 15:14:00 +00:00
## or you can use -R option
$ r2 \- R foo.rr2 -d ls
2015-08-28 22:15:41 +00:00
$ cat foo.rr2
#!/usr/bin/rarun2
stdio=/dev/ttys010
2011-10-12 01:24:19 +00:00
.Sh SEE ALSO
.Pp
.Xr radare2(1) ,
.Xr rahash2(1) ,
.Xr rafind2(1) ,
.Xr rabin2(1) ,
.Xr radiff2(1) ,
.Xr ragg2(1) ,
.Xr rasm2(1) ,
.Sh AUTHORS
.Pp
2014-01-01 07:52:46 +00:00
Written by pancake <pancake@nopcode.org>