mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-02 13:30:42 +00:00
add afl-addseeds tool
This commit is contained in:
parent
d6b6278cb4
commit
6b73dee7da
@ -32,7 +32,7 @@ VERSION = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f
|
||||
# PROGS intentionally omit afl-as, which gets installed elsewhere.
|
||||
|
||||
PROGS = afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze
|
||||
SH_PROGS = afl-plot afl-cmin afl-cmin.bash afl-whatsup afl-system-config afl-persistent-config afl-cc
|
||||
SH_PROGS = afl-plot afl-cmin afl-cmin.bash afl-whatsup afl-addseeds afl-system-config afl-persistent-config afl-cc
|
||||
MANPAGES=$(foreach p, $(PROGS) $(SH_PROGS), $(p).8) afl-as.8
|
||||
ASAN_OPTIONS=detect_leaks=0
|
||||
|
||||
|
54
afl-addseeds
Executable file
54
afl-addseeds
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
test -z "$1" -o "$1" = "-h" -o "$1" = "--help" && {
|
||||
echo Syntax: afl-addseeds -o afl-out-dir [-i seed_file_or_dir] seed_file_or_seed_dir seed_file_or_seed_dir ...
|
||||
echo
|
||||
echo Options:
|
||||
echo " -o afl-out-dir the output directory being used in the fuzzing campaign"
|
||||
echo " -i seed_file_or_dir file or directory of files to add"
|
||||
echo
|
||||
echo Adds new seeds to an existing AFL++ fuzzing campaign.
|
||||
exit 0
|
||||
}
|
||||
|
||||
for TOOL in find ls; do
|
||||
X=`which $TOOL`
|
||||
test -n "$X" || { echo "Error: required tool '$TOOL' not found."; exit 1; }
|
||||
done
|
||||
|
||||
TEST=`printf %06d 123 2>/dev/null`
|
||||
test "$TEST" = "000123" || { echo "Error: required tool 'printf' not found."; exit 1; }
|
||||
|
||||
OUT=
|
||||
NEXT=
|
||||
for i in $*; do
|
||||
test -n "$NEXT" && { OUT=$i ; NEXT=""; }
|
||||
test "$i" = "-o" && { NEXT=1; }
|
||||
done
|
||||
|
||||
test -d "$OUT" || { echo Error: $OUT is not an existing directory; exit 1; }
|
||||
OK=`ls $OUT/*/fuzzer_stats 2>/dev/null`
|
||||
test -n "$OK" || { echo "Error: $OUT is not an 'afl-fuzz -o ... ' output directory" ; exit 1; }
|
||||
|
||||
OUTDIR=$OUT/addseeds/queue
|
||||
mkdir -p "$OUTDIR" 2>/dev/null
|
||||
test -d "$OUTDIR" || { echo Error: could not create $OUTDIR ; exit 1 ; }
|
||||
|
||||
echo Adding seeds ...
|
||||
NEXTID=0
|
||||
for i in $*; do
|
||||
test -z "$i" -o "$i" = "$OUT" -o "$i" = "-i" -o "$i" = "-o" || {
|
||||
find "$i" -type f | while read FILE; do
|
||||
N=xxx
|
||||
while [ -n "$N" ]; do
|
||||
ID=$NEXTID
|
||||
N=`ls "$OUTDIR/id:$(printf %06d $ID),"* 2>/dev/null`
|
||||
NEXTID=$(($NEXTID + 1))
|
||||
done
|
||||
FN=`echo "$FILE" | sed 's/.*\///'`
|
||||
cp -v "$FILE" "$OUTDIR/id:$(printf %06d $ID),time:0,execs:0,orig:$FN"
|
||||
done
|
||||
}
|
||||
done
|
||||
|
||||
echo Done.
|
@ -19,6 +19,7 @@
|
||||
- fix for a few string compare transform functions for LAF
|
||||
- frida_mode:
|
||||
- fixes support for large map offsets
|
||||
- added new tool afl-addseeds that adds new seeds to a running campaign
|
||||
- added benchmark/benchmark.sh if you want to see how good your fuzzing
|
||||
speed is in comparison to other setups.
|
||||
|
||||
|
@ -1346,6 +1346,12 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
|
||||
}
|
||||
|
||||
if (strcmp(afl->sync_id, "addseeds") == 0) {
|
||||
|
||||
FATAL("-M/-S name 'addseeds' is a reserved name, choose something else");
|
||||
|
||||
}
|
||||
|
||||
if (afl->is_main_node == 1 && afl->schedule != FAST &&
|
||||
afl->schedule != EXPLORE) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user