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     program     path to program to be executed
71
72     execve      use execve instead of posix_spawn (osx tricks)
73
74     runlib      path to the library to be executed
75
76     runlib.fcn  function name to call from runlib library
77
78     r2preload   preload with libr2, kill -USR1 to get an r2 shell or -USR2 to
79                 spawn a webserver in a thread
80
81     r2preweb    run the webserver in a thread just at starting the r2preload
82
83     setenv      set value for given environment variable
84
85     setegid     set effective process group id
86
87     seteuid     set effective process uid
88
89     setgid      set process group id
90
91     setuid      set process uid
92
93     sleep       sleep for the given amount of seconds
94
95     stdin       select file to read data from stdin
96
97     stdout      select file to replace stdout file descriptor
98
99     system      execute the given command
100
101     timeout     set a timeout
102
103     timeoutsig  signal to use when killing the child because the timeout hap‐
104                 pens
105
106     unsetenv    unset one environment variable
107

VALUE PREFIXES

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

EXAMPLES

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

SEE ALSO

171     radare2(1), rahash2(1), rafind2(1), rabin2(1), radiff2(1), ragg2(1),
172     rasm2(1),
173

AUTHORS

175     Written by pancake <pancake@nopcode.org>
176
177                                  Feb 3, 2017
Impressum