Register
It is currently Thu Nov 27, 2014 8:19 am

Domain DNS Info


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sun Apr 04, 2010 7:56 pm   

Joined: Sat Apr 03, 2010 1:47 pm
Posts: 6
I wrote this script to get me the necessary information on a domain:

Name Servers
A record
MX record
A record for each MX record
Expiration and Updated dates
Admin Contact's email address
Current status

Usage: dns.sh DOMAIN.COM

The info obtained from the WhoIs still needs some work to refine. Too bad there is no standard format for which all WhoIs results use. I hope someone finds this useful, too.

Code:
#! /bin/bash

if [ -n "$1" ]; then

echo ""
echo "<----- Domain Results ----->"
echo ""
echo "Nameservers for $domainname:"

dig ns $domainname +short

echo ""
echo "IP address for $domainname:"

dig $domainname +short

echo ""
echo "MX records for $domainname:"

dig mx $domainname +short

echo ""
echo "IP address for MX records:"

dig $(dig mx $domainname +short) +short

whois $domainname > ~/.whois.tmp

echo ""
echo "Important Dates:"
grep Expiration ~/.whois.tmp
grep "Updated Date:" ~/.whois.tmp

echo ""
echo "Administrative Contact:"
awk '/Administrative\ Contact/ {getline; print}' ~/.whois.tmp

echo ""
echo "$domainname Status:"
grep -i "status:" ~/.whois.tmp

rm ~/.whois.tmp

echo ""
echo "<----- End of Results ----->"
echo ""

else
   echo "     I need a domain"
   echo "     Usage: $0 DOMAIN.COM"
fi


Top
 Profile  
 PostPosted: Tue Apr 06, 2010 11:04 am   

Joined: Sat Apr 03, 2010 1:47 pm
Posts: 6
The Administrative Contact's email address is not displayed.
It would be displayed if I had used the following:
Code:
grep "Admin Email" ~/.whois.tmp


Here is the output of the script:

Quote:
$ dns bashscripts.org

<----- Domain Results ----->

Nameservers for bashscripts.org:
ns12.domaincontrol.com.
ns11.domaincontrol.com.

IP address for bashscripts.org:
173.23.68.36

MX records for bashscripts.org:
0 smtp.secureserver.net.
10 mailstore1.secureserver.net.

IP address for MX records:
216.69.186.201
216.69.186.201

Registrar:
Registrar:GoDaddy.com, Inc.

Important Dates:
Expiration Date:09-Nov-2010 00:28:49 UTC

Administrative Contact:

bashscripts.org Status:
Status:CLIENT DELETE PROHIBITED
Status:CLIENT RENEW PROHIBITED
Status:CLIENT TRANSFER PROHIBITED
Status:CLIENT UPDATE PROHIBITED

<----- End of Results ----->


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP