How to find out IP addresses for a list of hostnames?
Python for network scripting
As you all know python is a generic language, it can be used in networking field as well. May the below python script will be great time saver for network ninjas😎.
Here we are using a python package called socket. This package is used for socket programming. The given script will read a set of host names line by line from a file to a list. Then it will resolve all the host names and will display the IP address of the corresponding host name.
First we will create a text file host.txt with some host names to resolve. Here I will be using some domain names like www.google.com, www.youtube.com, www.vicz.in, blog.vicz.in. You can also use the same as an example. These domain names you should write line by line in the host.txt.
for host in hostnames:
Here you can find out more network scripts using python https://github.com/vishnu-ks/Python-networking-scripts