[40948] in North American Network Operators' Group

home help back first fref pref prev next nref lref last post

Re: DNS Parser

daemon@ATHENA.MIT.EDU (Andrew Brown)
Mon Aug 27 17:31:35 2001

Date: Mon, 27 Aug 2001 17:26:30 -0400
From: Andrew Brown <twofsonet@graffiti.com>
To: Deepak Jain <deepak@ai.net>
Cc: "Nanog@Merit. Edu" <nanog@merit.edu>
Message-ID: <20010827172630.A1869@noc.untraceable.net>
Reply-To: Andrew Brown <atatat@atatdot.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <GPEOJKGHAMKFIOMAGMDIEEDKFDAA.deepak@ai.net>; from deepak@ai.net on Mon, Aug 27, 2001 at 05:23:30PM -0400
Errors-To: owner-nanog-outgoing@merit.edu


>Does anyone know of a simple script that will go through a list of BIND
>primary files, or more and output a list of output like this:
>
>secondlevel.domain --> address
>thirdlevel.secondlevel.domain --> address
>
>and so on for several thousand domain files.
>
>We acquired a company that never kept their reverses up to date and need a
>simple way of building them to keep track of their IP utilizations.
>
>There is probably one written in perl out there somewhere, I'd appreciate a
>pointer.

it would probably be easy enough to throw one together, however, i'd
suggest sucking all the zones directly out of bind via axfr instead of
reading the zone files directly.  that "normalizes" the output to
something you can pass through grep rather easily.  ex:

   % dig example.com axfr @192.168.189.7 | grep '\<IN.A\>'
   home                    5M IN A         192.168.189.65
   localhost               1D IN A         127.0.0.1
   www                     5M IN A         192.168.189.72
   wombat                  5M IN A         192.168.189.65
   %

from there it's only a short hop to reversing the information.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."

home help back first fref pref prev next nref lref last post