From 62551d44b7f6cfa9c69f798ee3e35fc16d093124 Mon Sep 17 00:00:00 2001 From: Andrea Jemmett Date: Mon, 24 Jun 2019 07:21:13 +0200 Subject: [PATCH] added awk scripts to process crashes --- .editorconfig | 2 +- work/.gitignore | 1 + work/crash_min_time.awk | 17 +++++++++++++++++ work/crash_times.awk | 27 +++++++++++++++++++++++++++ work/crash_times_agg.awk | 19 +++++++++++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 work/crash_min_time.awk create mode 100644 work/crash_times.awk create mode 100644 work/crash_times_agg.awk diff --git a/.editorconfig b/.editorconfig index 4b407a6..2e1bc2c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,7 +10,7 @@ insert_final_newline = true indent_style = tab indent_size = 4 -[*.{c,h,rs}] +[*.{c,h,rs,awk}] indent_style = space indent_size = 4 diff --git a/work/.gitignore b/work/.gitignore index 06eccd6..cfde851 100644 --- a/work/.gitignore +++ b/work/.gitignore @@ -5,3 +5,4 @@ !*.conf !stored_work !*.r +!*.awk diff --git a/work/crash_min_time.awk b/work/crash_min_time.awk new file mode 100644 index 0000000..072709f --- /dev/null +++ b/work/crash_min_time.awk @@ -0,0 +1,17 @@ +{ + if (times[$1] == "" || $2 < times[$1]) { + times[$1] = $2 + fuzzers[$1] = $3 + files[$1] = $4 + } +} + +END { + for (h in files) { + t = times[h] + fz = fuzzers[h] + f = files[h] + print h, t, fz, f + } +} + diff --git a/work/crash_times.awk b/work/crash_times.awk new file mode 100644 index 0000000..e32f35b --- /dev/null +++ b/work/crash_times.awk @@ -0,0 +1,27 @@ +$1 == "Hash:" { + current_hash = $2 +} + +$1 == "Fuzzer:" { + current_fuzzer = $2 +} + +$1 == "File:" { + ("date -r "$2" '+%s'")|getline date_s + date=strtonum(date_s) + if (files[current_hash] == "" || date < dates[current_hash]) { + dates[current_hash] = date + fuzzers[current_hash] = current_fuzzer + files[current_hash] = $2 + } +} + +END { + for (h in files) { + f = files[h] + d = dates[h] + fz = fuzzers[h] + print h, d - start_time, fz, f + } +} + diff --git a/work/crash_times_agg.awk b/work/crash_times_agg.awk new file mode 100644 index 0000000..0c224b2 --- /dev/null +++ b/work/crash_times_agg.awk @@ -0,0 +1,19 @@ +{ + if ($1 in times) { + times[$1] = times[$1] SUBSEP $2 + } else { + times[$1] = $2 + } +} + +END { + idx = 0 + for (h in times) { + n = split(times[h], ts, SUBSEP) + for (i = 1; i < n + 1; i++) { + print idx, h, ts[i] + } + idx++ + } +} +