Linux cli command rarun2

➡ A Linux man page (short for manual page) is a form of software documentation found on Linux and Unix-like operating systems. This man-page explains the command rarun2 and provides detailed information about the command rarun2, system calls, library functions, and other aspects of the system, including usage, options, and examples of _. You can access this man page by typing man followed by the rarun2.

This program is used as a launcher for running programs with different environment, arguments, permissions, directories and overridden default file descriptors.

rarun2 -t will show the terminal name and wait for a connection from another process. try rarun2 stdio=<ttypath> program=/bin/sh

The program just accepts a single argument which is the filename of the configuration file to run the program.

It is useful when you have to run a program using long arguments or pass long data to stdin or things like that usually are required for exploiting crackmes :)

The rr2 (rarun2) configuration file accepts the following directives, described as key=value entries and comments defined as lines starting with ‘#’.

set value for argument N passed to the program

enable or disable ASLR

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

set no limit the core file size

boolean value (true|false) to print runtime in milliseconds to stderr after program execution

connect stdin/stdout/stderr to a socket

use a pty for connection over socket (with connect/listen)

set a file with lines like `var=value` to be used as env

used with the listen option, allow to spawn a different process for each connection. Ignored when debugging.

set string to be passed to the program via stdin

override path where the dynamic loader will look for shared libraries

bound stdin/stdout/stderr to a listening socket

set the maximum size for the stack

set the maximum number of processes

set the maximum number of file descriptors

set the niceness level of the process

preload a library (not supported on Windows, only linux,osx,bsd)

Set to false by default, otherwise it will run the program in background, detached from the terminal.

path to program to be executed

use execve instead of posix_spawn (osx tricks)

path to the library to be executed

function name to call from runlib library

preload with libr2, kill -USR1 to get an r2 shell or -USR2 to spawn a webserver in a thread

run the webserver in a thread just at starting the r2preload

set value for given environment variable

set effective process group id

set effective process uid

set process group id

set process uid

sleep for the given amount of seconds

select file to read data from stdin

select file to replace stdout file descriptor

execute the given command

set a timeout

signal to use when killing the child because the timeout happens

unset one environment variable

Every value in this configuration file can contain a special

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

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 in a more natural way:

$ rarun2 timeout=2 – sleep 4

Run a library function

$ rarun2 runlib=/lib/libc-2.25.so runlib.fcn=system arg1=“ls /”

RARUN2_ARGS useful to just run “rarun2” but parse arguments from environment var

Written by pancake <[email protected]>

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░