1. Type the following command in terminal and open the empty text file
sudo gedit ipad.sh
Copy and paste the following lines in the text file ipad.sh then save and exit
#!/bin/bash
# A sample shell script to print domain ip address hosting information such as
# Location of server, city, ip address owner, country and network range.
# This is useful to track spammers or research purpose.
# -------------------------------------------------------------------------
# Get all domains
_dom=$@
# Die if no domains are given
[ $# -eq 0 ] && { echo "Usage: $0 domain1.com domain2.com ..."; exit 1; }
for d in $_dom
do
_ip=$(host $d | grep 'has add' | head -1 | awk '{ print $4}')
[ "$_ip" == "" ] && { echo "Error: $d is not valid domain or dns error."; continue; }
echo "Getting information for domain: $d [ $_ip ]..."
whois "$_ip" | egrep -w 'OrgName:|City:|Country:|OriginAS:|NetRange:'
echo ""
done
Then make the text file as executable file.
sudo chmod +x ipad.sh
Next execute the script 'ipad.sh'
./ipad.sh
![](file:///tmp/moz-screenshot-1.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqMHpisPiNhfc4ZmDjO4CoKOGgjx4-uWxm3ZG6QDvNtDONhNIVic0XAgs_kuGk73H6zJ497nFfd645Da5Pp_4zWkuE5QXolK1iqEboemiTR7140bCxRrGMXr9EAE8J0AZZAB1GB-8Yk80/s320/Selection_007.png)
1 comments:
Dude! This is the coolest script in the world. Thank you for this. Shell scripting is such a great thing. Now I don't have to tinker with my firewall just to find the IP of a domain name!
Post a Comment