From 1095840b98588c51d214cf7920f0e3f6bfaa716b Mon Sep 17 00:00:00 2001 From: DMaroo Date: Fri, 6 Aug 2021 21:08:50 +0530 Subject: Changed parameter order, reduced script execution time --- afl-plot | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'afl-plot') diff --git a/afl-plot b/afl-plot index 52cec521..a06b0c7f 100755 --- a/afl-plot +++ b/afl-plot @@ -22,10 +22,17 @@ get_abs_path() { echo "progress plotting utility for afl-fuzz by Michal Zalewski" echo -if ( [ "$#" != "2" ] && [ "$#" != "3" ] ) || ( [ "$#" = "3" ] && [ "$3" != "-g" ] && [ "$3" != "--graphical" ] ); then +GRAPHICAL="0" + +if [ "$1" = "-g" ] || [ "$1" = "--graphical" ]; then +GRAPHICAL="1" +shift +fi + +if [ "$#" != "2" ]; then cat 1>&2 <<_EOF_ -$0 afl_state_dir graph_output_dir [ -g | --graphical ] +$0 [ -g | --graphical ] afl_state_dir graph_output_dir This program generates gnuplot images from afl-fuzz output data. @@ -36,7 +43,7 @@ Usage: graph_output_dir should point to an empty directory where this tool can write the resulting plots to -g, --graphical (optional) display the plots in a graphical window - (requires GTK as a dependency) + (you should have built afl-plot-ui to use this option) The program will put index.html and three PNG images in the output directory; you should be able to view it with any web browser of your choice. @@ -171,8 +178,7 @@ $GNUPLOT_SETUP plot '$inputdir/plot_data' using 1:13 with lines title ' edges' linecolor rgb '#0090ff' linewidth 3 " - -if [ "$#" = "3" ] && ( [ "$3" = "-g" ] || [ "$3" = "--graphical" ] ); then +if [ "$#" = "2" ] && [ "$GRAPHICAL" = "1" ]; then afl-plot-ui -h > /dev/null 2>&1 @@ -192,7 +198,7 @@ fi mkdir -p "$outputdir/tmp" afl-plot-ui > "$outputdir/tmp/win_ids" & -sleep 2 +sleep 0.5 W_ID1=$(cat $outputdir/tmp/win_ids | head -1) W_ID2=$(cat $outputdir/tmp/win_ids | head -2 | tail -1) @@ -213,7 +219,7 @@ pause mouse close _EOF_ -) | gnuplot & +) | gnuplot 2> /dev/null & ( @@ -227,7 +233,7 @@ pause mouse close _EOF_ -) | gnuplot & +) | gnuplot 2> /dev/null & ( @@ -241,7 +247,7 @@ pause mouse close _EOF_ -) | gnuplot & +) | gnuplot 2> /dev/null & ( @@ -255,9 +261,9 @@ pause mouse close _EOF_ -) | gnuplot & +) | gnuplot 2> /dev/null & -sleep 2 +sleep 1 rm "$outputdir/tmp/win_ids" @@ -285,6 +291,8 @@ _EOF_ ) | gnuplot +echo "[?] You can also use -g flag to view the plots in an GUI window, and interact with the plots (if you have build afl-plot-ui). Run \"afl-plot\" to know more." + fi if [ ! -s "$outputdir/exec_speed.png" ]; then -- cgit v1.2.3