Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*
Expand All @@ -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"
Expand All @@ -37,6 +37,7 @@ RUN apt-get update && \
libz3-dev \
ripgrep \
gawk \
jq \
libssl-dev \
sudo \
wget \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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/
Expand Down
4 changes: 3 additions & 1 deletion scripts/analyzer_installer.sh
Original file line number Diff line number Diff line change
@@ -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..."
Expand Down Expand Up @@ -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."
5 changes: 3 additions & 2 deletions scripts/echidna_installer.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
set -euo pipefail

# Installing echidna
echo "[$(date)] Install echidna"
# Getting bin version (THIS VERSION IS HARDCODED)
wget https://github.com/crytic/echidna/releases/download/v2.3.0/echidna-2.3.0-x86_64-linux.tar.gz -O echidna.tar.gz
# 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

4 changes: 2 additions & 2 deletions scripts/medusa_fuzzer.sh
Original file line number Diff line number Diff line change
@@ -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..."
Expand All @@ -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."

3 changes: 3 additions & 0 deletions scripts/noir_setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
set -euo pipefail

# Installs Noir in .nargo folder
source ~/.cargo/env && \
# Creates the bin folder
Expand All @@ -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
10 changes: 3 additions & 7 deletions scripts/pyrometer_installer.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -euo pipefail

# Ensure the CARGO_HOME/bin is in your PATH.
if [[ ":$PATH:" != *":$HOME/.cargo/bin:"* ]]; then
Expand All @@ -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!"
Expand Down
21 changes: 18 additions & 3 deletions scripts/quickpoc_installer.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions scripts/run_all_scripts.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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!"
4 changes: 4 additions & 0 deletions scripts/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ commands=(
)

# Check each command
failures=0
for cmd in "${commands[@]}"; do
echo "Testing $cmd..."
$cmd > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "✅ $cmd is available."
else
echo "❌ $cmd is NOT available."
failures=$((failures + 1))
fi
done

exit "$failures"
65 changes: 65 additions & 0 deletions tests/verify-image-tools.sh
Original file line number Diff line number Diff line change
@@ -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}"
'