Monday, January 28, 2008

A Zone transfer Script

If you are unfamiliar with the term Zone Transfer, I would strongly recommend some googling around a bit to find out more.A nice place to start would be Wikipedia
http://en.wikipedia.org/wiki/DNS_zone_transfer. In a nutshell a Zonetransfer is the act of database replication between a primary and a secondary DNS server.This Zone transfer should strictly occur between two trusted/related DNS servers.However due to misconfiguration of the server,anyone (read untrusted entity)asking for a copy of the DNS server zone would receive one.
##########################################

#!/bin/bash
#save as zonetransfer.sh
#chmod +x to make it executable
if [ $# -eq 0 ]
then
echo "A Zone Transfer script"
echo "Usage:./zonetransfer.sh domain name "
exit 0
fi

for nameserver in $(host -t ns $1 |cut -d" " -f4)
do
host -l $1 $nameserver|grep "has address"
done

##########################################

0 comments: