Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.

Commit fcf734a

Browse files
Add option -V: Show version number and exit (#82)
* Add option -V to afl-analyze: Show version number and exit * Add option -V to afl-fuzz: Show version number and exit * Show option -V to afl-showmap: Show version number and exit * Add option -V to afl-tmin: Show version number and exit
1 parent fc718c7 commit fcf734a

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

afl-analyze.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,10 @@ static void usage(u8* argv0) {
822822

823823
" -e - look for edge coverage only, ignore hit counts\n\n"
824824

825+
"Other stuff:\n\n"
826+
827+
" -V - show version number and exit\n\n"
828+
825829
"For additional tips, please consult %s/README.\n\n",
826830

827831
argv0, EXEC_TIMEOUT, MEM_LIMIT, doc_path);
@@ -959,7 +963,7 @@ int main(int argc, char** argv) {
959963

960964
SAYF(cCYA "afl-analyze " cBRI VERSION cRST " by <[email protected]>\n");
961965

962-
while ((opt = getopt(argc,argv,"+i:f:m:t:eQ")) > 0)
966+
while ((opt = getopt(argc,argv,"+i:f:m:t:eQV")) > 0)
963967

964968
switch (opt) {
965969

@@ -1039,6 +1043,11 @@ int main(int argc, char** argv) {
10391043
qemu_mode = 1;
10401044
break;
10411045

1046+
case 'V': /* Show version number */
1047+
1048+
/* Version number has been printed already, just quit. */
1049+
exit(0);
1050+
10421051
default:
10431052

10441053
usage(argv[0]);

afl-fuzz.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7119,7 +7119,8 @@ static void usage(u8* argv0) {
71197119

71207120
" -T text - text banner to show on the screen\n"
71217121
" -M / -S id - distributed mode (see parallel_fuzzing.txt)\n"
7122-
" -C - crash exploration mode (the peruvian rabbit thing)\n\n"
7122+
" -C - crash exploration mode (the peruvian rabbit thing)\n"
7123+
" -V - show version number and exit\n\n"
71237124

71247125
"For additional tips, please consult %s/README.\n\n",
71257126

@@ -7776,7 +7777,7 @@ int main(int argc, char** argv) {
77767777
gettimeofday(&tv, &tz);
77777778
srandom(tv.tv_sec ^ tv.tv_usec ^ getpid());
77787779

7779-
while ((opt = getopt(argc, argv, "+i:o:f:m:t:T:dnCB:S:M:x:Q")) > 0)
7780+
while ((opt = getopt(argc, argv, "+i:o:f:m:t:T:dnCB:S:M:x:QV")) > 0)
77807781

77817782
switch (opt) {
77827783

@@ -7944,6 +7945,11 @@ int main(int argc, char** argv) {
79447945

79457946
break;
79467947

7948+
case 'V': /* Show version number */
7949+
7950+
/* Version number has been printed already, just quit. */
7951+
exit(0);
7952+
79477953
default:
79487954

79497955
usage(argv[0]);

afl-showmap.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@ static void usage(u8* argv0) {
495495

496496
" -q - sink program's output and don't show messages\n"
497497
" -e - show edge coverage only, ignore hit counts\n"
498-
" -c - allow core dumps\n\n"
498+
" -c - allow core dumps\n"
499+
" -V - show version number and exit\n\n"
499500

500501
"This tool displays raw tuple data captured by AFL instrumentation.\n"
501502
"For additional help, consult %s/README.\n\n" cRST,
@@ -634,7 +635,7 @@ int main(int argc, char** argv) {
634635

635636
doc_path = access(DOC_PATH, F_OK) ? "docs" : DOC_PATH;
636637

637-
while ((opt = getopt(argc,argv,"+o:m:t:A:eqZQbc")) > 0)
638+
while ((opt = getopt(argc,argv,"+o:m:t:A:eqZQbcV")) > 0)
638639

639640
switch (opt) {
640641

@@ -745,6 +746,11 @@ int main(int argc, char** argv) {
745746
keep_cores = 1;
746747
break;
747748

749+
case 'V':
750+
751+
show_banner();
752+
exit(0);
753+
748754
default:
749755

750756
usage(argv[0]);

afl-tmin.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,10 @@ static void usage(u8* argv0) {
833833
" -e - solve for edge coverage only, ignore hit counts\n"
834834
" -x - treat non-zero exit codes as crashes\n\n"
835835

836+
"Other stuff:\n\n"
837+
838+
" -V - show version number and exit\n\n"
839+
836840
"For additional tips, please consult %s/README.\n\n",
837841

838842
argv0, EXEC_TIMEOUT, MEM_LIMIT, doc_path);
@@ -986,7 +990,7 @@ int main(int argc, char** argv) {
986990

987991
SAYF(cCYA "afl-tmin " cBRI VERSION cRST " by <[email protected]>\n");
988992

989-
while ((opt = getopt(argc,argv,"+i:o:f:m:t:B:xeQ")) > 0)
993+
while ((opt = getopt(argc,argv,"+i:o:f:m:t:B:xeQV")) > 0)
990994

991995
switch (opt) {
992996

@@ -1098,6 +1102,11 @@ int main(int argc, char** argv) {
10981102
read_bitmap(optarg);
10991103
break;
11001104

1105+
case 'V': /* Show version number */
1106+
1107+
/* Version number has been printed already, just quit. */
1108+
exit(0);
1109+
11011110
default:
11021111

11031112
usage(argv[0]);

0 commit comments

Comments
 (0)