mirror of
https://github.com/byReqz/conn.git
synced 2024-11-22 00:53:14 +00:00
Compare commits
3 Commits
0dbd251ae0
...
af97e58888
Author | SHA1 | Date | |
---|---|---|---|
|
af97e58888 | ||
|
bce9576c2d | ||
|
e68d8d52b2 |
25
conn.sh
25
conn.sh
@ -108,9 +108,9 @@ function set_argvars {
|
|||||||
|
|
||||||
function validate {
|
function validate {
|
||||||
for arg in $@; do
|
for arg in $@; do
|
||||||
if $(ip route show " $arg" 2&> /dev/null);then
|
if ip route show " $arg" 2&> /dev/null;then
|
||||||
hosts="$hosts $arg"
|
hosts="$hosts $arg"
|
||||||
elif $(nslookup "$arg" > /dev/null);then
|
elif nslookup "$arg" > /dev/null;then
|
||||||
hosts="$hosts $arg"
|
hosts="$hosts $arg"
|
||||||
else
|
else
|
||||||
echo "invalid input: $arg"
|
echo "invalid input: $arg"
|
||||||
@ -122,11 +122,22 @@ function main {
|
|||||||
if [[ $simpleoutput == true ]] && [[ -n $hosts ]];then
|
if [[ $simpleoutput == true ]] && [[ -n $hosts ]];then
|
||||||
echo "-------------------Availability----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping $only -e $@
|
fping $only -e $@
|
||||||
quickport=$(nping $only -c1 -p22,222,3389,135 $@ | grep -e "completed")
|
echo ""
|
||||||
if [[ -n $quickport ]];then
|
for host in $@;do
|
||||||
echo ""
|
linuxping=$(nping $only -c1 -p22,222 "$host")
|
||||||
echo "$quickport"
|
if [[ -n $(echo "$linuxping" | grep -e "Successful connections: 1") ]];then
|
||||||
fi
|
echo "$host seems to be booted into a Linux system"
|
||||||
|
elif [[ -n $(echo "$linuxping" | grep -e "Successful connections: 2") ]];then
|
||||||
|
echo "$host seems to be booted into the rescue system"
|
||||||
|
fi
|
||||||
|
winping135=$(nping $only -c1 -p135 "$host")
|
||||||
|
winping3389=$(nping $only -c1 -p3389 "$host")
|
||||||
|
if [[ -n $(echo "$winping135" | grep -e "Successful connections: 1") ]] && [[ -n $(echo "$winping3389" | grep -e "Successful connections: 1") ]];then
|
||||||
|
echo "$host seems to be booted into Windows"
|
||||||
|
elif [[ -z $(fping $only -a $host) ]] && [[ -n $(echo "$winping3389" | grep -e "Successful connections: 1") ]];then
|
||||||
|
echo "$host seems to be booted into (desktop) Windows"
|
||||||
|
fi
|
||||||
|
done
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
else
|
else
|
||||||
for host in $hosts;do
|
for host in $hosts;do
|
||||||
|
Loading…
Reference in New Issue
Block a user