1
0
mirror of https://github.com/byReqz/conn.git synced 2024-11-21 16:43:14 +00:00

update windows detection for legacy options

This commit is contained in:
Nils 2021-04-15 09:21:31 +02:00
parent 783bc308a7
commit 6f57aa7965
Signed by: byreqz
GPG Key ID: 396A62D7D436749E

28
conn.sh
View File

@ -64,10 +64,15 @@ fi
fping=$(fping -a $2) fping=$(fping -a $2)
p135=$(nping -q1 -c1 -p135 $2) p135=$(nping -q1 -c1 -p135 $2)
p3389=$(nping -q1 -c1 -p3389 $2) p3389=$(nping -q1 -c1 -p3389 $2)
if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]] || [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does not respond to ICMP" echo "note: this seems to be a windows machine which does not respond to ICMP"
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
elif [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does respond to ICMP"
fping -e $2
echo "-----------------------------------------------------"
elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "$2 is not reachable" echo "$2 is not reachable"
@ -95,10 +100,15 @@ fi
fping=$(fping -a $2) fping=$(fping -a $2)
p135=$(nping -q1 -c1 -p135 $2) p135=$(nping -q1 -c1 -p135 $2)
p3389=$(nping -q1 -c1 -p3389 $2) p3389=$(nping -q1 -c1 -p3389 $2)
if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]] || [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does not respond to ICMP" echo "note: this seems to be a windows machine which does not respond to ICMP"
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
elif [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does respond to ICMP"
fping -e $2
echo "-----------------------------------------------------"
elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "$2 is not reachable" echo "$2 is not reachable"
@ -127,10 +137,15 @@ fi
fping=$(fping -6 -a $2) fping=$(fping -6 -a $2)
p135=$(nping -6 -q1 -c1 -p135 $2) p135=$(nping -6 -q1 -c1 -p135 $2)
p3389=$(nping -6 -q1 -c1 -p3389 $2) p3389=$(nping -6 -q1 -c1 -p3389 $2)
if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]] || [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does not respond to ICMP" echo "note: this seems to be a windows machine which does not respond to ICMP"
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
elif [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does respond to ICMP"
fping -e -6 $2
echo "-----------------------------------------------------"
elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "$2 is not reachable" echo "$2 is not reachable"
@ -160,10 +175,15 @@ fi
fping=$(fping -4 -a $2) fping=$(fping -4 -a $2)
p135=$(nping -4 -q1 -c1 -p135 $2) p135=$(nping -4 -q1 -c1 -p135 $2)
p3389=$(nping -4 -q1 -c1 -p3389 $2) p3389=$(nping -4 -q1 -c1 -p3389 $2)
if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]] || [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does not respond to ICMP" echo "note: this seems to be a windows machine which does not respond to ICMP"
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
elif [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does respond to ICMP"
fping -e -4 $2
echo "-----------------------------------------------------"
elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "$2 is not reachable" echo "$2 is not reachable"