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

temporarily removing os check again

wait times are too long if the host doesnt respond
This commit is contained in:
Nils 2021-01-20 12:57:43 +00:00 committed by GitHub
parent c72d5ab03f
commit 436c1f0563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

53
conn.sh
View File

@ -42,13 +42,6 @@ fi
exit
elif [[ $1 == "-y" ]] || [[ $1 == "-p" ]] || [[ "$1" == "--portscan" ]] || [[ "$1" == "--yes" ]];then
echo "checking connection status for $2"
if [[ -n $(nmap -p22 $1 | grep open) ]] && [[ -z $(nmap -p222 $1 | grep open) ]];then
echo "note: system seems to be a linux machine"
echo ""
elif [[ -n $(nmap -p3389 $1 | grep open) ]];then
echo "note: system seems to be a windows server machine"
echo ""
fi
echo "-------------------Availability----------------------"
fping -e $2
echo "-----------------------------------------------------"
@ -60,13 +53,6 @@ fi
exit
elif [[ $1 == "-n" ]] || [[ "$1" == "--no" ]];then
echo "checking connection status for $2"
if [[ -n $(nmap -p22 $1 | grep open) ]] && [[ -z $(nmap -p222 $1 | grep open) ]];then
echo "note: system seems to be a linux machine"
echo ""
elif [[ -n $(nmap -p3389 $1 | grep open) ]];then
echo "note: system seems to be a windows server machine"
echo ""
fi
echo "-------------------Availability----------------------"
fping -e $2
echo "-----------------------------------------------------"
@ -74,12 +60,6 @@ fi
elif [[ $1 == "-6" ]] || [[ "$1" == "--force-ipv6" ]];then
echo "-6 used, forcing IPv6 portscanning"
echo "checking connection status for $2"
if [[ -n $(nmap -6 -p22 $1 | grep open) ]] && [[ -z $(nmap -6 -p222 $1 | grep open) ]];then
echo "note: system seems to be a linux machine"
echo ""
elif [[ -n $(nmap -6 -p3389 $1 | grep open) ]];then
echo "note: system seems to be a windows server machine"
echo ""
fi
echo "-------------------Availability----------------------"
fping -6 -e $2
@ -93,13 +73,6 @@ fi
elif [[ $1 == "-4" ]] || [[ "$1" == "--force-ipv4" ]];then
echo "-4 used, forcing IPv4 portscanning"
echo "checking connection status for $2"
if [[ -n $(nmap -p22 $1 | grep open) ]] && [[ -z $(nmap -p222 $1 | grep open) ]];then
echo "note: system seems to be a linux machine"
echo ""
elif [[ -n $(nmap -p3389 $1 | grep open) ]];then
echo "note: system seems to be a windows server machine"
echo ""
fi
echo "-------------------Availability----------------------"
fping -4 -e $2
echo "-----------------------------------------------------"
@ -125,21 +98,9 @@ fi
elif [[ "$1" == "-w" ]] || [[ "$1" == "--wait" ]];then
echo "-w used, waiting for active connection"
echo "checking connection status for $2"
if [[ -n $(nmap -p22 $1 | grep open) ]] && [[ -z $(nmap -p222 $1 | grep open) ]];then
echo "note: system seems to be a linux machine"
echo ""
elif [[ -n $(nmap -p3389 $1 | grep open) ]];then
echo "note: system seems to be a windows server machine, it might not respond to icmp"
echo ""
fi
while [[ "$(fping -m -q -u $2)" == "$2" ]]; do :
done
notify-send "$2 is now reachable" -u normal -t 15000 -a conn
if [[ -n $(nmap -p22 $1 | grep open) ]] && [[ -z $(nmap -p222 $1 | grep open) ]];then
notify-send "$2 seems to be booted into a linux install" -t 15000 -a conn -u normal
elif [[ -n $(nmap -p3389 $1 | grep open) ]];then
notify-send "$2 seems to be booted into a windows install" -t 15000 -a conn -u normal
fi
echo "-------------------Availability----------------------"
fping -e $2
echo "-----------------------------------------------------"
@ -159,12 +120,7 @@ fi
elif [[ ! "$1" =~ [0-9]{1,3}(\.[0-9]{1,3}){3} ]] && [[ "$1" =~ [:] ]] && [[ ! "$2" =~ [:] ]] && [[ -z "$3" ]];then
echo "detected IPv6 adress -> using -6"
echo "checking connection status for $1"
if [[ -n $(nmap -6 -p22 $1 | grep open) ]] && [[ -z $(nmap -6 -p222 $1 | grep open) ]];then
echo "note: system seems to be a linux machine"
echo ""
elif [[ -n $(nmap -6 -p3389 $1 | grep open) ]];then
echo "note: system seems to be a windows server machine"
echo ""
fi
echo "-------------------Availability----------------------"
fping -6 -e $1
@ -195,13 +151,6 @@ fi
exit
else
echo "checking connection status for $1"
if [[ -n $(nmap -p22 $1 | grep open) ]] && [[ -z $(nmap -p222 $1 | grep open) ]];then
echo "note: system seems to be a linux machine"
echo ""
elif [[ -n $(nmap -p3389 $1 | grep open) ]];then
echo "note: system seems to be a windows server machine"
echo ""
fi
echo "-------------------Availability----------------------"
fping -e $1
echo "-----------------------------------------------------"