On Wed, Jun 20, 2012 at 6:53 AM, Stephane Bortzmeyer <[email protected]>wrote:

> On Mon, Jun 04, 2012 at 05:08:22PM -0300,
>  Leandro Reox <[email protected]> wrote
>  a message of 30 lines which said:
>
> > is there any way to retrieve all the records in a zone/domain via
> > some query ?
>
> DNSpython does not support ANY queries :-(
>
>
It seems like the AXFR is the right query type to use.


> The Answer object can only hold one RRset which, IMHO, is a mistake.
>
>
It isn't necessary to use Answer.  There are more primitive functions that
can be used to get more functionality (e.g., AXFR, ANY, EDNS, DNSSEC, etc.)

>>> import dns.message, dns.name, dns.query, dns.rdatatype
>>> msg = dns.message.make_query(dns.name.from_text('.'),
dns.rdatatype.AXFR)
>>> response = dns.query.tcp(msg, '192.228.79.201', 5, 53)
>>> response
<DNS message, ID 34762>

>>> import dns.message, dns.name, dns.query, dns.rdatatype
>>> msg = dns.message.make_query(dns.name.from_text('.'), dns.rdatatype.ANY)
>>> response = dns.query.tcp(msg, '192.228.79.201', 5, 53)
>>> response
<DNS message, ID 996>

>>> import dns.message, dns.name, dns.query, dns.rdatatype
>>> msg = dns.message.make_query(dns.name.from_text('.'), dns.rdatatype.SOA)
>>> msg.use_edns(0, dns.flags.DO)
>>> response = dns.query.udp(msg, '192.228.79.201', 5, 53)
>>> response
<DNS message, ID 50728>

etc...

Casey
_______________________________________________
dnspython-users mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo/dnspython-users

Reply via email to