BloodHoundNuke.sh
This is for nuking a BloodHound install that is misbehaving.
#!/bin/bash
# Stop and remove specified containers
containers=(
"desktop_app-db_1"
"desktop_bloodhound_1"
"desktop_graph-db_1"
)
echo "Stopping and removing containers..."
for container in "${containers[@]}"; do
if docker ps -a --format '{{.Names}}' | grep -q "^${container}$"; then
docker stop "${container}" 2>/dev/null
docker rm "${container}" 2>/dev/null
echo "Removed container: ${container}"
else
echo "Container not found: ${container}"
fi
done
# Remove specified volumes
volumes=(
"desktop_neo4j-data"
"desktop_postgres-data"
"sevminsec_neo4j-data"
"sevminsec_postgres-data"
"tmp_neo4j-data"
"tmp_postgres-data"
)
echo "Removing volumes..."
for volume in "${volumes[@]}"; do
if docker volume ls --format '{{.Name}}' | grep -q "^${volume}$"; then
docker volume rm "${volume}" 2>/dev/null
echo "Removed volume: ${volume}"
else
echo "Volume not found: ${volume}"
fi
done
# Remove specified images
images=(
"neo4j:4.4"
"specterops/bloodhound"
"postgres:16"
)
echo "Removing images..."
for image in "${images[@]}"; do
if docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^${image}$"; then
docker rmi -f "${image}" 2>/dev/null
echo "Removed image: ${image}"
else
echo "Image not found: ${image}"
fi
done
echo "Docker cleanup complete!"
# List remaining resources
echo -e "\nChecking remaining resources..."
echo -e "\nRemaining Containers:"
docker ps -a | grep -E 'bloodhound|neo4j|postgres'
echo -e "\nRemaining Volumes:"
docker volume ls | grep -E 'neo4j-data|postgres-data'
echo -e "\nRemaining Images:"
docker images | grep -E 'neo4j|bloodhound|postgres'