Dig Deep DNS Toolkit

Dig Deep DNS Codex

Without further ado, this is the documentation page for the Dig Deep DNS Toolkit. This page lists a description of each script as well as a sample of its usage and output. Use the navigation table below to jump to the relevant section of this page to read about each script. Be sure to check out the change log to find out what's been updated to see if any of the scripts have any new features or bugfixes that your current versions don't have.

Standard DDDNS Tools

These are the DDDNS Tools that are included in the Standard distribution of the DDDNS Toolkit.

checkdns

checkdns runs a series of digs to query for general DNS configuration information of a given domain. checkdns retrieves the nameservers as reported by the queried domain's registrar, the following information from the queried domain's DNS zone: IP address of the queried server (if a server is provided), NS records, nameserver IP addresses, Start of Authority with SOA comments, and IP addresses of domain.tld and www.domain.tld. checkdns is NOT a replacement for online DNS checking tools such as Leaf DNS or Into DNS; however, checkdns is faster to provide preliminary information to start from compared to Leaf DNS or Into DNS.

Syntax: checkdns <domain> [<server|IP>]

~ $ checkdns digdeepdns.net web4042.websitewelcome.com IP address of @web4042.websitewelcome.com: @192.185.2.65 Nameservers of digdeepdns.net reported by the registrar: digdeepdns.net. 172800 IN NS ns1.digdeepdns.net. digdeepdns.net. 172800 IN NS ns2.digdeepdns.net. ns1.digdeepdns.net. 172800 IN A 192.185.57.22 ns2.digdeepdns.net. 172800 IN A 192.185.57.216 Nameservers of digdeepdns.net in the DNS zone: digdeepdns.net. 86400 IN NS ns2.digdeepdns.net. digdeepdns.net. 86400 IN NS ns1.digdeepdns.net. ns2.digdeepdns.net. 14400 IN A 192.185.57.22 ns1.digdeepdns.net. 14400 IN A 192.185.57.216 Start of Authority @web4042.websitewelcome.com for digdeepdns.net: digdeepdns.net. 86400 IN SOA ns1.digdeepdns.net. slucas.digdeepdns.net. ( 2013100200 ; serial 14400 ; refresh (4 hours) 7200 ; retry (2 hours) 3600000 ; expire (5 weeks 6 days 16 hours) 14400 ; minimum (4 hours) ) IP addresses @web4042.websitewelcome.com for (www.)digdeepdns.net: digdeepdns.net. 14400 IN A 192.185.57.22 www.digdeepdns.net. 14400 IN CNAME digdeepdns.net. digdeepdns.net. 14400 IN A 192.185.57.22

checkmx

checkmx retrieves the IP address of the provided hostname, a list of the provided hostname's MX records, and the IP addresses of each MX record. The IP address of the hostname can be used to compare the IP addresses that the MX record(s) resolve to to determine if the MX records point to the same server. This script has been deprecated by digmail, but it remains as a part of the tool kit for specialty uses.

Syntax: checkmx <domain> [<server|IP>]

~ $ checkmx digdeepdns.net web4042.websitewelcome.com IP address of @web4042.websitewelcome.com: @192.185.2.65 DIGGING @web4042.websitewelcome.com FOR a IN digdeepdns.net digdeepdns.net. 14400 IN A 192.185.57.22 DIGGING @web4042.websitewelcome.com FOR mx IN digdeepdns.net digdeepdns.net. 14400 IN MX 0 digdeepdns.net. DIGGING @web4042.websitewelcome.com FOR a IN... ---------------------------------------------------------------- digdeepdns.net. 14400 IN A 192.185.57.22

digdeep

digdeep was the first script written for this toolkit. digdeep can dig across multiple hostnames for multiple DNS zone record types, and sort its output by record type or by hostname. If multiple record types and/or hostnames are provided, each list must be enclosed in "double quotes". Digdeep also supports {brace,expansion}, and the hostname must be "double quoted" as if it were a list, otherwise you'll get weird output. An optional server or IP address can be provided to query (the output examples provided below omit this additional argument). digdeep has an additional easter egg: 50% of the time, digdeep will output an additional humorous geeky quote at the end.

Syntax: digdeep <host|record> <record(s)> <hostname(s)> [<server|IP>]

~ $ digdeep host "ns a" "digdeepdns.net hostgator.com" DIGGING FOR "ns a" IN digdeepdns.net digdeepdns.net. 86400 IN NS ns1.digdeepdns.net. digdeepdns.net. 86400 IN NS ns2.digdeepdns.net. digdeepdns.net. 14400 IN A 70.84.243.131 DIGGING FOR "ns a" IN hostgator.com hostgator.com. 45275 IN NS ns4.p13.dynect.net. hostgator.com. 45275 IN NS ns3.p13.dynect.net. hostgator.com. 45275 IN NS ns2.p13.dynect.net. hostgator.com. 45275 IN NS ns1.p13.dynect.net. hostgator.com. 11 IN A 173.192.226.44 Run! There's a creeper behind you!
~ $ digdeep record "ns a" "digdeepdns.net hostgator.com" DIGGING FOR ns IN "digdeepdns.net hostgator.com" digdeepdns.net. 21573 IN NS ns2.digdeepdns.net. digdeepdns.net. 21573 IN NS ns1.digdeepdns.net. hostgator.com. 44938 IN NS ns4.p13.dynect.net. hostgator.com. 44938 IN NS ns3.p13.dynect.net. hostgator.com. 44938 IN NS ns2.p13.dynect.net. hostgator.com. 44938 IN NS ns1.p13.dynect.net. DIGGING FOR a IN "digdeepdns.net hostgator.com" digdeepdns.net. 14373 IN A 70.84.243.131 hostgator.com. 7 IN A 173.192.226.44 Keep going! You're almost to the center of the Earth!
~ $ digdeep record a "ns{1..6}.hostgator.com" DIGGING FOR a IN "ns1.hostgator.com ns2.hostgator.com ns3.hostgator.com ns4.hostgator.com ns5.hostgator.com ns6.hostgator.com" ns1.hostgator.com. 2467 IN A 67.18.54.2 ns2.hostgator.com. 14400 IN A 67.18.54.3 ns3.hostgator.com. 3244 IN A 184.172.176.21 ns4.hostgator.com. 21600 IN A 184.172.179.128 ns5.hostgator.com. 21600 IN A 184.172.165.14 ns6.hostgator.com. 21600 IN A 184.172.161.32

Note for OS X users: If you are sentimentally attached to your neutered OS X version of sed, then this script is going to behave very awkwardly for you without modification. The easiest fix is to just delete the pipes through sed that are in the main loops of this script that do all the dirty work. I had to manually install GNU sed (as gsed) using MacPorts and create a symlink as /opt/local/bin/sed => /opt/local/bin/gsed to fix this myself without removing the pipes to sed. (My primary system is a MacBook Pro. I have every right to rip on the very operating system that I develop on. :P)

digmail

digmail can be considered an "evolution" of checkmx. checkmx only retrieves the MX records of a given hostname and their IP addresses. digmail however retrieves a much larger set of mail DNS configuration information: IP address of the provided domain, the domain's MX records, IP addresses of the MX records, the SPF record of the provided domain, and the IP addresses of the following subdomains: mail, email, webmail, smtp, pop, & imap.

Syntax: digmail <domain> [<server|IP>]

~ $ digmail digdeepdns.net web4042.websitewelcome.com IP address of @web4042.websitewelcome.com: @192.185.2.65 DIGGING @web4042.websitewelcome.com FOR a IN digdeepdns.net digdeepdns.net. 14400 IN A 192.185.57.22 DIGGING @web4042.websitewelcome.com FOR mx IN digdeepdns.net digdeepdns.net. 14400 IN MX 0 digdeepdns.net. IP addresses @web4042.websitewelcome.com of the MX records of digdeepdns.net: digdeepdns.net. 14400 IN A 192.185.57.22 PTR records (rDNS) for the IP addresses of the MX records of digdeepdns.net: SPF record @web4042.websitewelcome.com for digdeepdns.net... "v=spf1 ip4:70.84.243.130 a mx ip4:192.185.57.216 include:websitewelcome.com ~all" DIGGING @web4042.websitewelcome.com FOR a IN (mail email webmail smtp pop imap).digdeepdns.net mail.digdeepdns.net. 14400 IN CNAME digdeepdns.net. digdeepdns.net. 14400 IN A 192.185.57.22 webmail.digdeepdns.net. 14400 IN A 192.185.57.22

echomx

echomx is a simple script that can echo the MX records of Google Apps Mail and GoDaddy Email. This script is only useful for recalling the MX records of these two services without looking them up online.

Syntax: echomx <google|godaddy>

~$ echomx google Pri. Hostname 1 aspmx.l.google.com 5 alt1.aspmx.l.google.com 5 alt2.aspmx.l.google.com 10 aspmx2.googlemail.com 10 aspmx3.googlemail.com

rdns

Dig has a built-in flag for an rDNS lookup as dig -x ip.ad.dr.ess. However, this lookup will only accept an IP address for its input. It is possible to use dig -x $(dig host.name.tld) as a workaround, but this does not work at all if host.name.tld returns a CNAME first before an A record (IP address). rdns solves this issue. It can take any hostname as its input, get the IP address that the hostname resolves to (and filter out any CNAMEs), and then perform an rDNS lookup on the resultant IP address.

Syntax: rdns <hostname> [<server|IP>]

~ $ dig +short www.hostgator.com hostgator.com. 50.97.99.189 ~ $ rdns hostgator.com IP address of hostgator.com : 50.97.99.189 rDNS of 50.97.99.189: 50.97.99.189-static.reverse.softlayer.com.

spfinfo

spfinfo is currently still in development. However, this script will be capable of retrieving a given domain's SPF record (if it has one) and provide a detailed breakdown of the policy defined in the SPF record.

Fooling Mode DDDNS "Tools"

The "tools" included in the Fooling Mode expansion aren't exactly useful tools per se. Rather, they are quick scripts that I wrote for the fun of it, that I sometimes use on my own. These scripts can be installed separately from the Standard distribution of the DDDNS Toolkit. The name "Fooling Mode" is a reference to a jingle that is used in the anime series Naruto whenever the show forgoes serious plot development to have some nonsensical (and sometimes non sequitir) fun.

cointoss

cointoss uses a pseudo random number generator (PRNG) to toss a coin n times. cointoss keeps internal count of how many times the coin lands on heads or tails, and outputs the winner of the toss. For values of n greater than 10, cointoss will also output a count of heads and tails.

Syntax: cointoss <number>

~$ cointoss 10 Best 6 out of 10? Heads! Heads! Tails! Heads! Heads! Heads! Tails! Heads! Tails! Heads! Heads wins! ~$ cointoss 20 Best 11 out of 20? Tails! Tails! Tails! Heads! Tails! Tails! Tails! Heads! Tails! Heads! Tails! Heads! Heads! Tails! Tails! Heads! Tails! Tails! Heads! Heads! Heads: 8 Tails: 12 Tails wins!

roll

roll uses a PRNG to roll n dice of x sides. roll takes its input in standard Table Top RPG die format: [n]dx. If n is greater than 1, roll will also output a total of all the rolls.

Syntax: roll <[n]>d<x>

~$ roll d20 Rolling one d20... 7 ~$ roll 10d6 Rolling 10 d6s... 5 5 2 6 5 4 1 5 3 5 Total: 41

rolld

rolld uses a PRNG to roll a single die of n sides. rolld is the precursor to roll.

Syntax: rolld <number>

~$ rolld 100 Rolling 1d100: 23