mirror of
https://github.com/byReqz/conn.git
synced 2024-11-22 17:11:16 +00:00
rewrite
added (working) multi-ip mode and cleaned code up
This commit is contained in:
parent
2256d9fb4a
commit
951efc6202
48
conn.sh
48
conn.sh
@ -1,17 +1,40 @@
|
|||||||
#! /bin/bash
|
while [ ! -z "$1" ]; do
|
||||||
if [[ -z "$1" ]]; then
|
if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]];then
|
||||||
echo "Usage: conn [ip] (y/n)"
|
echo "Usage: $0 (-m) <ip> (y/n)"
|
||||||
|
echo "Options:"
|
||||||
|
echo " -m/--multi -- test multiple ips / disable portscan"
|
||||||
|
printf " -h/--help -- show help"
|
||||||
exit
|
exit
|
||||||
elif [[ -n "$1" ]]; then
|
elif [[ $1 == "-m" ]] || [[ "$1" == "--multi" ]];then
|
||||||
|
echo "multi-ip mode, portscan disabled"
|
||||||
|
echo "-------------------Availability----------------------"
|
||||||
|
fping $@
|
||||||
|
echo "-----------------------------------------------------"
|
||||||
|
exit
|
||||||
|
elif [[ $1 == "-y" ]] || [[ $1 == "-p" ]] || [[ "$1" == "--portscan" ]] || [[ "$1" == "--yes" ]];then
|
||||||
|
echo "checking connection status for $2"
|
||||||
|
echo "-------------------Availability----------------------"
|
||||||
|
fping $2
|
||||||
|
echo "-----------------------------------------------------"
|
||||||
|
echo "-------------------Portscan---------------------"
|
||||||
|
nmap -Pn $2
|
||||||
|
fping -c 4 -A $2
|
||||||
|
echo "------------------------------------------------"
|
||||||
|
exit
|
||||||
|
elif [[ $1 == "-n" ]] || [[ "$1" == "--no" ]];then
|
||||||
|
echo "checking connection status for $2"
|
||||||
|
echo "-------------------Availability----------------------"
|
||||||
|
fping $2
|
||||||
|
echo "-----------------------------------------------------"
|
||||||
|
exit
|
||||||
|
else
|
||||||
echo "checking connection status for $1"
|
echo "checking connection status for $1"
|
||||||
echo "-------------------Availability----------------------"
|
echo "-------------------Availability----------------------"
|
||||||
fping $1
|
fping $1
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
fi
|
echo "portscan? (y/n) (default: y)"
|
||||||
if [[ -z "$2" ]]; then
|
|
||||||
echo "portscan? (y/n)"
|
|
||||||
read portscan
|
read portscan
|
||||||
if [[ "$portscan" = "y" ]]; then
|
if [[ "$portscan" = "y" ]] || [[ -z "$portscan" ]]; then
|
||||||
echo "-------------------Portscan---------------------"
|
echo "-------------------Portscan---------------------"
|
||||||
nmap -Pn $1
|
nmap -Pn $1
|
||||||
fping -c 4 -A $1
|
fping -c 4 -A $1
|
||||||
@ -20,12 +43,5 @@ if [[ -z "$2" ]]; then
|
|||||||
elif [[ "$portscan" = "n" ]]; then
|
elif [[ "$portscan" = "n" ]]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
elif [[ "$2" = "y" ]]; then
|
|
||||||
echo "-------------------Portscan---------------------"
|
|
||||||
nmap -Pn $1
|
|
||||||
fping -c 4 -A $1
|
|
||||||
echo "------------------------------------------------"
|
|
||||||
exit
|
|
||||||
elif [[ "$2" = "n" ]]; then
|
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user