Files
t3mp3st/scripts/check-tools-image.sh
monkeygold 571a7743ae fix(tools): run tools image as non-root operator (#114)
Stage ProjectDiscovery binaries before installing them into /usr/local/bin, run the tools image as the existing Kali operator identity, preserve runtime access to Foundry tools, and cover the non-root Dockerfile and smoke-test contracts.
2026-07-30 23:38:03 -04:00

43 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Presence smoke-test for the cybench CTF-tools image. Build-time only: it does
# NOT build the image — it runs an existing image and asserts the RE/crypto
# tooling the agent's TOOLS_SYSTEM prompt promises is actually present.
#
# Usage: scripts/check-tools-image.sh [IMAGE] (default: cybench-tools:latest)
# Exit non-zero if any check fails so it is CI-usable.
set -euo pipefail
IMAGE="${1:-cybench-tools:latest}"
# Docker-less environments (e.g. CI lint stage, the dev macbook without Docker)
# must not hard-fail — presence smoke is inherently build-time.
if ! command -v docker >/dev/null 2>&1; then
echo "docker not available; skipping (presence smoke is build-time only)"
exit 0
fi
echo "Checking tools image: $IMAGE"
docker run --rm --platform linux/amd64 "$IMAGE" bash -c '
set -e
fail=0
for c in radare2 gdb objdump upx; do
if command -v "$c" >/dev/null 2>&1; then
echo " ok bin $c"
else
echo " FAIL bin $c missing"; fail=1
fi
done
if python3 -c "import z3, sympy, pwn, fpylll, Crypto" 2>/dev/null; then
echo " ok py z3,sympy,pwn,fpylll,Crypto importable"
else
echo " FAIL py one of z3/sympy/pwn/fpylll/Crypto failed to import"; fail=1
fi
if command -v pip-audit >/dev/null 2>&1 && pip-audit --version >/dev/null 2>&1; then
echo " ok bin pip-audit ($(pip-audit --version 2>&1 | head -1))"
else
echo " FAIL bin pip-audit missing or non-functional"; fail=1
fi
exit $fail
'
echo "tools-image presence smoke PASSED"