77 lines
1.7 KiB
Bash
Executable File
77 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
italic="\033[3m"
|
|
underline="\033[4m"
|
|
ita_under="\033[3;4m"
|
|
bgd="\033[1;4;31m"
|
|
red="\033[1;31m"
|
|
bold="\033[1m"
|
|
bold_ita="\033[1;3m"
|
|
box="\033[1;41m"
|
|
redbold="\033[1;31m"
|
|
redbox="\033[1;41m"
|
|
green="\033[0;32m"
|
|
greenbold="\033[1;32m"
|
|
reset="\033[0m"
|
|
|
|
: << 'COMMENTS'
|
|
echo "toto"
|
|
COMMENTS
|
|
|
|
cat < /dev/null > /dev/tcp/1.1.1.1/53
|
|
if [[ $? -ne 0 ]]; then
|
|
echo -e "\n${red}No Internet connection !${reset}"
|
|
echo -e "Exit !"
|
|
exit 1
|
|
fi
|
|
|
|
#urls=("https://clicclac.info" "https://clicclac.info/wordpress" "https://sur-le-sentier.fr" "https://maboiteverte.fr"
|
|
# "https://ds923.photos-nas.ovh" "https://portainer.photos-nas.ovh/" "https://dockge.photos-nas.ovh/" "https://kuma.photos-nas.ovh/")
|
|
urls=()
|
|
|
|
while read -r line
|
|
do
|
|
urls+=("$line")
|
|
done < urls_list.txt
|
|
|
|
check() {
|
|
website=$(echo "$1" | awk -F "\/\/" '{print $2}')
|
|
|
|
# https://developer.mozilla.org/fr/docs/Web/HTTP/Status
|
|
|
|
if wget --no-verbose --tries=1 --spider "$1" 2>&1 | grep -w "200\|301" ; then
|
|
#echo -e "${greenbold}$1 is up${reset}\n"
|
|
echo -e "${greenbold}$website is up${reset}\n"
|
|
else
|
|
echo -e "${redbold}$1 is down${reset}\n"
|
|
fi
|
|
}
|
|
|
|
check2() {
|
|
website=$(echo "$1" | awk -F "\/\/" '{print $2}')
|
|
response=$(curl --write-out '%{http_code}' --silent --output /dev/null "$1")
|
|
|
|
if [ $(grep -w "200\|301\|302\|303" <<< "$response") ];then
|
|
echo -e "${greenbold}$website is up${reset} ($response)\n"
|
|
else
|
|
echo -e "${redbold}$1 is down${reset} ($response)\n"
|
|
fi
|
|
}
|
|
|
|
info_cn() {
|
|
cn=$(echo | openssl s_client -connect $1 2>/dev/null | openssl x509 -noout -subject -dates -issuer)
|
|
}
|
|
|
|
: << 'COMMENTS2'
|
|
COMMENTS2
|
|
|
|
for url in "${!urls[@]}"
|
|
do
|
|
#check "${urls[$url]}"
|
|
check2 "${urls[$url]}"
|
|
|
|
done
|
|
|
|
|
|
# curl --write-out "%{json}" https://nextcloud.photos-nas.ovh | jq
|