Skip to content

Instantly share code, notes, and snippets.

@vmule
Created June 21, 2016 12:46
Show Gist options
  • Select an option

  • Save vmule/9314969f605232fcc0197feea337662d to your computer and use it in GitHub Desktop.

Select an option

Save vmule/9314969f605232fcc0197feea337662d to your computer and use it in GitHub Desktop.
DNS interrogator script
#!/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
@Fenshu

Fenshu commented Oct 13, 2017

Copy link
Copy Markdown

Hi Vito,
your script make exactly what I want to do.
I would like to ask if I can (and how) read a domain list from a file.

I've a file domini.txt with 2.500 domain name...
Thank you very much!
Luca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment