How to query lots of DNS records
September 5, 2007 4:59 PM   Subscribe

50 domains, 3 registrars, and DNS records hosted at 6 different providers. I need help inventorying this mess!

I've been given the task of inventorying our domain name situation so that we can make it a little less insane. So far I've been able to collect all the domain names and their nameservers into an Excel document. What I want to do next is get all the DNS records (hopefully) or at least the A, NS, and MX in a format that I can easily bring them into Excel. Ideally I'd like to run a batch or script to do this all at once, but my limited knowledge of nslookup and dig has failed me. Help me hive mind!
posted by TungstenChef to Computers & Internet (6 answers total) 2 users marked this as a favorite
 
Response by poster: I forgot to mention, I'm in an all Windows environment so I can't use any neat Unix tricks.
posted by TungstenChef at 5:05 PM on September 5, 2007


Unix tricks are available to you via cygwin...

Shell scripting can handle this pretty easily.
posted by iamabot at 5:26 PM on September 5, 2007


This is the sort of thing you really, really want Unix shell utilities for. As iamabot says, you can install perfectly good versions via Cygwin.

That said, the time involved in both learning the tools and then writing and debugging a program to do what you need will take many multiples of the time required to just do it yourself. If you assume two minutes per domain (which is high), that's about 100 minutes -- under two hours. Starting from dead scratch with no Unix knowledge, I suspect it would take at least a couple of days to get a working script... maybe longer, depending on how fast you learn.

You could probably also do this with Windows API calls, but you'd need some kind of development environment and a couple of days to figure it out.

You know, I just had a thought. This would probably be relatively easy with Python and a custom library. I see a Python DNS Library, which might abstract your problem well enough to work quickly. Python libraries tend to be extremely elegant and easy to use. I bet you could get something running in a day.

In all three cases, I think it'll be faster to just do it manually.
posted by Malor at 8:15 PM on September 5, 2007


To do this the way I think you're describing, you're going to need permissions to do a zone transfer. Unless you already know the names of the records you want to get and are just looking for tools to confirm them and get any extra details. Not many DNS hosting providers allow zone transfers but their management tool might have a textfile dump util for convenience.
posted by rhizome at 10:51 PM on September 5, 2007


Find a UNIX host, or get cygwin, this is a one liner that assumes you have dig available and domains.txt is a one-per-line list of the domains you're interested in:
(for n in `cat domains.txt`; do dig $n A; dig $n NS; dig $n MX; done )  |grep -v \; | sort  | uniq

posted by Skorgu at 2:32 PM on September 6, 2007


Hell, if you email me the list of domains, I'll run it for you.
posted by Skorgu at 2:33 PM on September 6, 2007


« Older Scrolling on its own...   |   Poor animator-wannabe wants cheap (or free) flash... Newer »
This thread is closed to new comments.