From 436c1f05630d2f97c29afd5f13d5f56475948181 Mon Sep 17 00:00:00 2001 From: Nils <32552517+byReqz@users.noreply.github.com> Date: Wed, 20 Jan 2021 12:57:43 +0000 Subject: [PATCH] temporarily removing os check again wait times are too long if the host doesnt respond --- conn.sh | 53 +---------------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/conn.sh b/conn.sh index 50e8765..e52d3d3 100644 --- a/conn.sh +++ b/conn.sh @@ -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 "-----------------------------------------------------"