diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..98d27cd --- /dev/null +++ b/README.txt @@ -0,0 +1,21 @@ +This is a README that contains directions for setting up and compiling the +fuzzing target. + +Set up fuzzer: +Run ./setup.sh + This script contains two parts: install packages and compiling the + fuzzer. + This script will install the necessary packages needed by the fuzzer + and check for which version of the service is installed. The script + should be run in a clean fuzzing-specific directory named "fuzzing". + Later steps will not work if the directory is not named "fuzzing". + This script will then Git clone and setup the OptFuzz directory, + creating an OptFuzz subdirectory. +Compiling the target: +Navigate to the directory jsoncpp, which should be located as a sub-directory +in the fuzzing-specific directory. This script will only work if the +fuzzing-specific directory is named "fuzzing". +Run ./new_build_aflpp.sh + The script will clean out the jsoncpp subdirectory, run the pre- + installation script, and set various enviornment variables. It + will the perform various other operations to compile the target. diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..2257e16 --- /dev/null +++ b/setup.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +#install packages + + sudo apt-get update && sudo apt-get -y install --no-install-suggests --no-install-recommends automake cmake meson ninja-build bison flex build-essential git python3 python3-dev python3-setuptools python-is-python3 libtool libtool-bin libglib2.0-dev libcairo2-dev wget vim jupp nano bash-completion less apt-utils apt-transport-https ca-certificates gnupg dialog libpixman-1-dev gnuplot-nox unzip screen beanstalkd python3-pip python3-venv && sudo rm -rf /var/lib/apt/lists/* + +sudo apt-get update && sudo apt-get -y install --no-install-suggests --no-install-recommends lsb-release wget software-properties-common gnupg + +wget https://apt.llvm.org/llvm.sh +chmod +x llvm.sh +sudo ./llvm.sh 15 + +sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 10 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-15 --slave /usr/bin/opt opt /usr/bin/opt-15 + +sudo update-alternatives --install /usr/lib/llvm llvm /usr/lib/llvm-15 20 --slave /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-15 --slave /usr/bin/llvm-link llvm-link /usr/bin/llvm-link-15 + +# Import and setup OptFuzz + +# Check if OptFuzzer directory exists +if [ ! -d "OptFuzzer" ]; then + echo "OptFuzzer directory does not exist. Cloning repository..." + git clone https://github.com/FOX-Fuzz/FOX.git OptFuzzer +else + echo "OptFuzzer directory already exists. Skipping git clone." +fi + +cd ./OptFuzzer +export CC=clang-15 && export CXX=clang++-15 && make clean && \ + make + +# Check if the symbolic link already exists +if [ ! -L /usr/local/bin/llvm-nm ]; then + echo "Creating symbolic link for llvm-nm..." + sudo ln -s /usr/bin/llvm-nm-15 /usr/local/bin/llvm-nm +else + echo "Symbolic link for llvm-nm already exists. Skipping this step." +fi +