From 08bbf40a71f324c272f109bcb5c59584dca0f4a1 Mon Sep 17 00:00:00 2001 From: Madalina Stoicov Date: Mon, 25 Nov 2024 16:27:09 +0000 Subject: [PATCH 1/2] Added README.txt and setup.sh --- README.txt | 22 ++++++++++++++++++++++ setup.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 README.txt create mode 100755 setup.sh diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..9471c88 --- /dev/null +++ b/README.txt @@ -0,0 +1,22 @@ +This is a README that contains directions for setting up and compiling the +fuzzing target. + +Set up fuzzer: +Run ./packages.sh + 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 names "fuzzing". +Run ./gitclonecompile.sh + This script will import and setup the OptFuzz directory. This script + should be run in the same clean "fuzzing" directory where + packages.sh was run. It will create an OptFuzzer 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 + From 354a11d11af9185ddecd9f10f623d188aa908cd1 Mon Sep 17 00:00:00 2001 From: Madalina Stoicov Date: Mon, 25 Nov 2024 16:27:09 +0000 Subject: [PATCH 2/2] Added README.txt and setup.sh --- README.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index 9471c88..98d27cd 100644 --- a/README.txt +++ b/README.txt @@ -2,16 +2,15 @@ This is a README that contains directions for setting up and compiling the fuzzing target. Set up fuzzer: -Run ./packages.sh +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 names "fuzzing". -Run ./gitclonecompile.sh - This script will import and setup the OptFuzz directory. This script - should be run in the same clean "fuzzing" directory where - packages.sh was run. It will create an OptFuzzer subdirectory. - + 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