better afl startup detection in afl-whatsup

This commit is contained in:
vanhauser-thc
2023-08-28 13:58:55 +02:00
parent 4a7e35b29c
commit 2b53b4af5c

View File

@ -174,11 +174,15 @@ FIRST=true
TOTAL_WCOP=
TOTAL_LAST_FIND=0
for i in `find . -maxdepth 2 -iname fuzzer_stats | sort`; do
for j in `find . -maxdepth 2 -iname fuzzer_setup | sort`; do
DIR=$(dirname "$j")
i=$DIR/fuzzer_stats
if [ -f "$i" ]; then
sed 's/^command_line.*$/_skip:1/;s/[ ]*:[ ]*/="/;s/$/"/' "$i" >"$TMP"
. "$TMP"
DIR=$(dirname "$i")
DIRECTORY=$DIR
DIR=${DIR##*/}
RUN_UNIX=$run_time
@ -210,9 +214,9 @@ for i in `find . -maxdepth 2 -iname fuzzer_stats | sort`; do
IS_STARTING=
IS_DEAD=
if [ -e "$i" ] && [ -e "$DIRECTORY/fuzzer_setup" ] && [ -n "$FUSER" ]; then
if [ -e "$i" ] && [ -e "$j" ] && [ -n "$FUSER" ]; then
if [ "$i" -ot "$DIRECTORY/fuzzer_setup" ]; then
if [ "$i" -ot "$j" ]; then
# fuzzer_setup is newer than fuzzer_stats, maybe the instance is starting?
TMP_PID=`fuser -v "$DIRECTORY" 2>&1 | grep afl-fuzz`
@ -336,6 +340,19 @@ for i in `find . -maxdepth 2 -iname fuzzer_stats | sort`; do
fi
else
if [ ! -e "$i" -a -e "$j" ]; then
ALIVE_CNT=$((ALIVE_CNT + 1))
START_CNT=$((START_CNT + 1))
last_find=0
IS_STARTING=1
fi
fi
done
# Formatting for total time, time since last find, crash, and hang