Last active
May 7, 2022 17:22
-
-
Save FreedomBen/b02d856c12d6510ed35f350a33b42164 to your computer and use it in GitHub Desktop.
the bash "digall" command - Ben Porter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Paste this into your shell and you can use the 'digall' command like: | |
# digall example.com | |
# digall something.example.com | |
# You can also add it to your ~/.bashrc file to have it always available | |
declare -rx color_restore='\033[0m' | |
declare -rx color_red='\033[0;31m' | |
declare -rx color_light_green='\033[1;32m' | |
declare -rx color_light_blue='\033[1;34m' | |
declare -rx color_light_cyan='\033[1;36m' | |
digall() | |
{ | |
if [ -z "$1" ]; then | |
echo -e "${color_red}Error: Please pass domain as first arg${color_restore}" | |
else | |
echo -e "${color_light_blue}Queries: (dig +noall +answer '$1' '<type>')...${color_light_cyan}\n" | |
# CNAME isn't needed because it will show up as the other record types | |
for t in SOA NS SPF TXT MX AAAA A; do | |
echo -e "${color_light_green}Querying for $t records...${color_restore}${color_light_cyan}" | |
dig +noall +answer "$1" "${t}" | |
echo -e "${color_restore}" | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment