about summary refs log tree commit diff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/README.md7
-rw-r--r--utils/aflpp_driver/README.md2
-rw-r--r--utils/argv_fuzzing/README.md2
-rw-r--r--utils/defork/README.md2
-rw-r--r--utils/plot_ui/Makefile10
-rw-r--r--utils/plot_ui/README.md15
-rw-r--r--utils/plot_ui/afl-plot-ui.c167
-rwxr-xr-xutils/qbdi_mode/README.md2
-rw-r--r--utils/socket_fuzzing/README.md2
9 files changed, 202 insertions, 7 deletions
diff --git a/utils/README.md b/utils/README.md
index eb2e36b7..b8df0b47 100644
--- a/utils/README.md
+++ b/utils/README.md
@@ -8,6 +8,9 @@ Here's a quick overview of the stuff you can find in this directory:
   - afl_network_proxy    - fuzz a target over the network: afl-fuzz on
                            a host, target on an embedded system.
 
+  - plot_ui              - simple UI window utility to display the
+                           plots generated by afl-plot
+
   - afl_proxy            - skeleton file example to show how to fuzz
                            something where you gather coverage data via
                            different means, e.g. hw debugger
@@ -38,7 +41,7 @@ Here's a quick overview of the stuff you can find in this directory:
   - crash_triage         - a very rudimentary example of how to annotate crashes
                            with additional gdb metadata.
 
-  - custom_mutators      - examples for the afl++ custom mutator interface in
+  - custom_mutators      - examples for the AFL++ custom mutator interface in
                            C and Python. Note: They were moved to
                            ../custom_mutators/examples/
 
@@ -61,7 +64,7 @@ Here's a quick overview of the stuff you can find in this directory:
   - qemu_persistent_hook - persistent mode support module for qemu.
 
   - socket_fuzzing       - a LD_PRELOAD library 'redirects' a socket to stdin
-                           for fuzzing access with afl++
+                           for fuzzing access with AFL++
 
 Note that the minimize_corpus.sh tool has graduated from the utils/
 directory and is now available as ../afl-cmin. The LLVM mode has likewise
diff --git a/utils/aflpp_driver/README.md b/utils/aflpp_driver/README.md
index 4ca59776..30e2412f 100644
--- a/utils/aflpp_driver/README.md
+++ b/utils/aflpp_driver/README.md
@@ -1,4 +1,4 @@
-# afl++ drivers
+# AFL++ drivers
 
 ## aflpp_driver
 
diff --git a/utils/argv_fuzzing/README.md b/utils/argv_fuzzing/README.md
index fa8cad80..192d72f7 100644
--- a/utils/argv_fuzzing/README.md
+++ b/utils/argv_fuzzing/README.md
@@ -1,6 +1,6 @@
 # argvfuzz
 
-afl supports fuzzing file inputs or stdin. When source is available,
+AFL supports fuzzing file inputs or stdin. When source is available,
 `argv-fuzz-inl.h` can be used to change `main()` to build argv from stdin.
 
 `argvfuzz` tries to provide the same functionality for binaries. When loaded
diff --git a/utils/defork/README.md b/utils/defork/README.md
index 7e950323..657ef274 100644
--- a/utils/defork/README.md
+++ b/utils/defork/README.md
@@ -8,4 +8,4 @@ the target will belive it is running as the child, post-fork.
 This is defork.c from the amazing preeny project
 https://github.com/zardus/preeny
 
-It is altered for afl++ to work with its fork-server: the initial fork will go through, the second fork will be blocked.
+It is altered for AFL++ to work with its fork-server: the initial fork will go through, the second fork will be blocked.
diff --git a/utils/plot_ui/Makefile b/utils/plot_ui/Makefile
new file mode 100644
index 00000000..7ade8a40
--- /dev/null
+++ b/utils/plot_ui/Makefile
@@ -0,0 +1,10 @@
+CFLAGS=`pkg-config --cflags gtk+-3.0`
+LDFLAGS=`pkg-config --libs gtk+-3.0`
+
+all:  afl-plot-ui
+
+afl-plot-ui:	afl-plot-ui.c
+	$(CC) $(CFLAGS) -o afl-plot-ui afl-plot-ui.c $(LDFLAGS)
+
+clean:
+	rm -f afl-plot-ui
\ No newline at end of file
diff --git a/utils/plot_ui/README.md b/utils/plot_ui/README.md
new file mode 100644
index 00000000..145ec219
--- /dev/null
+++ b/utils/plot_ui/README.md
@@ -0,0 +1,15 @@
+# afl-plot-ui
+
+`afl-plot-ui` is a helper utility for rendering the GNUplot graphs in a GTK window. This allows to real time resizing, scrolling, and cursor positioning features while viewing the graph. This utility also provides options to hide graphs using check buttons.
+
+Currently, this utility is not built by default.
+You can manually build and install `afl-plot-ui` as follows
+
+```shell
+sudo apt install libgtk-3-0 libgtk-3-dev pkg-config
+make
+cd ../../
+sudo make install
+```
+
+*NOTE:* This utility is not meant to be used standalone. Never run this utility directly. Always run [`afl-plot`](../../afl-plot), which will, in turn, invoke this utility (when run using `-g` or `--graphical` flag).
\ No newline at end of file
diff --git a/utils/plot_ui/afl-plot-ui.c b/utils/plot_ui/afl-plot-ui.c
new file mode 100644
index 00000000..1a1eb0ed
--- /dev/null
+++ b/utils/plot_ui/afl-plot-ui.c
@@ -0,0 +1,167 @@
+#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
+#include <stdio.h>
+#include <string.h>
+
+#define WIDTH 400
+#define HEIGHT 640
+
+char USAGE[] =
+    "is a helper utility for rendering the GNUplot graphs in a GTK window. This allows to real time resizing, scrolling, and cursor positioning features while viewing the graph. This utility also provides options to hide graphs using check buttons.\n \
+\n \
+Usage:\n \
+    -h, --help      Show this help menu\n \
+\n \
+NOTE: This utility is not meant to be used standalone. Never run this utility directly. Always run afl-plot, which will, in turn, invoke this utility (when run using `-g` or `--graphical` flag).\n \
+";
+
+static void plot_toggled(GtkWidget *caller, gpointer data);
+
+int main(int argc, char **argv) {
+
+  if (argc == 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "-help"))) {
+
+    printf("%s %s", argv[0], USAGE);
+    return EXIT_SUCCESS;
+
+  }
+
+  GtkWidget *window;
+  GtkWidget *main_vbox;
+
+  GtkWidget *cbuttons_frame;
+  GtkWidget *cbuttons_hbox;
+
+  GtkWidget *separator_maj, *separator_min1, *separator_min2, *separator_min3;
+
+  GtkWidget *plots_vbox;
+  GtkWidget *plot_edges_frame, *plot_exec_speed_frame, *plot_high_freq_frame,
+      *plot_low_freq_frame;
+  GtkWidget *plot_edges, *plot_exec_speed, *plot_high_freq, *plot_low_freq;
+
+  gtk_init(&argc, &argv);
+
+  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_default_size(GTK_WINDOW(window), WIDTH, HEIGHT);
+  gtk_window_set_title(GTK_WINDOW(window), "Graph drawing");
+  gtk_container_set_border_width(GTK_CONTAINER(window), 10);
+
+  main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+
+  cbuttons_frame = gtk_frame_new("Select the plots");
+  gtk_container_set_border_width(GTK_CONTAINER(cbuttons_frame), 5);
+
+  cbuttons_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
+
+  GtkWidget *cbutton_edges, *cbutton_exec_speed, *cbutton_high_freq,
+      *cbutton_low_freq;
+
+  cbutton_edges = gtk_check_button_new_with_label("Edges");
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbutton_edges), TRUE);
+  g_signal_connect(cbutton_edges, "toggled", G_CALLBACK(plot_toggled),
+                   &plot_edges_frame);
+
+  cbutton_exec_speed = gtk_check_button_new_with_label("Execution Speed");
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbutton_exec_speed), TRUE);
+  g_signal_connect(cbutton_exec_speed, "toggled", G_CALLBACK(plot_toggled),
+                   &plot_exec_speed_frame);
+
+  cbutton_high_freq = gtk_check_button_new_with_label("High Frequency");
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbutton_high_freq), TRUE);
+  g_signal_connect(cbutton_high_freq, "toggled", G_CALLBACK(plot_toggled),
+                   &plot_high_freq_frame);
+
+  cbutton_low_freq = gtk_check_button_new_with_label("Low Frequency");
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbutton_low_freq), TRUE);
+  g_signal_connect(cbutton_low_freq, "toggled", G_CALLBACK(plot_toggled),
+                   &plot_low_freq_frame);
+
+  gtk_box_pack_start(GTK_BOX(cbuttons_hbox), cbutton_edges, TRUE, TRUE, 1);
+  gtk_box_pack_start(GTK_BOX(cbuttons_hbox), cbutton_exec_speed, TRUE, TRUE, 1);
+  gtk_box_pack_start(GTK_BOX(cbuttons_hbox), cbutton_high_freq, TRUE, TRUE, 1);
+  gtk_box_pack_start(GTK_BOX(cbuttons_hbox), cbutton_low_freq, TRUE, TRUE, 1);
+
+  gtk_container_add(GTK_CONTAINER(cbuttons_frame), cbuttons_hbox);
+  gtk_box_pack_start(GTK_BOX(main_vbox), cbuttons_frame, FALSE, TRUE, 1);
+
+  separator_maj = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
+  gtk_box_pack_start(GTK_BOX(main_vbox), separator_maj, FALSE, TRUE, 1);
+
+  plots_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
+
+  plot_edges_frame = gtk_frame_new("Edges");
+  gtk_container_set_border_width(GTK_CONTAINER(plot_edges_frame), 5);
+  plot_edges = gtk_socket_new();
+  gtk_container_add(GTK_CONTAINER(plot_edges_frame), plot_edges);
+
+  plot_exec_speed_frame = gtk_frame_new("Exec Speed");
+  gtk_container_set_border_width(GTK_CONTAINER(plot_exec_speed_frame), 5);
+  plot_exec_speed = gtk_socket_new();
+  gtk_container_add(GTK_CONTAINER(plot_exec_speed_frame), plot_exec_speed);
+
+  plot_high_freq_frame = gtk_frame_new("High Frequency");
+  gtk_container_set_border_width(GTK_CONTAINER(plot_high_freq_frame), 5);
+  plot_high_freq = gtk_socket_new();
+  gtk_container_add(GTK_CONTAINER(plot_high_freq_frame), plot_high_freq);
+
+  plot_low_freq_frame = gtk_frame_new("Low Frequency");
+  gtk_container_set_border_width(GTK_CONTAINER(plot_low_freq_frame), 5);
+  plot_low_freq = gtk_socket_new();
+  gtk_container_add(GTK_CONTAINER(plot_low_freq_frame), plot_low_freq);
+
+  separator_min1 = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
+  separator_min2 = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
+  separator_min3 = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
+
+  gtk_box_pack_start(GTK_BOX(plots_vbox), plot_edges_frame, TRUE, TRUE, 1);
+  gtk_box_pack_start(GTK_BOX(plots_vbox), separator_min1, FALSE, TRUE, 1);
+
+  gtk_box_pack_start(GTK_BOX(plots_vbox), plot_exec_speed_frame, TRUE, TRUE, 1);
+  gtk_box_pack_start(GTK_BOX(plots_vbox), separator_min2, FALSE, TRUE, 1);
+
+  gtk_box_pack_start(GTK_BOX(plots_vbox), plot_high_freq_frame, TRUE, TRUE, 1);
+  gtk_box_pack_start(GTK_BOX(plots_vbox), separator_min3, FALSE, TRUE, 1);
+
+  gtk_box_pack_start(GTK_BOX(plots_vbox), plot_low_freq_frame, TRUE, TRUE, 1);
+
+  gtk_box_pack_start(GTK_BOX(main_vbox), plots_vbox, TRUE, TRUE, 1);
+
+  gtk_container_add(GTK_CONTAINER(window), main_vbox);
+
+  guint id_edges = gtk_socket_get_id(GTK_SOCKET(plot_edges));
+  guint id_exec_speed = gtk_socket_get_id(GTK_SOCKET(plot_exec_speed));
+  guint id_high_freq = gtk_socket_get_id(GTK_SOCKET(plot_high_freq));
+  guint id_low_freq = gtk_socket_get_id(GTK_SOCKET(plot_low_freq));
+
+  printf("%x\n%x\n%x\n%x\n", id_edges, id_exec_speed, id_high_freq,
+         id_low_freq);
+
+  fclose(stdout);
+
+  g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit),
+                   NULL);
+  gtk_widget_show_all(window);
+  gtk_window_maximize(GTK_WINDOW(window));
+  gtk_main();
+
+  return EXIT_SUCCESS;
+
+}
+
+static void plot_toggled(GtkWidget *caller, gpointer data) {
+
+  gboolean state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(caller));
+
+  GtkWidget *widget = *(GtkWidget **)data;
+
+  if (state) {
+
+    gtk_widget_show(widget);
+
+  } else {
+
+    gtk_widget_hide(widget);
+
+  }
+
+}
diff --git a/utils/qbdi_mode/README.md b/utils/qbdi_mode/README.md
index 334199f2..a68da616 100755
--- a/utils/qbdi_mode/README.md
+++ b/utils/qbdi_mode/README.md
@@ -1,7 +1,7 @@
 # qbdi-based binary-only instrumentation for afl-fuzz
 
 NOTE: this code is outdated and first would need to be adapted to the current
-afl++ versions first.
+AFL++ versions first.
 Try frida_mode/ or fpicker [https://github.com/ttdennis/fpicker/](https://github.com/ttdennis/fpicker/) first, maybe they suite your need.
 
 ## 1) Introduction
diff --git a/utils/socket_fuzzing/README.md b/utils/socket_fuzzing/README.md
index 79f28bea..84398a71 100644
--- a/utils/socket_fuzzing/README.md
+++ b/utils/socket_fuzzing/README.md
@@ -8,4 +8,4 @@ a network socket.
 This is desock_dup.c from the amazing preeny project
 https://github.com/zardus/preeny
 
-It is packaged in afl++ to have it at hand if needed
+It is packaged in AFL++ to have it at hand if needed