etc~ scripts and random things |
| git clone https://github.com/djnnvx/etc.git |
| log | files | refs | archive |
install-fuzzing-tools.sh (3081B)
1 #!/bin/env bash 2 3 set -euo pipefail 4 5 export LLVM_VERSION=18 6 export LLVM_CONFIG=llvm-config-18 7 8 export CARGO_HOME="$HOME/.cargo" 9 export RUSTUP="$CARGO_HOME/bin/rustup" 10 export CARGO="$CARGO_HOME/bin/cargo" 11 export RUSTC="$CARGO_HOME/bin/rustc" 12 13 # Remove previously failed repository attempts if any 14 sudo rm -f /etc/apt/sources.list.d/archive_uri-http_apt_llvm_org_questing_-questing.list 15 sudo rm -f /etc/apt/sources.list.d/llvm.list 16 17 install_deps() { 18 echo "[+] Installing system dependencies" 19 sudo apt-get update 20 sudo apt-get install -y build-essential python3-dev automake cmake git flex bison \ 21 libglib2.0-dev libpixman-1-dev python3-setuptools libgtk-3-dev \ 22 ninja-build cpio libcapstone-dev wget curl python3-pip pipx binutils-dev \ 23 cppcheck libunwind-dev libblocksruntime-dev gpg software-properties-common 24 25 # Get GCC version for plugin headers 26 GCC_VER=$(gcc --version | head -n1 | cut -d' ' -f3 | cut -d'.' -f1) 27 sudo apt-get install -y "gcc-${GCC_VER}-plugin-dev" "libstdc++-${GCC_VER}-dev" 28 } 29 30 install_rust() { 31 echo "[+] Installing/Updating Rust" 32 33 if [ ! -f "$RUSTUP" ]; then 34 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable 35 fi 36 37 # Explicitly update to latest stable (1.89+) 38 "$RUSTUP" update stable 39 "$RUSTUP" default stable 40 41 echo "[*] Verified Rust version: $("$RUSTC" --version)" 42 } 43 44 install_llvm() { 45 echo "[+] Installing LLVM ${LLVM_VERSION}" 46 47 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor --yes -o /usr/share/keyrings/llvm-archive-keyring.gpg 48 49 # Using 'noble' because Ubuntu 25 (plucky/oracular) isn't on the LLVM repo servers yet 50 echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-${LLVM_VERSION} main" | sudo tee /etc/apt/sources.list.d/llvm.list 51 52 sudo apt-get update 53 sudo apt-get install -y clang-${LLVM_VERSION} lldb-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION}-dev 54 55 # Ensure LLVM_CONFIG is kept for sudo make install steps 56 echo "Defaults env_keep += \"LLVM_CONFIG\"" | sudo tee /etc/sudoers.d/llvm_env 57 } 58 59 install_libafl() { 60 echo "[+] Installing LibAFL" 61 62 "$CARGO" install cargo-make || true 63 64 if [ ! -d "libafl" ]; then 65 git clone https://github.com/AFLplusplus/LibAFL libafl --branch=main 66 fi 67 68 cd libafl 69 # Explicitly use the new cargo binary 70 "$CARGO" build --release 71 cd .. 72 } 73 74 install_aflpp() { 75 echo "[+] Installing AFL++" 76 [ -d "aflpp" ] || git clone https://github.com/AFLplusplus/AFLplusplus aflpp --branch=stable 77 cd aflpp 78 make clean 79 # Pass LLVM_CONFIG directly to make 80 LLVM_CONFIG=llvm-config-${LLVM_VERSION} make 81 sudo make install 82 cd - 83 } 84 85 install_honggfuzz() { 86 echo "[+] Installing honggfuzz" 87 [ -d "honggfuzz" ] || git clone https://github.com/google/honggfuzz 88 cd honggfuzz 89 make 90 sudo make install 91 cd .. 92 } 93 94 # --- MAIN --- 95 install_deps 96 install_rust 97 install_llvm 98 install_libafl 99 install_aflpp 100 install_honggfuzz