Script to check the ip for domains

Many time we are facing the problem while auditing the server for active domains, at that time we can use the following script to check which domain is resolving to which ip.

Copy all the domains hosted on the server in the simple text file, for example we have copied all the domains in the domains.txt file. Now run the following command from the shell as root user

Server@root[~]#for i in `cat domains.txt`;do host $i | grep ‘not found\|has address’>> dnsrecords.txt; done

After running above command you will receive the ip address where domains currently resolving, open a file dnsrecords.txt, it will give you the following result

test.com has address 192.168.0.1

test1.com has address 192.068.0.21

 

Both comments and pings are currently closed.

Comments are closed.