#!/bin/bash | |
display_usage() { | |
echo "This script check connection to list of URLs with specified host." | |
echo -e "\nUsage:\n$0 ipsfile hostname\n" | |
echo -e "\nExample:\n$0 moz-com.list moz.com\n" | |
} | |
if [ $# -le 1 ] | |
then | |
display_usage | |
exit 1 | |
fi | |
while read -r line; do | |
response_http=$(curl -H "Host: $2" --connect-timeout 5 --write-out "code: %{http_code}, length: %{size_download}, redirect: %{redirect_url}" --silent --output /dev/null -k http://$line) | |
response_https=$(curl -H "Host: $2" --connect-timeout 5 --write-out "code: %{http_code}, length: %{size_download}, redirect: %{redirect_url}" --silent --output /dev/null -k https://$line) | |
echo "HTTP: $line response [ $response_http ]" | |
echo "HTTPS: $line response [ $response_https ]" | |
done < "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment