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

NAME

4     rz-run — rizin utility to run programs in exotic environments
5

SYNOPSIS

7     rz-run [[directives]] [[script.rrz]] [[--] [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     rz-run -t will show the terminal name and wait for a connection from an‐
15     other process. try rz-run 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 rrz (rz-run) configuration file accepts the following directives, de‐
26     scribed as key=value entries and comments defined as lines starting with
27     '#'.
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     pid         set to true to print the PID of the process to stderr
76
77     pidfile     print the PID of the process to the specified file
78
79     execve      use execve instead of posix_spawn (osx tricks)
80
81     runlib      path to the library to be executed
82
83     runlib.fcn  function name to call from runlib library
84
85     rzpreload   preload with librz, kill -USR1 to get an rizin shell or -USRZ
86                 to spawn a webserver in a thread
87
88     rzpreweb    run the webserver in a thread just at starting the rzpreload
89
90     setenv      set value for given environment variable
91
92     setegid     set effective process group id
93
94     seteuid     set effective process uid
95
96     setgid      set process group id
97
98     setuid      set process uid
99
100     sleep       sleep for the given amount of seconds
101
102     stdin       select file to read data from stdin
103
104     stdout      select file to replace stdout file descriptor
105
106     system      execute the given command
107
108     timeout     set a timeout
109
110     timeoutsig  signal to use when killing the child because the timeout hap‐
111                 pens
112
113     unsetenv    unset one environment variable
114

VALUE PREFIXES

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

EXAMPLES

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

SEE ALSO

178     rizin(1), rz-hash(1), rz-find(1), rz-bin(1), rz-diff(1), rz-gg(1),
179     rz-asm(1),
180

AUTHORS

182     Written by pancake <pancake@nopcode.org>
183
184                                  Feb 3, 2017
Impressum