Skip to content

Instantly share code, notes, and snippets.

@xdavidhu
Last active June 4, 2024 08:51
Show Gist options
  • Save xdavidhu/07457247b9087dea4ddaf52858500cce to your computer and use it in GitHub Desktop.
Save xdavidhu/07457247b9087dea4ddaf52858500cce to your computer and use it in GitHub Desktop.
Converter.sh, a bash script to convert domain lists to resolved IP lists without duplicates
#!/bin/bash
# Converter.sh by @xdavidhu
# This is a script inspired by the Bug Hunter's Methodology 3 by @Jhaddix
# With this script, you can convert domain lists to resolved IP lists without duplicates.
# Usage: ./converter.sh [domain-list-file] [output-file]
echo -e "[+] Converter.sh by @xdavidhu\n"
if [ -z "$1" ] || [ -z "$2" ]; then
echo "[!] Usage: ./converter.sh [domain-list-file] [output-file]"
exit 1
fi
echo "[+] Resolving domains to IPs..."
while read d || [[ -n $d ]]; do
ip=$(dig +short $d|grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"|head -1)
if [ -n "$ip" ]; then
echo "[+] '$d' => $ip"
echo $ip >> $2
else
echo "[!] '$d' => [RESOLVE ERROR]"
fi
done < $1
echo -e "\n[+] Removing duplicates..."
sort $2 | uniq > $2.new
mv $2.new $2
echo -e "\n[+] Done, IPs saved to '$2'."
@StandUp89
Copy link

Thanks --> Does anyone have tips for recon for finding information disclosure Vulns? thanks

@bootbash
Copy link

bootbash commented Jun 4, 2024

root@vm-d600c2:/home/user1/parser# ./domain_to_ip2.sh domains domains.txt
[+] Converter.sh by @xdavidhu

[+] Resolving domains to IPs...
' => [RESOLVE ERROR]
' => [RESOLVE ERROR]
' => [RESOLVE ERROR]
' => [RESOLVE ERROR]

[+] Removing duplicates...

[+] Done, IPs saved to 'domains.txt'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment