In this thread we'll demonstrate how the module Textaid can be used to effortlessly convert user readable host names into internet protocol (IP) addresses with support for both IPv4 and IPv6 formats. As engineers, we're all had moments where we need perform one or more DNS lookup's and Textaid helps perform this function.
In the Textaid module situated to the top right of the window exists a drop down of specific purpose scripts. These scripts were implemented to assist non-typical textual operations, one of these includes the host-to-ip function as seen here:
Once the "host-to-ip" function has been selected, we are ready to execute the script on the textual input existent within the Textaid input window. To proceed, we can test it with the input:
And run the script by pressing the play button which on this occasion produces the following output.
In this particular demonstration, we queried our configuration DNS servers for the A records relative to the host names ("whois.sc", "google.com", "google.co.uk") and the script provided three IP addresses. One is an IPv4 format address and the latter two IPv6 address variants.
The "host-to-ip" script works on a line by line basis and it is fully capable of working with full URIs where web resource documents are appended to the initial host name. The host name on each line will be replaced with the IP address evident in the A record returned, the host name will then be appended to the resulting line in the form of a comment like the form:
IP ADDRESS // OK: host name ...
Should a DNS lookup ever fail, the "OK" will be replaced with the string "FAILED". In any case should we wish to specifically remove these acknowledgements and have a list of IP addresses, we can change the function in the drop down list to "extract-anyip". This function will specifically extract all IPv4 and IPv6 format addresses giving us the output: