This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/bin/check-port

18 lines
327 B
Text
Raw Normal View History

2019-11-04 11:58:46 -06:00
#!/usr/bin/env bash
if [[ $1 = t ]] || [[ $1 = tcp ]] || \
[[ $1 = T ]] || [[ $1 = TCP ]]; then
2020-04-20 10:38:19 -05:00
echo "TCP is the default. You don't need to specify it." >&2
2019-11-04 11:58:46 -06:00
exit 1
fi
if [[ $1 = u ]] || [[ $1 = udp ]] || \
[[ $1 = U ]] || [[ $1 = UDP ]]; then
shift
set -x
2020-04-20 10:38:19 -05:00
sudo nmap -sU "$1" -p "$2"
2019-11-04 11:58:46 -06:00
else
set -x
2020-04-20 10:38:19 -05:00
nmap "$1" -p "$2"
2019-11-04 11:58:46 -06:00
fi