#!/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: digx
# Release Version: 0.2 (2012-08-07)

mydns=`mydigns`

if [ $# = 1 ]; then
 theips=`dig soa $1 @$mydns | grep SOA | grep -v "^;" | awk '/[.]/ && !/[;]/{print $5}' | xargs -i dig $1 A "@{}" | grep "A" | grep "^$1" | awk '/[.]/ && !/[;]/{print $5}'`
 for eachip in $theips ; do
  dig -x $eachip soa @$mydns | grep SOA | grep -v "^;" | awk '/[.]/ && !/[;]/{print $5}' | xargs -i dig -x $eachip "@{}" | grep . | grep -v "^;"
 done
else echo "Usage: digx example.com"
fi
