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:
parent
c72d5ab03f
commit
436c1f0563
53
conn.sh
53
conn.sh
@ -42,13 +42,6 @@ fi
|
|||||||
exit
|
exit
|
||||||
elif [[ $1 == "-y" ]] || [[ $1 == "-p" ]] || [[ "$1" == "--portscan" ]] || [[ "$1" == "--yes" ]];then
|
elif [[ $1 == "-y" ]] || [[ $1 == "-p" ]] || [[ "$1" == "--portscan" ]] || [[ "$1" == "--yes" ]];then
|
||||||
echo "checking connection status for $2"
|
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----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping -e $2
|
fping -e $2
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
@ -60,13 +53,6 @@ fi
|
|||||||
exit
|
exit
|
||||||
elif [[ $1 == "-n" ]] || [[ "$1" == "--no" ]];then
|
elif [[ $1 == "-n" ]] || [[ "$1" == "--no" ]];then
|
||||||
echo "checking connection status for $2"
|
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----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping -e $2
|
fping -e $2
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
@ -74,12 +60,6 @@ fi
|
|||||||
elif [[ $1 == "-6" ]] || [[ "$1" == "--force-ipv6" ]];then
|
elif [[ $1 == "-6" ]] || [[ "$1" == "--force-ipv6" ]];then
|
||||||
echo "-6 used, forcing IPv6 portscanning"
|
echo "-6 used, forcing IPv6 portscanning"
|
||||||
echo "checking connection status for $2"
|
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
|
fi
|
||||||
echo "-------------------Availability----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping -6 -e $2
|
fping -6 -e $2
|
||||||
@ -93,13 +73,6 @@ fi
|
|||||||
elif [[ $1 == "-4" ]] || [[ "$1" == "--force-ipv4" ]];then
|
elif [[ $1 == "-4" ]] || [[ "$1" == "--force-ipv4" ]];then
|
||||||
echo "-4 used, forcing IPv4 portscanning"
|
echo "-4 used, forcing IPv4 portscanning"
|
||||||
echo "checking connection status for $2"
|
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----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping -4 -e $2
|
fping -4 -e $2
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
@ -125,21 +98,9 @@ fi
|
|||||||
elif [[ "$1" == "-w" ]] || [[ "$1" == "--wait" ]];then
|
elif [[ "$1" == "-w" ]] || [[ "$1" == "--wait" ]];then
|
||||||
echo "-w used, waiting for active connection"
|
echo "-w used, waiting for active connection"
|
||||||
echo "checking connection status for $2"
|
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 :
|
while [[ "$(fping -m -q -u $2)" == "$2" ]]; do :
|
||||||
done
|
done
|
||||||
notify-send "$2 is now reachable" -u normal -t 15000 -a conn
|
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----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping -e $2
|
fping -e $2
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
@ -159,12 +120,7 @@ fi
|
|||||||
elif [[ ! "$1" =~ [0-9]{1,3}(\.[0-9]{1,3}){3} ]] && [[ "$1" =~ [:] ]] && [[ ! "$2" =~ [:] ]] && [[ -z "$3" ]];then
|
elif [[ ! "$1" =~ [0-9]{1,3}(\.[0-9]{1,3}){3} ]] && [[ "$1" =~ [:] ]] && [[ ! "$2" =~ [:] ]] && [[ -z "$3" ]];then
|
||||||
echo "detected IPv6 adress -> using -6"
|
echo "detected IPv6 adress -> using -6"
|
||||||
echo "checking connection status for $1"
|
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
|
fi
|
||||||
echo "-------------------Availability----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping -6 -e $1
|
fping -6 -e $1
|
||||||
@ -195,13 +151,6 @@ fi
|
|||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
echo "checking connection status for $1"
|
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----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping -e $1
|
fping -e $1
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
|
Loading…
Reference in New Issue
Block a user