-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrash_script
executable file
·45 lines (33 loc) · 959 Bytes
/
crash_script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
folder=$1 #fuzzer result folder
pno=$2 #port number
fmode=$3 #file mode -- structured or not
#fmode = 0: the test case is a concatenated message sequence -- there is no message boundary
#fmode = 1: the test case is a structured file keeping several request messages
#files stored in replayable-* folders are structured
#in such a way that messages are separated
testdir=
replayer=
if [ $fmode -eq "1" ]; then
testdir="replayable-crashes"
replayer="aflnet-replay"
else
testdir="crashes"
replayer="afl-replay"
fi
#process fuzzer-generated testcases
count=0
for f in $(echo $folder/$testdir/id* | grep -v "*"); do
echo $f
#terminate running server(s)
pkill fftp
ftpclean
$replayer $f FTP $pno 1 >/dev/null 2>&1 &
timeout -k 0 --preserve-status -s SIGUSR1 3s ./fftp fftp.conf $pno >/dev/null 2>&1
wait
if [ $? -ge 128 ]; then
echo "Terminated: $?"
fi
echo
echo
done