Interesting DNS Hacks

Frederic Cambus January 09, 2013 [DNS]

DNS Gateway for Twitter and

A neat hack allowing to query Twitter statuses, timelines, and user information over DNS:

dig TXT +short
"Teletext in Poland - Part I and II: and #textmode #teletext" "Wed Jan 09 13:26:12 +0000 2013"

dig TXT +short
"Just released my ANSi Social Media Icon Set -" "Thu Jun 09 16:17:32 +0000 2011"

dig TXT +short
;; Truncated, retrying in TCP mode.
"DANE (RFC 6698) has been deployed on StatDNS' DNS Testground domain: #dnssec #dane" "Thu Jan 03 17:46:50 +0000 2013"
"Zone Files Statistics - January 2013 Reports - #dns #dnssec" "Wed Jan 02 11:50:54 +0000 2013"
"Added RFC 6781: DNSSEC Operational Practices, Version 2 - #DNS #DNSSEC #RFC" "Mon Dec 24 16:41:32 +0000 2012"
"Zone Files Statistics - December 2012 Reports -  #dns #dnssec" "Sun Dec 02 09:19:21 +0000 2012"
"Zone Files Statistics - November 2012 Reports - #dns #dnssec" "Fri Nov 02 11:27:40 +0000 2012"
"Zone Files Statistics - October 2012 Reports - #dns #dnssec" "Sat Oct 06 12:09:53 +0000 2012"
"Zone Files Statistics - September 2012 Reports - #dns #dnssec" "Sun Sep 02 17:34:33 +0000 2012"
"DNS related RFCs (An up to date list of Domain Name System RFCs) - #DNS #DNSSEC #RFC" "Mon Aug 27 10:55:15 +0000 2012"
"StatDNS' DNS Testground hosts some seldom used resource record types, useful to test DNS tools: #DNS #DNSSEC" "Wed Apr 04 16:21:29 +0000 2012"

dig statdns.twitter TXT +short
"DANE (RFC 6698) has been deployed on StatDNS' DNS Testground domain: #dnssec #dane"
"Thu Jan 03 17:46:50 +0000 2013"
"DNS and Domain Names statistics and tools"

Wikipedia over DNS:

This one is pretty much self-explanatory, you can query DNS related articles (and not only!) over DNS (more information here):

dig TXT +short
"BIND , or named , is the most widely used DNS software on the Internet. On Unix-like operating systems it is the de facto standard."

dig TXT +short
"In Internet computing, NSD (for \"name server daemon\") is an open-source server program for the Domain Name System. It was developed by NLnet Labs of Amsterdam in cooperation with the RIPE NCC, from scratch as an authoritative name server (i.e., not implem" "enting the recursive caching function by design). The intention of this development is to add variance to the \"gene pool..."

dig TXT +short
"PowerDNS is a DNS server, written in C++ and licensed under the GPL. It runs on most Unix derivatives and on Microsoft Windows. PowerDNS features a large number of different backends ranging from simple BIND style zonefiles to relational databases and loa" "d balancing/failover algorithms. A DNS recursor is also included as a separate program."

Postcode locations:

You can find the geographic location of any UK postcode by querying LOC records on subdomains:

dig LOC +short
56 7 27.822 N 3 50 35.480 W 0.00m 0.00m 0.00m 0.00m

For the curious mind, you can check on Google Maps why I picked up this exact postcode :)

DNS Calculator:

A calculator supporting addition, subtraction, multiplication and division (respectively: ADD, SUB ,MUL, and DIV operations). More information here.

dig +short

dig +short

dig +short

dig +short

Secure Reverse Polish DNS Calculator:

An even better calculator using Reverse Polish notation (RPN), and providing DNSSEC signed answers, making it impossible for third parties to temper with the results :D More information here.

Here is an example showing how to calculate 2*3+2 (as you can see, the answers are signed):

dig 2.3.* TXT +dnssec

; <<>> DiG 9.7.3 <<>> 2.3.* TXT +dnssec
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14766
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags: do; udp: 4096
;2.3.*	IN	TXT

2.3.* 10	IN	TXT	"8"
2.3.* 10	IN	TXT	"This DNS message (including the RR(s) in the additional section) is confidential, proprietary, may be subject to copyright and legal privilege and no related rights are waived." "If you are not the intended recipient or its agent, any review, dissemination, distribution or copying of this DNS message. or any of its content is strictly prohibited and may be unlawful." "All messages may be monitored as permitted by applicable law and regulations and our policies to protect our business." "DNS messages are not secure and you are deemed to have accepted any risk if you communicate with us using DNS." "If received in error, please notify us immediately and delete the DNS message (and any of its sections) from any computer or any storage medium without printing a copy."
2.3.* 10	IN	RRSIG	TXT 1 8 10 20130427124228 20130226124228 27900 4Gi6ald7O06e8/1anCmCYE3EThUUJP9ikMo3QWa1ZUJteWmCFcbL34cJ ebt5cNGQsYYbwl4QCV/Vt++JLbL3Xw==

;; Query time: 26 msec
;; WHEN: Tue Feb 26 12:42:28 2013
;; MSG SIZE  rcvd: 959

IP to ASN Mapping via DNS

A service providing a way to map IPv4 and IPv6 addresses or prefixs to ASNs, get information about ASNs, and even find possible peers. More details here.

Mapping an IP address or prefix to a corresponding BGP Origin ASN:

dig TXT +short
"23028 | | US | arin | 1998-09-25"

dig TXT +short
"23028 | | US | arin | 1998-09-25"

dig TXT +short
"15169 | 2001:4860::/32 | US | arin | 2005-03-14"

Getting information about a given ASN:

dig TXT +short
"23028 | US | arin | 2002-01-04 | TEAM-CYMRU - Team Cymru Inc."

Getting external IP address via DNS

Probably the fastest way to get your external IP address (supports IPv4 only), as unlike the various HTTP services available it doesn't require initializing a TCP connection (if you're looking for such services, I recommend Telize, working for both IPv4 and IPv6):

dig +short

dig +short

Google also provides a similar service:

dig TXT +short

dig TXT +short

dig TXT +short

dig TXT +short

Distributing source code via DNS

A clever hack using CNAME chains to distribute gzipped data. More information here.

for DVDs in Linux screw the MPAA and ; do dig $ ; done | \
  perl -ne 's/\.//g; print pack("H224",$1) if(/^x([^z]*)/)' | gunzip

Back to top