#!/bin/bash
# Author: Brendan Hide (http://swiftspirit.co.za/)
# Copyright: (c) Brendan Hide, released under the GPLv3 license
#            See http://www.gnu.org/licenses/gpl-3.0.html for the License details
# Name: dim
# Release Version: 0.2 (2010-09-12)

#nameserver
ns=`mydigns`
if [ $# = 1 ]; then
 dig soa $1 @$ns | grep SOA | grep -v "^;" | awk '/[.]/ && !/[;]/{print $5}' | xargs -i dig $1 any "@{}" | grep -v "^;" | grep . || SOARec=Fail
 echo "$1" >> ~/.digall.log
 if [ "$SOARec" = "Fail" ]; then
  echo No SOA record found on $ns
  dig $1 any @$ns| grep -v "^;" | grep . || echo "No records found. Please try DNS-tracing with dnstracer."
 fi
 else echo "Usage: digall example.com"
fi
