-
-
Save awalon/ffe40b2de8b60b4135ea91fde6a20c0a to your computer and use it in GitHub Desktop.
A bash command that will run a `dig` against a specified target for all record types
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
| #!/usr/bin/env bash | |
| # | |
| # To use, simply run `digall <domain>` such as: | |
| # | |
| # digall example.com | |
| # digall sub.example.com | |
| # | |
| # Place this file in your PATH. Suggest either /usr/local/bin/ or ~/bin | |
| # | |
| # Alternatively you can wrap it in a function called `digall` and put in ~/.bashrc | |
| # | |
| # License: MIT | |
| declare -rx digall_color_restore='\033[0m' | |
| declare -rx digall_color_red='\033[0;31m' | |
| declare -rx digall_color_light_green='\033[1;32m' | |
| declare -rx digall_color_light_blue='\033[1;34m' | |
| declare -rx digall_color_light_cyan='\033[1;36m' | |
| if [ -z "$1" ]; then | |
| echo -e "${digall_color_red}Error: Please pass domain as first arg${digall_color_restore}" | |
| else | |
| echo -e "${digall_color_light_blue}Queries: (dig +noall +answer '$1' '<type>')...${digall_color_light_cyan}\n" | |
| declare -x dns_types='SOA NS SPF TXT MX AAAA A' | |
| [ -n "$(dig +noall '$1' CNAME)" ] || declare -x dns_types='AAAA A' # CNAME detected skip all but AAAA and A | |
| for t in $dns_types; do | |
| printf "${digall_color_light_green}Querying for %-4s records...${digall_color_restore}${digall_color_light_cyan}\n" "$t" | |
| dig +noall +answer "$1" "${t}" | |
| echo -e "${digall_color_restore}" | |
| done | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CNAME and "column"- mode for DNS types added.
Install with (ex.):