Skip to content

Instantly share code, notes, and snippets.

@nobiit
Created August 9, 2022 07:28
Show Gist options
  • Save nobiit/fa093e12e931057b9bbda35f020b18b4 to your computer and use it in GitHub Desktop.
Save nobiit/fa093e12e931057b9bbda35f020b18b4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
DOMAIN=${1}
URI=${2}
printf "Testing HTTP Status for %s ...\n" ${DOMAIN}
for item in $(dig +short ${DOMAIN} | sort); do
if [[ ${item} =~ ^[0-9.]+$ ]]; then
printf "%15s ..... " ${item}
status=$(curl -s -I -o /dev/null -w "%{http_code}" --resolve "${DOMAIN}:443:${item}" https://${DOMAIN}/${URI} || true)
if [ ${status} == 200 ]; then
echo OK
else
echo ${status}
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment