mirror of
https://github.com/byReqz/conn.git
synced 2024-11-22 09:01:15 +00:00
add checks on port 80
This commit is contained in:
parent
f6c8aa2dd8
commit
318e450334
50
conn.sh
50
conn.sh
@ -22,6 +22,8 @@ fi
|
|||||||
echo " -f/ --fast -- disable os check"
|
echo " -f/ --fast -- disable os check"
|
||||||
echo " -s/ --simple -- same as -f"
|
echo " -s/ --simple -- same as -f"
|
||||||
echo " -ww/ --wait-windows -- same as -w but for windows machines"
|
echo " -ww/ --wait-windows -- same as -w but for windows machines"
|
||||||
|
echo " -ht/ --http -- ping on port 80"
|
||||||
|
echo " -wh/ --wait-http -- wait for ping on port 80"
|
||||||
exit
|
exit
|
||||||
done
|
done
|
||||||
while [ ! -z "$1" ]; do
|
while [ ! -z "$1" ]; do
|
||||||
@ -40,6 +42,8 @@ fi
|
|||||||
echo " -f/ --fast -- disable os check"
|
echo " -f/ --fast -- disable os check"
|
||||||
echo " -s/ --simple -- same as -f"
|
echo " -s/ --simple -- same as -f"
|
||||||
echo " -ww/ --wait-windows -- same as -w but for windows machines"
|
echo " -ww/ --wait-windows -- same as -w but for windows machines"
|
||||||
|
echo " -ht/ --http -- ping on port 80"
|
||||||
|
echo " -wh/ --wait-http -- wait for ping on port 80"
|
||||||
exit
|
exit
|
||||||
elif [[ $1 == "-m" ]] || [[ "$1" == "--multi" ]];then
|
elif [[ $1 == "-m" ]] || [[ "$1" == "--multi" ]];then
|
||||||
echo "multi-ip mode, portscan disabled"
|
echo "multi-ip mode, portscan disabled"
|
||||||
@ -368,6 +372,52 @@ fi
|
|||||||
fping -e -6 $@
|
fping -e -6 $@
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
exit
|
exit
|
||||||
|
elif [[ "$1" == "-ht" ]] || [[ "$1" == "--http" ]];then
|
||||||
|
echo "checking connection status for $2"
|
||||||
|
fping=$(nping -c1 -p80 $2)
|
||||||
|
if [[ -n $(echo $fping | grep "Successful connections: 1") ]];then
|
||||||
|
echo "-------------------Availability----------------------"
|
||||||
|
echo "$2 is reachable via port 80"
|
||||||
|
echo "-----------------------------------------------------"
|
||||||
|
else
|
||||||
|
echo "-------------------Availability----------------------"
|
||||||
|
echo "$2 is not reachable via port 80"
|
||||||
|
echo "-----------------------------------------------------"
|
||||||
|
fi
|
||||||
|
echo "portscan? (y/n) (default: y)"
|
||||||
|
read portscan
|
||||||
|
if [[ "$portscan" = "y" ]] || [[ -z "$portscan" ]]; then
|
||||||
|
echo "-------------------Portscan---------------------"
|
||||||
|
nmap --reason -Pn $2
|
||||||
|
echo ""
|
||||||
|
nping -c4 -p80 $2
|
||||||
|
echo "------------------------------------------------"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
elif [[ "$1" == "-wh" ]] || [[ "$1" == "--wait-http" ]];then
|
||||||
|
echo "-wh used, waiting for active connection"
|
||||||
|
echo "checking connection status for $2"
|
||||||
|
while [[ -z $(nping -c1 -p80 $2 | grep -e "Successful connections: 1") ]]; do :
|
||||||
|
done
|
||||||
|
echo "-------------------Availability----------------------"
|
||||||
|
echo "$2 is now reachable via port 80"
|
||||||
|
notify-send "$2 is now reachable via port 80" -u normal -t 30000 -a conn
|
||||||
|
echo "-----------------------------------------------------"
|
||||||
|
echo "portscan? (y/n) (default: y)"
|
||||||
|
read portscan
|
||||||
|
if [[ "$portscan" = "y" ]] || [[ -z "$portscan" ]]; then
|
||||||
|
echo "-------------------Portscan---------------------"
|
||||||
|
nmap --reason -Pn $2
|
||||||
|
echo ""
|
||||||
|
nping -c4 -p80 $2
|
||||||
|
echo "------------------------------------------------"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
exit
|
||||||
else
|
else
|
||||||
echo "checking connection status for $1"
|
echo "checking connection status for $1"
|
||||||
fping=$(fping -a $1)
|
fping=$(fping -a $1)
|
||||||
|
Loading…
Reference in New Issue
Block a user