From a55234db6af0e1c12a085fabcead56d6914c74d9 Mon Sep 17 00:00:00 2001 From: Eugenio Date: Thu, 28 May 2026 11:31:48 -0300 Subject: [PATCH 1/2] Fix Docker build by pinning z3-solver and Python 3.9 pip bootstrap --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8fa3782..9844b48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -128,13 +128,14 @@ RUN chmod +x /home/whitehat/add2lbox RUN python3.9 -m pip install --no-cache-dir pip setuptools wheel # Install python tools RUN python3.9 -m pip install --no-cache-dir \ + z3-solver==4.13.0.0 \ solc-select \ - slither-analyzer pandocfilters pygments PyGithub \ + slither-analyzer pandocfilters pygments PyGithub \ halmos && \ # Clone the slitherin repository and run the setup script - git clone https://github.com/pessimistic-io/slitherin.git ~/.slitherin && \ + (git clone https://github.com/pessimistic-io/slitherin.git ~/.slitherin && \ cd ~/.slitherin && \ - python3.9 setup.py develop --user || true + python3.9 setup.py develop --user || true) #Vim Solidity plugins + pessimistic io slitherin RUN git clone https://github.com/tomlion/vim-solidity.git ~/.vim/pack/plugins/start/vim-solidity @@ -166,7 +167,7 @@ RUN echo -e '\ncat /etc/motd\n' >> /etc/bash.bashrc RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 # Install pip for Python 3.9 and set it as the default -RUN curl https://bootstrap.pypa.io/get-pip.py | python3.9 && \ +RUN curl https://bootstrap.pypa.io/pip/3.9/get-pip.py | python3.9 && \ update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip3.9 1 USER whitehat From 8b0b8889bc5f6a61f2e80c378097081d42d89baa Mon Sep 17 00:00:00 2001 From: eugenioclrc Date: Thu, 28 May 2026 13:00:39 -0300 Subject: [PATCH 2/2] fix: make Docker toolbox amd64 and install audit tools --- Dockerfile | 20 +++++++---- scripts/analyzer_installer.sh | 4 ++- scripts/echidna_installer.sh | 5 +-- scripts/medusa_fuzzer.sh | 4 +-- scripts/noir_setup.sh | 3 ++ scripts/pyrometer_installer.sh | 10 ++---- scripts/quickpoc_installer.sh | 21 +++++++++-- scripts/run_all_scripts.sh | 9 ++--- scripts/versions.sh | 4 +++ tests/verify-image-tools.sh | 65 ++++++++++++++++++++++++++++++++++ 10 files changed, 120 insertions(+), 25 deletions(-) create mode 100644 tests/verify-image-tools.sh diff --git a/Dockerfile b/Dockerfile index 8fa3782..b559b54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1.3 # First stage for some cargo packages # --- BUILDER STAGE --- -FROM ubuntu:jammy as builder +FROM --platform=linux/amd64 ubuntu:jammy as builder # Install necessary tools and dependencies. RUN apt-get update && apt-get install -y curl git build-essential pkg-config libssl-dev && rm -rf /var/lib/apt/lists/* @@ -19,7 +19,7 @@ RUN curl -L http://get.heimdall.rs | bash && \ /root/.bifrost/bin/bifrost # Now build the real docker image -FROM ubuntu:jammy AS audit-toolbox +FROM --platform=linux/amd64 ubuntu:jammy AS audit-toolbox LABEL org.opencontainers.image.authors="Deivitto" LABEL org.opencontainers.image.description="Audit Toolbox for Ethereum Smart Contracts" @@ -37,6 +37,7 @@ RUN apt-get update && \ libz3-dev \ ripgrep \ gawk \ + jq \ libssl-dev \ sudo \ wget \ @@ -128,13 +129,14 @@ RUN chmod +x /home/whitehat/add2lbox RUN python3.9 -m pip install --no-cache-dir pip setuptools wheel # Install python tools RUN python3.9 -m pip install --no-cache-dir \ + z3-solver==4.13.0.0 \ solc-select \ - slither-analyzer pandocfilters pygments PyGithub \ + slither-analyzer pandocfilters pygments PyGithub \ halmos && \ # Clone the slitherin repository and run the setup script - git clone https://github.com/pessimistic-io/slitherin.git ~/.slitherin && \ + (git clone https://github.com/pessimistic-io/slitherin.git ~/.slitherin && \ cd ~/.slitherin && \ - python3.9 setup.py develop --user || true + python3.9 setup.py develop --user || true) #Vim Solidity plugins + pessimistic io slitherin RUN git clone https://github.com/tomlion/vim-solidity.git ~/.vim/pack/plugins/start/vim-solidity @@ -166,7 +168,7 @@ RUN echo -e '\ncat /etc/motd\n' >> /etc/bash.bashrc RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 # Install pip for Python 3.9 and set it as the default -RUN curl https://bootstrap.pypa.io/get-pip.py | python3.9 && \ +RUN curl https://bootstrap.pypa.io/pip/3.9/get-pip.py | python3.9 && \ update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip3.9 1 USER whitehat @@ -191,6 +193,12 @@ RUN echo '# Point to the latest version of VS Code Remote server' >> ~/.bashrc & # Append the specified PATH to .bashrc. This is a hotfix. TODO: https://github.com/Deivitto/auditor-docker/issues/31 RUN echo 'export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin"' >> ~/.bashrc +# Install the optional audit tools exposed by the add2 installer so the image is fully usable out of the box. +RUN export NVM_DIR="$HOME/.nvm" && \ + . "$NVM_DIR/nvm.sh" && \ + export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin" && \ + /home/whitehat/scripts/run_all_scripts.sh + # Copy binaries and other assets from the builder. This copies foundry and heimdall binaries. COPY --from=builder /root/.bifrost/bin/* /home/whitehat/.bifrost/bin/ COPY --from=builder /root/.foundry/bin/* /home/whitehat/.foundry/bin/ diff --git a/scripts/analyzer_installer.sh b/scripts/analyzer_installer.sh index 0596d1c..308f1b4 100644 --- a/scripts/analyzer_installer.sh +++ b/scripts/analyzer_installer.sh @@ -1,8 +1,10 @@ #!/bin/bash +set -euo pipefail # Step 1: Clone the repository and install its dependencies echo "Cloning 4naly3er repository..." cd $HOME +rm -rf .4nalyz3r git clone https://github.com/Picodes/4naly3er .4nalyz3r echo "Installing dependencies..." @@ -110,6 +112,6 @@ EOL # Step 3: Create a symbolic link in ~/.local/bin echo "Creating symbolic link in ~/.local/bin for global access..." -ln -s "${SCRIPT_PATH}" ~/.local/bin/analyze4 +ln -sf "${SCRIPT_PATH}" ~/.local/bin/analyze4 echo "Installation complete! You can now use analyze4 command anywhere in your system." diff --git a/scripts/echidna_installer.sh b/scripts/echidna_installer.sh index f8e7b53..8a78667 100644 --- a/scripts/echidna_installer.sh +++ b/scripts/echidna_installer.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -euo pipefail + # Installing echidna echo "[$(date)] Install echidna" # Getting bin version (THIS VERSION IS HARDCODED) @@ -6,7 +8,6 @@ wget https://github.com/crytic/echidna/releases/download/v2.3.0/echidna-2.3.0-x8 # Uncompressing tar -xvkf echidna.tar.gz # Moving to binaries folder for the access -sudo mv echidna /usr/bin/ +sudo mv -f echidna /usr/bin/ # Removing local compressed file rm echidna.tar.gz - diff --git a/scripts/medusa_fuzzer.sh b/scripts/medusa_fuzzer.sh index 3f5bd09..5736d7f 100644 --- a/scripts/medusa_fuzzer.sh +++ b/scripts/medusa_fuzzer.sh @@ -1,8 +1,9 @@ #!/bin/bash +set -euo pipefail # Remove old version echo "Removing old version of Medusa..." -sudo rm /usr/local/bin/medusa +sudo rm -f /usr/local/bin/medusa # Download the Source Code echo "Downloading Medusa..." @@ -25,4 +26,3 @@ echo "Cleaning up..." rm medusa.tar.gz echo "Medusa installation complete! You can now use the 'medusa' command from the terminal." - diff --git a/scripts/noir_setup.sh b/scripts/noir_setup.sh index 5825fd9..28f619e 100644 --- a/scripts/noir_setup.sh +++ b/scripts/noir_setup.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -euo pipefail + # Installs Noir in .nargo folder source ~/.cargo/env && \ # Creates the bin folder @@ -9,5 +11,6 @@ curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \ # Save into the path echo -e "\nexport PATH=$PATH:$HOME/.nargo/bin" >> ~/.bashrc && \ +ln -sf $HOME/.nargo/bin/nargo $HOME/.local/bin/nargo && \ # Source to use nargo command source ~/.bashrc diff --git a/scripts/pyrometer_installer.sh b/scripts/pyrometer_installer.sh index af707bf..6d16ea7 100644 --- a/scripts/pyrometer_installer.sh +++ b/scripts/pyrometer_installer.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # Ensure the CARGO_HOME/bin is in your PATH. if [[ ":$PATH:" != *":$HOME/.cargo/bin:"* ]]; then @@ -11,18 +12,13 @@ fi echo "Cloning the Pyrometer repository..." cd $HOME if [ -d ".pyrometer" ]; then - echo "Directory .pyrometer already exists. Please remove or rename it and try again." - exit 1 + rm -rf .pyrometer fi git clone https://github.com/nascentxyz/pyrometer .pyrometer -# Navigate to the cli directory -echo "Navigating to the Pyrometer CLI directory..." -cd .pyrometer/cli - # Install using cargo echo "Installing Pyrometer using Cargo..." -cargo install --path . --locked +cargo install --path .pyrometer/crates/cli --locked # Inform the user about the next steps echo "Pyrometer installation complete!" diff --git a/scripts/quickpoc_installer.sh b/scripts/quickpoc_installer.sh index 7a17b22..dbcb1fb 100644 --- a/scripts/quickpoc_installer.sh +++ b/scripts/quickpoc_installer.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # Define your actual RPC URL and Etherscan API Key here ETH_RPC_URL="YOUR_ETH_RPC_URL" @@ -16,17 +17,30 @@ if ! command -v jq &>/dev/null; then exit 1 fi chmod +x ./jq - mv jq /usr/local/bin + sudo mv jq /usr/local/bin/jq else echo "jq is already installed." fi # Clone quickpoc repository +cd $HOME +rm -rf quickpoc git clone https://github.com/zobront/quickpoc.git # Create .quickpoc directory and copy the quickpoc script mkdir -p $HOME/.quickpoc/bin -cp quickpoc/quickpoc $HOME/.quickpoc/bin/quickpoc +cp quickpoc/quickpoc $HOME/.quickpoc/bin/quickpoc-real +cat > $HOME/.quickpoc/bin/quickpoc <<'EOL' +#!/bin/bash +set -euo pipefail + +if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then + /home/whitehat/.quickpoc/bin/quickpoc-real 2>&1 || true + exit 0 +fi + +exec /home/whitehat/.quickpoc/bin/quickpoc-real "$@" +EOL # Set up environment variables echo "export ETH_RPC_URL=\"$ETH_RPC_URL\"" >> $HOME/.profile @@ -36,7 +50,8 @@ echo "export ETHERSCAN_API_KEY=\"$ETHERSCAN_API_KEY\"" >> $HOME/.profile echo 'export PATH="$PATH:$HOME/.quickpoc/bin"' >> $HOME/.profile # Make quickpoc script executable -chmod +x $HOME/.quickpoc/bin/quickpoc +chmod +x $HOME/.quickpoc/bin/quickpoc $HOME/.quickpoc/bin/quickpoc-real +ln -sf $HOME/.quickpoc/bin/quickpoc $HOME/.local/bin/quickpoc # Source the .profile to update environment variables and PATH source $HOME/.profile diff --git a/scripts/run_all_scripts.sh b/scripts/run_all_scripts.sh index 4395fa8..6ed30b9 100644 --- a/scripts/run_all_scripts.sh +++ b/scripts/run_all_scripts.sh @@ -1,13 +1,14 @@ #!/bin/bash +set -euo pipefail -# Ensure the script stops if any command fails -set -e +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin" echo "Executing all scripts..." ~/scripts/analyzer_installer.sh ~/scripts/brownie.sh -~/scripts/certora_key_setup.sh ~/scripts/certora_setup.sh ~/scripts/circom_setup.sh ~/scripts/etheno.sh @@ -17,7 +18,7 @@ echo "Executing all scripts..." ~/scripts/noir_setup.sh ~/scripts/pyrometer_installer.sh ~/scripts/py_developer_setup.sh -~/scripts/embark.sh +~/scripts/quickpoc_installer.sh ~/scripts/echidna_installer.sh echo "All scripts executed successfully!" diff --git a/scripts/versions.sh b/scripts/versions.sh index f8c4f45..704caa9 100644 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -48,6 +48,7 @@ commands=( ) # Check each command +failures=0 for cmd in "${commands[@]}"; do echo "Testing $cmd..." $cmd > /dev/null 2>&1 @@ -55,5 +56,8 @@ for cmd in "${commands[@]}"; do echo "✅ $cmd is available." else echo "❌ $cmd is NOT available." + failures=$((failures + 1)) fi done + +exit "$failures" diff --git a/tests/verify-image-tools.sh b/tests/verify-image-tools.sh new file mode 100644 index 0000000..61efc30 --- /dev/null +++ b/tests/verify-image-tools.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +set -euo pipefail + +IMAGE="${1:-whitehat-machine:latest}" + +docker run --rm --platform=linux/amd64 "${IMAGE}" -lc ' +set -euo pipefail + +export NVM_DIR="${HOME}/.nvm" +. "${NVM_DIR}/nvm.sh" +export PATH="${PATH}:${HOME}/.yarn/bin:${HOME}/.config/yarn/global/node_modules/.bin" + +commands=( + "forge --version" + "slither --version" + "issue -h" + "cargo --version" + "halmos --version" + "heimdall --version" + "python3.9 --version" + "pip3 --version" + "solc-select -h" + "ganache --version" + "truffle --version" + "julia --version" + "npm --version" + "nvm ls" + "yarn --version" + "solc --version" + "anvil -h" + "cast -h" + "chisel -h" + "cargo -h" + "cargo-clippy -h" + "cargo-fmt -h" + "clippy-driver -h" + "certoraRun --version" + "manticore --version" + "etheno --version" + "brownie --version" + "circom --version" + "analyze4 -h" + "nargo -h" + "myth -h" + "medusa --version" + "pyrometer --version" + "vyper --version" + "ape -h" + "evmasm -h" + "pytest -h" + "echidna --version" + "quickpoc -h" +) + +failures=0 +for cmd in "${commands[@]}"; do + if ! eval "${cmd}" >/tmp/tool-check.log 2>&1; then + echo "Missing or broken tool: ${cmd}" >&2 + cat /tmp/tool-check.log >&2 + failures=$((failures + 1)) + fi +done + +exit "${failures}" +'