All pastes #442842 Raw Edit

phoemix

public shellscript v1 · immutable
·published 2007-04-16 14:42 UTC
rendered paste body
#!/bin/sh# sh. not fucking bash.if [ ! $# -gt 0 ]; then    echo "Usage: $0 <inputfile> [filterdomain]"    exit 1;fitld=$1shiftdigopts='+norecurse +nocmd +nocomments +nostats +noadditional +noquestion'domfilter=0# handle the filterdomainif [ $# -gt 0 ]; then    domfilter=1    filter_domain=$1    echo "using domfilter: '$filter_domain'"figet_tldns() {    tld=`echo $1 | sed 's/^.*\.//'`    host -t ns $tld. | head -1 | awk '{print $4}'}echo > $tld.nsfor i in `cat $tld`;  do  echo "Checking $i..."  if [ $domfilter -eq 1 ]; then      dig @`get_tldns $i` $i NS $digopts | grep NS | grep -iv $filter_domain'\.$' >> $tld.ns  else      dig @`get_tldns $i` $i NS $digopts | grep NS >> $tld.ns  fidone