From 777c88a9eeeb393ee50fb7cdef3e0d1f0aa0c01d Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 4 Nov 2019 11:58:46 -0600 Subject: [PATCH] Networking helpers --- bin/check-port | 17 +++++++++++++++++ bin/dns | 3 +++ 2 files changed, 20 insertions(+) create mode 100755 bin/check-port create mode 100755 bin/dns diff --git a/bin/check-port b/bin/check-port new file mode 100755 index 0000000..5601c5f --- /dev/null +++ b/bin/check-port @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +if [[ $1 = t ]] || [[ $1 = tcp ]] || \ + [[ $1 = T ]] || [[ $1 = TCP ]]; then + echo "TCP is the default. You don't need to specify it." + exit 1 +fi + +if [[ $1 = u ]] || [[ $1 = udp ]] || \ + [[ $1 = U ]] || [[ $1 = UDP ]]; then + shift + set -x + sudo nmap -sU $1 -p $2 +else + set -x + nmap $1 -p $2 +fi diff --git a/bin/dns b/bin/dns new file mode 100755 index 0000000..9d7465f --- /dev/null +++ b/bin/dns @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +getent hosts $*