From f25e045e6f0056ddb8e7866fd5c33ea6f0675a74 Mon Sep 17 00:00:00 2001 From: Nils Date: Mon, 8 Mar 2021 14:36:44 +0100 Subject: [PATCH] tweaked windows detection, added url detection to ipv6 --- conn.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) mode change 100644 => 100755 conn.sh diff --git a/conn.sh b/conn.sh old mode 100644 new mode 100755 index 18d63f1..c554bd1 --- a/conn.sh +++ b/conn.sh @@ -115,6 +115,10 @@ fi exit elif [[ $1 == "-6" ]] || [[ "$1" == "--force-ipv6" ]];then echo "-6 used, forcing IPv6 portscanning" + if [[ "$2" =~ http ]];then + echo "url detected, exiting" + exit + fi echo "checking connection status for $2" fping=$(fping -6 -a $2) p135=$(nping -6 -q1 -c1 -p135 $2) @@ -241,11 +245,16 @@ fi fping=$(fping -a $2) p135=$(nping -q1 -c1 -p135 $2) p3389=$(nping -q1 -c1 -p3389 $2) - if [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then + if [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 0") ]];then echo "-------------------Availability----------------------" echo "note: this seems to be a unix machine which does respond to ICMP" notify-send "$2 is a unix machine" -u normal -t 30000 -a conn 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" + notify-send "$2 is a windows machine" -u normal -t 30000 -a conn + echo "-----------------------------------------------------" else while [[ -z $(nping -q1 -c1 -p135 $2 | grep "Successful connections: 1") ]]; do : done @@ -274,6 +283,10 @@ fi fi exit elif [[ ! "$1" =~ [0-9]{1,3}(\.[0-9]{1,3}){3} ]] && [[ "$1" =~ [:] ]] && [[ ! "$2" =~ [:] ]] && [[ -z "$3" ]];then + if [[ "$1" =~ http ]];then + echo "url detected, exiting" + exit + fi echo "detected IPv6 adress -> using -6" echo "checking connection status for $1" fping=$(fping -6 -a $1)