/usr/lib/radare/bin/waiter is in radare-common 1:1.5.2-6.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #!/bin/sh
#
# Author: pancake <youterm.com>
#
if [ -z "$RADARE_WAITER_CMD" ]; then
RADARE_WAITER_CMD="radare -d"
fi
if [ -z "$1" ]; then
echo "Usage: rsc waiter <pid>|<process-name> <sleep>"
echo " Waits for a child of pid or process-name created"
echo "RADARE_WAITER_CMD=\"radare -d\""
exit
fi
pid="$1"
sleep="$2"
[ -z "$pid" ] && pid=0
[ -z "$sleep" ] && sleep=0
isnum=$(($pid+1))
if [ $isnum = 1 ]; then
# process name
while : ; do
for a in /proc/*/stat ; do
if [ -f $a ]; then
target=`cut -d ' ' -f 1 $a`
name=`cut -d ' ' -f 2 $a | tr '()' ' ' | sed -e 's, ,,g'`
if [ "$name" = "$pid" ]; then
echo "Attaching to $target..."
$RADARE_WAITER_CMD $target
exit 0
fi
fi
done
sleep $sleep
done
else
# child of pid
while : ; do
for a in /proc/*/stat ; do
if [ -f $a ]; then
target=`cut -d ' ' -f 1 $a`
ppid=`cut -d ' ' -f 4 $a`
if [ "$ppid" = "$pid" ]; then
echo "Attaching to $target..."
$RADARE_WAITER_CMD $target
exit 0
fi
fi
done
sleep $sleep
done
fi
|