Parsing an AXFR zone transfer into a name record

Waltner, Steve swaltner at lsil.com
Wed Dec 5 16:23:03 UTC 2001


I wrote a Perl script called printzone which is at
http://homepage.mac.com/swaltner/dns/ that uses the Net::DNS Perl module to
do a zone transfer and print the data "nicely". It does sorting on the
records based on my idea of a properly sorted zone file and spits the zone
to stdout. Based on this thread, it sounds like it might suit your needs.

Steve

> ----------
> From: 	Jobe Bittman
> Sent: 	Monday, December 3, 2001 7:09 PM
> To: 	Kevin Darcy
> Cc: 	bind-users at isc.org
> Subject: 	Re: Parsing an AXFR zone transfer into a name record
> 
> 
> What I am trying to do is get my master files cleaned up so I can upgrade 
> to bind 9.2. Several thousand are in pitiful shape and worked fine under 
> bind8 but gave me some trouble when I moved to bind9. Plus, I want to 
> standardize all my master files so they are easier to work with. I'll try 
> with Net:DNS tonight.
> 
> Thanks for the input.
> 
> At 07:22 PM 12/3/2001 -0500, you wrote:
> 
> >It's still not clear what you are trying to do. Are you trying to roll 
> >your own
> >"named-xfer"? Why?
> >
> >If you're trying to develop some sort of "zone browser" tool using Perl, 
> >why not
> >just use the Net::DNS module and ditch "dig" completely? That's what I
> do. 
> >Then
> >you can output the zone data any way you want.
> >
> >
> >- kevin
> >
> >Jobe Bittman wrote:
> >
> > > Yes. I don't like the ttls on every line either because I don't want
> to
> > > update my perl code for parsing master files. I manned dig but I dont
> get
> > > how the +<query-option> works. I can do a pfmin which I assumed was
> just a
> > > combination of some of the other query-options. But dig with +Header
> =no
> > > doesn't appear to affect the output of my dig.
> > >
> > > This is the output im shooting for:
> > > $TTL 86400
> > > $ORIGIN domain.com.
> > > @       IN      SOA             @
> hostmaster.dnsserver.net. (
> > >                                  2001113003      ; serial (YYYYMMDDn)
> > >                                  108000          ; refresh
> > >                                  3600            ; retry
> > >                                  604800          ; expire
> > >                                  86400           ; minimum
> > >                          )
> > >
> > >                          IN      NS      ns1.tns.net.
> > >                          IN      NS      ns2.tns.net.
> > >                          IN      MX 0    mail.domain.com.
> > >                          IN      MX 10   mail.dnsserver.net.
> > >                          IN      MX 20   mail2.dnsserver.net.
> > >                          IN      A       1.1.1.1
> > > localhost           IN      A       127.0.0.1
> > > www                 IN      CNAME   @
> > > ftp                    IN      CNAME   @
> > > mail              IN    A       1.1.1.1
> > >
> > > If my format or times suck, please tell me.
> > >
> > > At 11:23 PM 12/3/2001 +0000, Barry Margolin wrote:
> > > >In article <9uh11j$9p2 at pub3.rc.vix.com>, Jobe Bittman  <jobe at tns.net>
> 
> > wrote:
> > > > >Are there any tools out there for turning a domain transfer into a
> name
> > > > >record? I cobbled together a little perl script to do this, but it
> only
> > > > >deals with a few records types. I was hoping there was a robust
> tool out
> > > > >there to do this sort of thing.
> > > >
> > > >The output of "dig axfr" is in the same format as a DB file, so you
> > > >shouldn't need to do much.  The only problem is that it shows the SOA
> > > >record twice (at the beginning and end), so you should remove one of
> them
> > > >(I'm not sure this is actually *required* -- they should be
> identical, so
> > > >BIND may allow them both).
> > > >
> > > >--
> > > >Barry Margolin, barmar at genuity.net
> > > >Genuity, Woburn, MA
> > > >*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to 
> > newsgroups.
> > > >Please DON'T copy followups to me -- I'll assume it wasn't posted to
> the
> > > >group.
> 
> 
> 
> 




More information about the bind-users mailing list