Skip to content

Instantly share code, notes, and snippets.

@FreedomBen
Last active May 7, 2022 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FreedomBen/b02d856c12d6510ed35f350a33b42164 to your computer and use it in GitHub Desktop.
Save FreedomBen/b02d856c12d6510ed35f350a33b42164 to your computer and use it in GitHub Desktop.
the bash "digall" command - Ben Porter
# 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