-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_prerequisites.sh
executable file
·42 lines (33 loc) · 1.37 KB
/
install_prerequisites.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
#!/bin/bash
# Get prerequicites.
sudo apt-get -y install git build-essential inotify-tools libasan2 cpufrequtils
# Install AFL-fuzzer.
( wget http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz && tar xvf afl-latest.tgz && cd afl-* && make && sudo make install && cd $OLDPWD && rm -rf afl-* ) >/dev/null
afl-gcc --version
# Set required system configurations for AFL.
sudo sh -c "echo kernel.core_pattern=core >>/etc/sysctl.conf"
sudo cpufreq-set -g performance
sudo sysctl -p
# Create temporary ramdisk for fuzzing.
if mountpoint -q "/fuzz/tmpfs" ; then
echo "Tmpfs already mounted, not mounting"
else
echo "Creating and mounting tmpfs"
sudo mkdir -p /fuzz/tmpfs
sudo mount -t tmpfs -o size=32G tmpfs /fuzz/tmpfs
sudo mkdir /fuzz/backup
sudo chown -R $(logname):$(logname) /fuzz
fi
# Make sure that fuzzer results are backed up every hour.
sudo cp -f backup-fuzzer /etc/cron.hourly/
# Create a fuzzer user for the fuzzing-service.
sudo useradd fuzzer
sudo chown -R fuzzer:fuzzer /fuzz
sudo chown -R root:root /opt/afl-control
sudo chmod -R 0755 /opt/afl-control
sudo cp fuzzer.service /etc/systemd/system/fuzzer.service
# Install Ajenti.
wget -O- https://raw.github.com/ajenti/ajenti/1.x/scripts/install-ubuntu.sh | sudo sh
# Install fuzzer service.
sudo ln -s /opt/afl-control/fuzzer.service /etc/systemd/system/fuzzer.service
# TODO Install Ajenti config and plugins.