1RARUN2(1)                 BSD General Commands Manual                RARUN2(1)
2

NAME

4     rarun2 — radare2 utility to run programs in exotic environments
5

SYNOPSIS

7     rarun2 [[directives]] [[script.rr2]] [[--] [program] [args]]
8

DESCRIPTION

10     This program is used as a launcher for running programs with different
11     environment, arguments, permissions, directories and overridden default
12     filedescriptors.
13
14     rarun2 -t will show the terminal name and wait for a connection from
15     another process. try rarun2 stdio=<ttypath> program=/bin/sh
16
17     The program just accepts a single argument which is the filename of the
18     configuration file to run the program.
19
20     It is useful when you have to run a program using long arguments or pass
21     long data to stdin or things like that usually required for exploiting
22     crackmes :)
23

DIRECTIVES

25     The rr2 (rarun2) configuration file accepts the following directives,
26     described as key=value entries and comments defined as lines starting
27     with '#'.
28
29     arg[0-N]    set value for argument N passed to the program
30
31     aslr        enable or disable ASLR
32
33     bits        set 32 or 64 bit (if the architecture supports it)
34
35     chdir       change directory before executing the program
36
37     chroot      run the program in chroot. requires some previous setup
38
39     clearenv    unset the whole environment
40
41     core        set no limit the core file size
42
43     connect     connect stdin/stdout/stderr to a socket
44
45     pty         use a pty for connection over socket (with connect/listen)
46
47     envfile     set a file with lines like `var=value` to be used as env
48
49     fork        used with the listen option, allow to spawn a different
50                 process for each connection. Ignored when debugging.
51
52     input       set string to be passed to the program via stdin
53
54     libpath     override path where the dynamic loader will look for shared
55                 libraries
56
57     listen      bound stdin/stdout/stderr to a listening socket
58
59     maxstack    set the maximum size for the stack
60
61     maxproc     set the maximum number of processes
62
63     maxfd       set the maximum number of file descriptors
64
65     nice        set the niceness level of the process
66
67     preload     preload a library (not supported on Windows, only
68                 linux,osx,bsd)
69
70     daemon      Set to false by default, otherwise it will run the program in
71                 background, detached from the terminal.
72
73     program     path to program to be executed
74
75     execve      use execve instead of posix_spawn (osx tricks)
76
77     runlib      path to the library to be executed
78
79     runlib.fcn  function name to call from runlib library
80
81     r2preload   preload with libr2, kill -USR1 to get an r2 shell or -USR2 to
82                 spawn a webserver in a thread
83
84     r2preweb    run the webserver in a thread just at starting the r2preload
85
86     setenv      set value for given environment variable
87
88     setegid     set effective process group id
89
90     seteuid     set effective process uid
91
92     setgid      set process group id
93
94     setuid      set process uid
95
96     sleep       sleep for the given amount of seconds
97
98     stdin       select file to read data from stdin
99
100     stdout      select file to replace stdout file descriptor
101
102     system      execute the given command
103
104     timeout     set a timeout
105
106     timeoutsig  signal to use when killing the child because the timeout hap‐
107                 pens
108
109     unsetenv    unset one environment variable
110

VALUE PREFIXES

112     Every value in this configuration file can contain a special
113
114     @filename   Slurp contents of file and put them inside the key
115
116     text        Escape characters useful for hex chars
117
118     'string'    Escape characters useful for hex chars
119
120     !cmd        Run command to store the output in the variable
121
122     :102030     Parse hexpair string and store it in the variable
123
124     :!cmd       Parse hexpair string from output of command and store it in
125                 the variable
126
127     %1234       Parses the input string and returns it as integer
128

EXAMPLES

130     Sample rarun2 script
131
132       $ cat foo.rr2
133       #!/usr/bin/rarun2
134       program=./pp400
135       arg0=10
136       stdin=foo.txt
137       chdir=/tmp
138       clearenv=true
139       setenv=EGG=eggsy
140       setenv=NOFUN=nogames
141       unsetenv=NOFUN
142       # EGG will be the only env variable
143       #chroot=.
144       ./foo.rr2
145
146     Connecting a program to a socket
147
148       $ nc -l 9999
149       $ rarun2 program=/bin/ls connect=localhost:9999
150
151     Debugging a program redirecting io to another terminal
152
153       ## open a new terminal and type 'tty' to get
154       $ tty ; clear ; sleep 999999
155       /dev/ttyS010
156       ## in another terminal run r2
157       $ r2 -r foo.rr2 -d ls
158       $ cat foo.rr2
159       #!/usr/bin/rarun2
160       stdio=/dev/ttys010
161       ## Or you can use -R to set a key=value
162       r2 -R stdio=/dev/ttys010 -d ls
163
164     You can also use the -- flag to specify program and arguments in a more
165     natural way:
166
167       $ rarun2 timeout=2 -- sleep 4
168
169     Run a library function
170
171       $ rarun2 runlib=/lib/libc-2.25.so runlib.fcn=system arg1="ls /"
172

SEE ALSO

174     radare2(1), rahash2(1), rafind2(1), rabin2(1), radiff2(1), ragg2(1),
175     rasm2(1),
176

AUTHORS

178     Written by pancake <pancake@nopcode.org>
179
180                                  Feb 3, 2017
Impressum