North American Network Operators Group

Date Prev | Date Next | Date Index | Thread Index | Author Index | Historical

Re: DNS Parser

  • From: Andrew Brown
  • Date: Mon Aug 27 17:33:44 2001

>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" >-----|
[email protected]             * "ah!  i see you have the internet
[email protected] (Andrew Brown)                that goes *ping*!"
[email protected]       * "information is power -- share the wealth."