forked from ChatAFLndss/ChatAFL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·49 lines (37 loc) · 1.44 KB
/
setup.sh
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
45
46
47
48
49
#!/bin/bash
if [ -z $KEY ]; then
echo "NO OPENAI API KEY PROVIDED! Please set the KEY environment variable"
exit 0
fi
# Update the openAI key
for x in ChatAFL ChatAFL-CL1 ChatAFL-CL2 ChatAFL-SEED ChatAFL-BIN;
do
sed -i "s/#define OPENAI_TOKEN \".*\"/#define OPENAI_TOKEN \"$KEY\"/" $x/chat-llm.h
done
for y in DICOM/Dcmtk DNS/Dnsmasq DTLS/TinyDTLS SSH/OpenSSH;
do
sed -i "s/ENV OPENAI_API_KEY=\".*\"/ENV OPENAI_API_KEY=\"$KEY\"/" benchmark/subjects/$y/Dockerfile
done
for y in DAAP/forked-daapd FTP/BFTPD FTP/LightFTP FTP/ProFTPD FTP/PureFTPD HTTP/Lighttpd1 RTSP/Live555 SIP/Kamailio SMTP/Exim;
do
sed -i "s/ENV OPENAI_API_KEY=\".*\"/ENV OPENAI_API_KEY=\"$KEY\"/" benchmark/subjects/$y/Dockerfile
done
# Copy the different versions of ChatAFL to the benchmark directories
for subject in ./benchmark/subjects/*/*; do
rm -r $subject/aflnet 2>&1 >/dev/null
cp -r aflnet $subject/aflnet
rm -r $subject/chatafl 2>&1 >/dev/null
cp -r ChatAFL $subject/chatafl
rm -r $subject/chatafl-cl1 2>&1 >/dev/null
cp -r ChatAFL-CL1 $subject/chatafl-cl1
rm -r $subject/chatafl-cl2 2>&1 >/dev/null
cp -r ChatAFL-CL2 $subject/chatafl-cl2
rm -r $subject/chatafl-seed 2>&1 >/dev/null
cp -r ChatAFL-SEED $subject/chatafl-seed
rm -r $subject/chatafl-bin 2>&1 >/dev/null
cp -r ChatAFL-BIN $subject/chatafl-bin
done;
# Build the docker images
PFBENCH="$PWD/benchmark"
cd $PFBENCH
PFBENCH=$PFBENCH scripts/execution/profuzzbench_build_all.sh