0

I would like to have a script that will dig domain_name ANY from multiple domains stored on a domains.txt file and output the results to a results.txt file...but easy to read if possible

Is this thing possible?

afs
  • 27
  • 1
  • 12
  • 1
    Welcome to StackOverflow. The answer to your question is probably yes but your question is not well suited for this site, since SO is not a coding service. Please consult https://stackoverflow.com/help/how-to-ask to improve your chances of getting good answers. – Micha Wiedenmann May 18 '18 at 08:54

1 Answers1

0

Given you have a list in a file named domains_list.txt you can use this command:

for d in $(cat domains_list.txt); do echo Processing domain: $d;  dig $d | grep -v "^;" | tee ${d}_result.txt; done

To have a better answer you should give a better question ;)

Edit: to have it in just one file, with dig ANY :

for d in $(cat domains_list.txt); do echo Processing domain: $d;  dig $d ANY| grep -v "^;" | tee -a results.txt; done
Gianluca Mereu
  • 300
  • 1
  • 4
  • Thanks, i see this command will output each domain into doman1.txt, domain2.txt and so on... is it possible to outpoot results in a single file? and dig ANY not only A record? Thank you! – afs May 18 '18 at 09:18
  • i added dig $d any and worked...but how do i output that in a single file? – afs May 18 '18 at 09:24
  • Wait ... it works if I use Google's DNS :) dig $d any @8.8.4.4 – Gianluca Mereu May 18 '18 at 09:28
  • That`s what i needed... worked just perfect also with ANY...shows all the zone records. Thank you! – afs May 18 '18 at 09:31
  • can i put in that search/result nslookup A and to display results next to dig command? so i have all the information needed for a domain into one single result? dig, whois and nslookup? is this possible? – afs May 18 '18 at 09:38
  • Sure, you can add all the commands you want before the ";done". For example: for d in $(cat domains_list.txt); do echo Processing domain: $d; dig $d ANY| grep -v "^;" | tee -a results.txt; whois $d | tee -a results.txt; nslookup $d | tee -a results.txt; done – Gianluca Mereu May 18 '18 at 12:28