mirror of
https://github.com/byReqz/conn.git
synced 2024-11-22 00:53:14 +00:00
made os detection even faster, fixed typos
This commit is contained in:
parent
fcedda6dfa
commit
9df9d6ccfa
66
conn.sh
66
conn.sh
@ -44,10 +44,16 @@ fi
|
||||
elif [[ $1 == "-y" ]] || [[ $1 == "-p" ]] || [[ "$1" == "--portscan" ]] || [[ "$1" == "--yes" ]];then
|
||||
echo "checking connection status for $2"
|
||||
fping=$(fping -a $2)
|
||||
if [[ $fping != "$2" ]] && [[ -n $(nping -q1 -c1 -p135 $2 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -n $(nping -q1 -c1 -p3389 $2 | grep "Successful connections: 1") ]];then
|
||||
p135=$(nping -q1 -c1 -p135 $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") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "note: this seems to be a windows machine which does not respond to ICMP"
|
||||
echo "-----------------------------------------------------"
|
||||
elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "$2 is not reachable"
|
||||
echo "-----------------------------------------------------"
|
||||
else
|
||||
echo "-------------------Availability----------------------"
|
||||
fping -e $2
|
||||
@ -55,7 +61,7 @@ fi
|
||||
if [[ -n $(echo $rescue | grep "Successful connections: 1") ]];then
|
||||
echo "note: this seems to be a linux machine"
|
||||
elif [[ -n $(echo $rescue | grep "Successful connections: 2") ]];then
|
||||
echo "note: this seems to be in the rescue system"
|
||||
echo "note: this machine seems to be in the rescue system"
|
||||
fi
|
||||
echo "-----------------------------------------------------"
|
||||
fi
|
||||
@ -67,10 +73,16 @@ fi
|
||||
exit
|
||||
elif [[ $1 == "-n" ]] || [[ "$1" == "--no" ]];then
|
||||
fping=$(fping -a $2)
|
||||
if [[ $fping != "$2" ]] && [[ -n $(nping -q1 -c1 -p135 $2 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -n $(nping -q1 -c1 -p3389 $2 | grep "Successful connections: 1") ]];then
|
||||
p135=$(nping -q1 -c1 -p135 $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") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "note: this seems to be a windows machine which does not respond to ICMP"
|
||||
echo "-----------------------------------------------------"
|
||||
elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "$2 is not reachable"
|
||||
echo "-----------------------------------------------------"
|
||||
else
|
||||
echo "-------------------Availability----------------------"
|
||||
fping -e $2
|
||||
@ -78,7 +90,7 @@ fi
|
||||
if [[ -n $(echo $rescue | grep "Successful connections: 1") ]];then
|
||||
echo "note: this seems to be a linux machine"
|
||||
elif [[ -n $(echo $rescue | grep "Successful connections: 2") ]];then
|
||||
echo "note: this seems to be in the rescue system"
|
||||
echo "note: this machine seems to be in the rescue system"
|
||||
fi
|
||||
echo "-----------------------------------------------------"
|
||||
fi
|
||||
@ -87,10 +99,16 @@ fi
|
||||
echo "-6 used, forcing IPv6 portscanning"
|
||||
echo "checking connection status for $2"
|
||||
fping=$(fping -6 -a $2)
|
||||
if [[ $fping != "$2" ]] && [[ -n $(nping -6 -q1 -c1 -p135 $2 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -n $(nping -6 -q1 -c1 -p3389 $2 | grep "Successful connections: 1") ]];then
|
||||
p135=$(nping -6 -q1 -c1 -p135 $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") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "note: this seems to be a windows machine which does not respond to ICMP"
|
||||
echo "-----------------------------------------------------"
|
||||
elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "$2 is not reachable"
|
||||
echo "-----------------------------------------------------"
|
||||
else
|
||||
echo "-------------------Availability----------------------"
|
||||
fping -6 -e $2
|
||||
@ -98,7 +116,7 @@ fi
|
||||
if [[ -n $(echo $rescue | grep "Successful connections: 1") ]];then
|
||||
echo "note: this seems to be a linux machine"
|
||||
elif [[ -n $(echo $rescue | grep "Successful connections: 2") ]];then
|
||||
echo "note: this seems to be in the rescue system"
|
||||
echo "note: this machine seems to be in the rescue system"
|
||||
fi
|
||||
echo "-----------------------------------------------------"
|
||||
fi
|
||||
@ -112,10 +130,16 @@ fi
|
||||
echo "-4 used, forcing IPv4 portscanning"
|
||||
echo "checking connection status for $2"
|
||||
fping=$(fping -4 -a $2)
|
||||
if [[ $fping != "$2" ]] && [[ -n $(nping -4 -q1 -c1 -p135 $2 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -n $(nping -4 -q1 -c1 -p3389 $2 | grep "Successful connections: 1") ]];then
|
||||
p135=$(nping -4 -q1 -c1 -p135 $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") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "note: this seems to be a windows machine which does not respond to ICMP"
|
||||
echo "-----------------------------------------------------"
|
||||
elif [[ $fping != "$2" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "$2 is not reachable"
|
||||
echo "-----------------------------------------------------"
|
||||
else
|
||||
echo "-------------------Availability----------------------"
|
||||
fping -4 -e $2
|
||||
@ -123,7 +147,7 @@ fi
|
||||
if [[ -n $(echo $rescue | grep "Successful connections: 1") ]];then
|
||||
echo "note: this seems to be a linux machine"
|
||||
elif [[ -n $(echo $rescue | grep "Successful connections: 2") ]];then
|
||||
echo "note: this seems to be in the rescue system"
|
||||
echo "note: this machine seems to be in the rescue system"
|
||||
fi
|
||||
echo "-----------------------------------------------------"
|
||||
fi
|
||||
@ -150,7 +174,9 @@ fi
|
||||
echo "-w used, waiting for active connection"
|
||||
echo "checking connection status for $2"
|
||||
fping=$(fping -a $2)
|
||||
if [[ $fping != "$2" ]] && [[ -n $(nping -q1 -c1 -p135 $2 | grep "Successful connections: 1") ]] || [[ $fping == "$2" ]] && [[ -n $(nping -q1 -c1 -p3389 $2 | grep "Successful connections: 1") ]];then
|
||||
p135=$(nping -q1 -c1 -p135 $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") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "note: this seems to be a windows machine which does not respond to ICMP"
|
||||
notify-send "$2 is now reachable" "and seems to be a windows machine" -u normal -t 15000 -a conn
|
||||
@ -166,7 +192,7 @@ fi
|
||||
echo "note: this seems to be a linux machine"
|
||||
notify-send "$2 is now reachable" "and seems to be in a linux system" -u normal -t 15000 -a conn
|
||||
elif [[ -n $(echo $rescue | grep "Successful connections: 2") ]];then
|
||||
echo "note: this seems to be in the rescue system"
|
||||
echo "note: this machine seems to be in the rescue system"
|
||||
notify-send "$2 is now reachable" "and seems to be in the rescue system" -u normal -t 15000 -a conn
|
||||
fi
|
||||
echo "-----------------------------------------------------"
|
||||
@ -188,10 +214,16 @@ fi
|
||||
echo "detected IPv6 adress -> using -6"
|
||||
echo "checking connection status for $1"
|
||||
fping=$(fping -6 -a $1)
|
||||
if [[ $fping != "$1" ]] && [[ -n $(nping -6 -q1 -c1 -p135 $1 | grep "Successful connections: 1") ]] || [[ $fping == "$1" ]] && [[ -n $(nping -6 -q1 -c1 -p3389 $1 | grep "Successful connections: 1") ]];then
|
||||
p135=$(nping -6 -q1 -c1 -p135 $1)
|
||||
p3389=$(nping -6 -q1 -c1 -p3389 $1)
|
||||
if [[ $fping != "$1" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$1" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "note: this seems to be a windows machine which does not respond to ICMP"
|
||||
echo "-----------------------------------------------------"
|
||||
elif [[ $fping != "$1" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping == "$1" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "$2 is not reachable"
|
||||
echo "-----------------------------------------------------"
|
||||
else
|
||||
echo "-------------------Availability----------------------"
|
||||
fping -6 -e $1
|
||||
@ -199,7 +231,7 @@ fi
|
||||
if [[ -n $(echo $rescue | grep "Successful connections: 1") ]];then
|
||||
echo "note: this seems to be a linux machine"
|
||||
elif [[ -n $(echo $rescue | grep "Successful connections: 2") ]];then
|
||||
echo "note: this seems to be in the rescue system"
|
||||
echo "note: this machine seems to be in the rescue system"
|
||||
fi
|
||||
echo "-----------------------------------------------------"
|
||||
fi
|
||||
@ -230,10 +262,16 @@ fi
|
||||
else
|
||||
echo "checking connection status for $1"
|
||||
fping=$(fping -a $1)
|
||||
if [[ $fping != "$1" ]] && [[ -n $(nping -q1 -c1 -p135 $1 | grep "Successful connections: 1") ]] || [[ $fping == "$1" ]] && [[ -n $(nping -q1 -c1 -p3389 $1 | grep "Successful connections: 1") ]];then
|
||||
p135=$(nping -q1 -c1 -p135 $1)
|
||||
p3389=$(nping -q1 -c1 -p3389 $1)
|
||||
if [[ $fping != "$1" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$1" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "note: this seems to be a windows machine which does not respond to ICMP"
|
||||
echo "-----------------------------------------------------"
|
||||
elif [[ $fping != "$1" ]] && [[ -z $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$1" ]] && [[ -z $(echo $p3389 | grep "Successful connections: 1") ]];then
|
||||
echo "-------------------Availability----------------------"
|
||||
echo "$1 is not reachable"
|
||||
echo "-----------------------------------------------------"
|
||||
else
|
||||
echo "-------------------Availability----------------------"
|
||||
fping -e $1
|
||||
@ -241,7 +279,7 @@ fi
|
||||
if [[ -n $(echo $rescue | grep "Successful connections: 1") ]];then
|
||||
echo "note: this seems to be a linux machine"
|
||||
elif [[ -n $(echo $rescue | grep "Successful connections: 2") ]];then
|
||||
echo "note: this seems to be in the rescue system"
|
||||
echo "note: this machine seems to be in the rescue system"
|
||||
fi
|
||||
echo "-----------------------------------------------------"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user