2021-01-15 14:50:17 +00:00
|
|
|
#! /bin/bash
|
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
echo "Usage: conn [ip] (y/n)"
|
|
|
|
exit
|
|
|
|
elif [[ -n "$1" ]]; then
|
|
|
|
echo "checking connection status for $1"
|
2021-01-15 15:00:32 +00:00
|
|
|
echo "-------------------Availability----------------------"
|
2021-01-15 14:50:17 +00:00
|
|
|
fping $1
|
2021-01-15 15:00:32 +00:00
|
|
|
echo "-----------------------------------------------------"
|
2021-01-15 14:50:17 +00:00
|
|
|
fi
|
|
|
|
if [[ -z "$2" ]]; then
|
|
|
|
echo "portscan? (y/n)"
|
|
|
|
read portscan
|
|
|
|
if [[ "$portscan" = "y" ]]; then
|
|
|
|
echo "-------------------Portscan---------------------"
|
|
|
|
nmap -Pn $1
|
|
|
|
fping -c 4 -A $1
|
|
|
|
echo "------------------------------------------------"
|
|
|
|
exit
|
|
|
|
elif [[ "$portscan" = "n" ]]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
elif [[ "$2" = "y" ]]; then
|
|
|
|
echo "-------------------Portscan---------------------"
|
|
|
|
nmap -Pn $1
|
|
|
|
fping -c 4 -A $1
|
|
|
|
echo "------------------------------------------------"
|
|
|
|
exit
|
|
|
|
elif [[ "$2" = "n" ]]; then
|
|
|
|
exit
|
2021-01-15 15:00:32 +00:00
|
|
|
fi
|