Skip to content

Instantly share code, notes, and snippets.

@rahul286
Created April 13, 2015 06:28
Show Gist options
  • Select an option

  • Save rahul286/4be2ba7aaa4e8a066783 to your computer and use it in GitHub Desktop.

Select an option

Save rahul286/4be2ba7aaa4e8a066783 to your computer and use it in GitHub Desktop.
wildcard DNS record checker
#!/bin/sh
# Usage: bash wild.sh <example.com>
# Repalce <example.com> with domain you want to check
# Random word loginc from http://www.unixcl.com/2008/05/generate-random-words-in-linux.html
WORDFILE="/usr/share/dict/words"
NUMWORDS=10
#Number of lines in $WORDFILE
tL=`awk 'NF!=0 {++c} END {print c}' $WORDFILE`
for i in `seq $NUMWORDS`
do
rnum=$((RANDOM%$tL+1))
line=$(sed -n "$rnum p" $WORDFILE)
# try random work as subdomian for given domain name
host $line.$1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment