Skip to content

Commit

Permalink
Merge pull request #228 from hardik05/patch-2
Browse files Browse the repository at this point in the history
fixed corner case when on multiple instance, one of the fuzzer_stats …
  • Loading branch information
ifratric authored Jan 13, 2020
2 parents a320024 + 7f33031 commit 2bc8c45
Showing 1 changed file with 43 additions and 41 deletions.
84 changes: 43 additions & 41 deletions winafl-whatsup.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,52 +100,55 @@ def main():

fuzzer_stats_path = os.path.join(args.afl_sync_dir, '*', 'fuzzer_stats')
for stats_path in glob.glob(fuzzer_stats_path):
try:
stats = parse_fuzzer_stats(stats_path)

stats = parse_fuzzer_stats(stats_path)
start_time = stats['start_time']
run_time = get_cur_time() - start_time
run_days = int(((run_time / 60) / 60) / 24)
run_hours = int((run_time / 60 / 60) % 24)

start_time = stats['start_time']
run_time = get_cur_time() - start_time
run_days = int(((run_time / 60) / 60) / 24)
run_hours = int((run_time / 60 / 60) % 24)

if verbose:
print(">>> {} ({} days, {} hours) <<<\n".
format(stats['afl_banner'], run_days, run_hours))
if verbose:
print(">>> {} ({} days, {} hours) <<<\n".
format(stats['afl_banner'], run_days, run_hours))

if not is_process_running(stats['fuzzer_pid']):
if verbose:
print(" Instance is dead_count or running remotely, skipping.\n")
dead_count += 1
continue

alive_count += 1
execs_done = stats['execs_done']
exec_sec = float(execs_done) / run_time
path_percent = (float(stats['cur_path']) * 100) / stats['paths_total']

total_time += run_time
total_eps += exec_sec
total_execs += execs_done
total_crashes += stats['unique_crashes']
total_pending += stats['pending_total']
total_pfav += stats['pending_favs']

if not is_process_running(stats['fuzzer_pid']):
if verbose:
print(" Instance is dead_count or running remotely, skipping.\n")
dead_count += 1
print(" cycle {}, lifetime speed {:.2f} exec/sec, path {}/{} {:.2f}%".
format(stats['cycles_done'], exec_sec, stats['cur_path'],
stats['paths_total'], path_percent))

if stats['unique_crashes'] == 0:
print(" pending {}/{}, coverage {}, no crashes yet".
format(stats['pending_favs'], stats['pending_total'],
stats['bitmap_cvg']))
else:
print(" pending {}/{}, coverage {}, crash count {} (!)".
format(stats['pending_favs'], stats['pending_total'],
stats['bitmap_cvg'], stats['unique_crashes']))

print("")
except:
print("error in parsing fuzzer_stat: {}, seems to be corrupt?".format(stats_path))
continue

alive_count += 1
execs_done = stats['execs_done']
exec_sec = float(execs_done) / run_time
path_percent = (float(stats['cur_path']) * 100) / stats['paths_total']

total_time += run_time
total_eps += exec_sec
total_execs += execs_done
total_crashes += stats['unique_crashes']
total_pending += stats['pending_total']
total_pfav += stats['pending_favs']

if verbose:
print(" cycle {}, lifetime speed {:.2f} exec/sec, path {}/{} {:.2f}%".
format(stats['cycles_done'], exec_sec, stats['cur_path'],
stats['paths_total'], path_percent))

if stats['unique_crashes'] == 0:
print(" pending {}/{}, coverage {}, no crashes yet".
format(stats['pending_favs'], stats['pending_total'],
stats['bitmap_cvg']))
else:
print(" pending {}/{}, coverage {}, crash count {} (!)".
format(stats['pending_favs'], stats['pending_total'],
stats['bitmap_cvg'], stats['unique_crashes']))

print("")

total_days = int(total_time / 60 / 60 / 24)
total_hours = int((total_time / 60 / 60) % 24)

Expand Down Expand Up @@ -176,4 +179,3 @@ def main():

if __name__ == '__main__':
sys.exit(main())

0 comments on commit 2bc8c45

Please sign in to comment.