about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--docs/ChangeLog3
-rw-r--r--llvm_mode/Makefile25
-rw-r--r--llvm_mode/afl-clang-fast.c25
4 files changed, 39 insertions, 16 deletions
diff --git a/TODO b/TODO
index 51fd1f66..23bf688b 100644
--- a/TODO
+++ b/TODO
@@ -10,8 +10,6 @@ afl-fuzz:
 
 remote feature
 
-man:
- - man page for afl-clang-fast
 
 
 Roadmap 2.55d:
diff --git a/docs/ChangeLog b/docs/ChangeLog
index 61727852..cbc067ca 100644
--- a/docs/ChangeLog
+++ b/docs/ChangeLog
@@ -17,11 +17,12 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
 Version ++2.54d (dev):
 ----------------------
 
+  - persistent mode for QEMU (see qemu_mode/README.md)
   - no more unlinking the input file, this way the input file can also be a
     FIFO or disk partition
   - reducing duplicate code in afl-fuzz
-  - persistent mode for QEMU
   - removed compile warnings from python internal stuff
+  - added man page for afl-clang-fast[++]
   - updated documentation
 
 
diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile
index 6332b01a..823b491f 100644
--- a/llvm_mode/Makefile
+++ b/llvm_mode/Makefile
@@ -106,7 +106,6 @@ ifeq "$(TEST_MMAP)" "1"
         LDFLAGS += -lrt
 endif
 
-
 ifndef AFL_TRACE_PC
   PROGS      = ../afl-clang-fast ../afl-llvm-pass.so ../libLLVMInsTrim.so ../afl-llvm-rt.o ../afl-llvm-rt-32.o ../afl-llvm-rt-64.o ../compare-transform-pass.so ../split-compares-pass.so ../split-switches-pass.so
 else
@@ -118,7 +117,7 @@ ifneq "$(CLANGVER)" "$(LLVMVER)"
   CXX = $(shell llvm-config --bindir)/clang++
 endif
 
-all: test_shm test_deps $(PROGS) test_build all_done
+all: test_shm test_deps $(PROGS) afl-clang-fast.8 test_build all_done
 
 
 ifeq "$(SHMAT_OK)" "1"
@@ -199,6 +198,26 @@ all_done: test_build
 
 .NOTPARALLEL: clean
 
+%.8:	%
+	@echo .TH $* 8 `date -I` "afl++" > ../$@
+	@echo .SH NAME >> ../$@
+	@echo .B $* >> ../$@
+	@echo >> ../$@
+	@echo .SH SYNOPSIS >> ../$@
+	@./$* -h 2>&1 | head -n 3 | tail -n 1 | sed 's/^\.\///' >> ../$@
+	@echo >> ../$@
+	@echo .SH OPTIONS >> ../$@
+	@echo .nf >> ../$@
+	@./$* -h 2>&1 | tail -n +4 >> ../$@
+	@echo >> ../$@
+	@echo .SH AUTHOR >> ../$@
+	@echo "afl++ was written by Michal \"lcamtuf\" Zalewski and is maintained by Marc \"van Hauser\" Heuse <mh@mh-sec.de>, Heiko \"hexc0der\" Eissfeldt <heiko.eissfeldt@hexco.de> and Andrea Fioraldi <andreafioraldi@gmail.com>" >> ../$@
+	@echo  The homepage of afl++ is: https://github.com/vanhauser-thc/AFLplusplus >> ../$@
+	@echo >> ../$@
+	@echo .SH LICENSE >> ../$@
+	@echo Apache License Version 2.0, January 2004 >> ../$@
+	ln -sf afl-clang-fast.8 ../afl-clang-fast++.8
+
 clean:
 	rm -f *.o *.so *~ a.out core core.[1-9][0-9]* .test2 test-instr .test-instr0 .test-instr1 
-	rm -f $(PROGS) ../afl-clang-fast++
+	rm -f $(PROGS) ../afl-clang-fast++ ../afl-clang-fast*.8
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index 2c25f4de..1925f5f8 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -375,20 +375,16 @@ static void edit_params(u32 argc, char** argv) {
 
 int main(int argc, char** argv) {
 
-  if (isatty(2) && !getenv("AFL_QUIET")) {
+  if (argc < 2 || strcmp(argv[1], "-h") == 0) {
 
 #ifdef USE_TRACE_PC
-    SAYF(cCYA "afl-clang-fast" VERSION cRST
-              " [tpcg] by <lszekeres@google.com>\n");
+    printf(cCYA "afl-clang-fast" VERSION cRST
+                " [tpcg] by <lszekeres@google.com>\n"
 #else
-    SAYF(cCYA "afl-clang-fast" VERSION cRST " by <lszekeres@google.com>\n");
+    printf(cCYA "afl-clang-fast" VERSION cRST " by <lszekeres@google.com>\n"
 #endif                                                     /* ^USE_TRACE_PC */
-
-  }
-
-  if (argc < 2) {
-
-    SAYF(
+        "\n"
+        "afl-clang-fast[++] [options]\n"
         "\n"
         "This is a helper application for afl-fuzz. It serves as a drop-in "
         "replacement\n"
@@ -412,6 +408,15 @@ int main(int argc, char** argv) {
 
     exit(1);
 
+  } else if (isatty(2) && !getenv("AFL_QUIET")) {
+
+#ifdef USE_TRACE_PC
+    SAYF(cCYA "afl-clang-fast" VERSION cRST
+              " [tpcg] by <lszekeres@google.com>\n");
+#else
+    SAYF(cCYA "afl-clang-fast" VERSION cRST " by <lszekeres@google.com>\n");
+#endif                                                     /* ^USE_TRACE_PC */
+
   }
 
   find_obj(argv[0]);