Last active
August 29, 2015 13:59
-
-
Save tkuchiki/10716070 to your computer and use it in GitHub Desktop.
https を使っているかチェック
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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