Created
January 24, 2019 16:35
-
-
Save keck/8685b88f8a361e29200c85d1a5d5d236 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
COMMON_SUBDOMAINS=(www mail smtp pop imap blog en ftp ssh login) | |
if [[ "$2" == "x" ]]; then | |
dig +nocmd "$1" +noall +answer "${3:-any}" | |
wild_ips="$(dig +short "*.$1" "${3:-any}" | tr '\n' '|')" | |
wild_ips="${wild_ips%|}" | |
for sub in "${COMMON_SUBDOMAINS[@]}"; do | |
dig +nocmd "$sub.$1" +noall +answer "${3:-any}" | |
done | grep -vE "${wild_ips}" | |
dig +nocmd "*.$1" +noall +answer "${3:-any}" | |
else | |
dig +nocmd "$1" +noall +answer "${2:-any}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment