Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active August 29, 2015 13:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkuchiki/10716070 to your computer and use it in GitHub Desktop.
Save tkuchiki/10716070 to your computer and use it in GitHub Desktop.
https を使っているかチェック
#!/bin/bash
DOMAIN=$1
LIST=$2
TIMEOUT=${3:-5}
https() {
_DOMAIN="${1}"
_SUB_DOMAIN="${2}"
if [ "${_SUB_DOMAIN}" = "" ] ; then
echo "https://${_DOMAIN}"
else
echo "https://${_SUB_DOMAIN}.${_DOMAIN}"
fi
}
check() {
_DOMAIN="${1}"
_SUB_DOMAIN="${2}"
_URL=`https "${_DOMAIN}" "${_SUB_DOMAIN}"`
if curl --connect-timeout $TIMEOUT -s $_URL > /dev/null 2>&1 ; then
echo "${_URL}"
fi
}
for SUB_DOMAIN in `awk -F ' ' '$1 ~ /^(a|cname)/ { print $2 }' $LIST`; do
check "${DOMAIN}" "${SUB_DOMAIN}"
done
# naked domain
check "${DOMAIN}"
a SUB_DOMAIN IP_ADDR|DOMAIN
cname SUB_DOMAIN IP_ADDR|DOMAIN
...
のような形式のテキストを入力に、curl https://domain を連打して https を使っているドメインを洗い出す
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment