Takes a list of hosts (one per line) and outputs the corresponding IP address. Usefull when dealing with an output from Sublist3r to know which hosts still resolve to an IP address.
(Version 2)
(Make sure to wait a couple of seconds after executing the command to give time for threads to finish)
rm -f host2IP; read -p "Domain: " domain; task(){ result=$(host $site | grep "has.*address" | tr -d "\n"); host=$(echo $result | cut -d " " -f1); add=$(echo $result | rev | cut -d " " -f1 | rev); if echo "$host" | grep "${domain}$" > /dev/null; then echo "$host ==> $add" >> host2IP;fi; };while read site;do (task $site &) done < hosts_file
(Make sure it's executable - sudo chmod +x resolv2IP_v2.sh)
./resolv2IP_v2.sh hosts_file
Vasco Pinto
Twitter: @0xVFPAP
LinkedIn: Vasco Pinto
OpenBugBounty: VFPAP