OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 # |
| 3 # american fuzzy lop - status check tool |
| 4 # -------------------------------------- |
| 5 # |
| 6 # Written and maintained by Michal Zalewski <lcamtuf@google.com> |
| 7 # |
| 8 # Copyright 2015 Google Inc. All rights reserved. |
| 9 # |
| 10 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 # you may not use this file except in compliance with the License. |
| 12 # You may obtain a copy of the License at: |
| 13 # |
| 14 # http://www.apache.org/licenses/LICENSE-2.0 |
| 15 # |
| 16 # This tool summarizes the status of any locally-running synchronized |
| 17 # instances of afl-fuzz. |
| 18 # |
| 19 |
| 20 echo "status check tool for afl-fuzz by <lcamtuf@google.com>" |
| 21 echo |
| 22 |
| 23 if [ "$1" = "-s" ]; then |
| 24 |
| 25 SUMMARY_ONLY=1 |
| 26 DIR="$2" |
| 27 |
| 28 else |
| 29 |
| 30 unset SUMMARY_ONLY |
| 31 DIR="$1" |
| 32 |
| 33 fi |
| 34 |
| 35 if [ "$DIR" = "" ]; then |
| 36 |
| 37 echo "Usage: $0 [ -s ] afl_sync_dir" 1>&2 |
| 38 echo 1>&2 |
| 39 echo "The -s option causes the tool to skip all the per-fuzzer trivia and show
" 1>&2 |
| 40 echo "just the summary results. See docs/parallel_fuzzing.txt for additional t
ips." 1>&2 |
| 41 echo 1>&2 |
| 42 exit 1 |
| 43 |
| 44 fi |
| 45 |
| 46 cd "$DIR" || exit 1 |
| 47 |
| 48 if [ -d queue ]; then |
| 49 |
| 50 echo "[-] Error: parameter is an individual output directory, not a sync dir."
1>&2 |
| 51 exit 1 |
| 52 |
| 53 fi |
| 54 |
| 55 CUR_TIME=`date +%s` |
| 56 |
| 57 TMP=`mktemp -t .afl-whatsup-XXXXXXXX` || exit 1 |
| 58 |
| 59 ALIVE_CNT=0 |
| 60 DEAD_CNT=0 |
| 61 |
| 62 TOTAL_TIME=0 |
| 63 TOTAL_EXECS=0 |
| 64 TOTAL_EPS=0 |
| 65 TOTAL_CRASHES=0 |
| 66 TOTAL_PFAV=0 |
| 67 TOTAL_PENDING=0 |
| 68 |
| 69 if [ "$SUMMARY_ONLY" = "" ]; then |
| 70 |
| 71 echo "Individual fuzzers" |
| 72 echo "==================" |
| 73 echo |
| 74 |
| 75 fi |
| 76 |
| 77 for i in `find . -maxdepth 2 -iname fuzzer_stats`; do |
| 78 |
| 79 sed 's/^command_line.*$/_skip:1/;s/[ ]*:[ ]*/="/;s/$/"/' "$i" >"$TMP" |
| 80 . "$TMP" |
| 81 |
| 82 RUN_UNIX=$((CUR_TIME - start_time)) |
| 83 RUN_DAYS=$((RUN_UNIX / 60 / 60 / 24)) |
| 84 RUN_HRS=$(((RUN_UNIX / 60 / 60) % 24)) |
| 85 |
| 86 if [ "$SUMMARY_ONLY" = "" ]; then |
| 87 |
| 88 echo ">>> $afl_banner ($RUN_DAYS days, $RUN_HRS hrs) <<<" |
| 89 echo |
| 90 |
| 91 fi |
| 92 |
| 93 if ! kill -0 "$fuzzer_pid" 2>/dev/null; then |
| 94 |
| 95 if [ "$SUMMARY_ONLY" = "" ]; then |
| 96 |
| 97 echo " Instance is dead or running remotely, skipping." |
| 98 echo |
| 99 |
| 100 fi |
| 101 |
| 102 DEAD_CNT=$((DEAD_CNT + 1)) |
| 103 continue |
| 104 |
| 105 fi |
| 106 |
| 107 ALIVE_CNT=$((ALIVE_CNT + 1)) |
| 108 |
| 109 EXEC_SEC=$((execs_done / RUN_UNIX)) |
| 110 PATH_PERC=$((cur_path * 100 / paths_total)) |
| 111 |
| 112 TOTAL_TIME=$((TOTAL_TIME + RUN_UNIX)) |
| 113 TOTAL_EPS=$((TOTAL_EPS + EXEC_SEC)) |
| 114 TOTAL_EXECS=$((TOTAL_EXECS + execs_done)) |
| 115 TOTAL_CRASHES=$((TOTAL_CRASHES + unique_crashes)) |
| 116 TOTAL_PENDING=$((TOTAL_PENDING + pending_total)) |
| 117 TOTAL_PFAV=$((TOTAL_PFAV + pending_favs)) |
| 118 |
| 119 if [ "$SUMMARY_ONLY" = "" ]; then |
| 120 |
| 121 echo " cycle $((cycles_done + 1)), lifetime speed $EXEC_SEC execs/sec, path
$cur_path/$paths_total (${PATH_PERC}%)" |
| 122 |
| 123 if [ "$unique_crashes" = "0" ]; then |
| 124 echo " pending $pending_favs/$pending_total, coverage $bitmap_cvg, no cra
shes yet" |
| 125 else |
| 126 echo " pending $pending_favs/$pending_total, coverage $bitmap_cvg, crash
count $unique_crashes (!)" |
| 127 fi |
| 128 |
| 129 echo |
| 130 |
| 131 fi |
| 132 |
| 133 done |
| 134 |
| 135 rm -f "$TMP" |
| 136 |
| 137 TOTAL_DAYS=$((TOTAL_TIME / 60 / 60 / 24)) |
| 138 TOTAL_HRS=$(((TOTAL_TIME / 60 / 60) % 24)) |
| 139 |
| 140 test "$TOTAL_TIME" = "0" && TOTAL_TIME=1 |
| 141 |
| 142 echo "Summary stats" |
| 143 echo "=============" |
| 144 echo |
| 145 echo " Fuzzers alive : $ALIVE_CNT" |
| 146 |
| 147 if [ ! "$DEAD_CNT" = "0" ]; then |
| 148 echo " Dead or remote : $DEAD_CNT (excluded from stats)" |
| 149 fi |
| 150 |
| 151 echo " Total run time : $TOTAL_DAYS days, $TOTAL_HRS hours" |
| 152 echo " Total execs : $((TOTAL_EXECS / 1000 / 1000)) million" |
| 153 echo " Cumulative speed : $TOTAL_EPS execs/sec" |
| 154 echo " Pending paths : $TOTAL_PFAV faves, $TOTAL_PENDING total" |
| 155 |
| 156 if [ "$ALIVE_CNT" -gt "1" ]; then |
| 157 echo " Pending per fuzzer : $((TOTAL_PFAV/ALIVE_CNT)) faves, $((TOTAL_PENDING
/ALIVE_CNT)) total (on average)" |
| 158 fi |
| 159 |
| 160 echo " Crashes found : $TOTAL_CRASHES locally unique" |
| 161 echo |
| 162 |
| 163 exit 0 |
OLD | NEW |