37 lines
1.0 KiB
Plaintext
37 lines
1.0 KiB
Plaintext
|
|
LDNSX: Easy DNS (including DNSSEC) via ldns.
|
||
|
|
|
||
|
|
ldns is a great library. It is a powerful tool for
|
||
|
|
working with DNS. python-ldns it is a straight up clone of the C
|
||
|
|
interface, however that is not a very good interface for python. Its
|
||
|
|
documentation is incomplete and some functions don't work as
|
||
|
|
described. And some objects don't have a full python API.
|
||
|
|
|
||
|
|
ldnsx aims to fix this. It wraps around the ldns python bindings,
|
||
|
|
working around its limitations and providing a well-documented, more
|
||
|
|
pythonistic interface.
|
||
|
|
|
||
|
|
Written by Christopher Olah <chris@xelerance.com>
|
||
|
|
|
||
|
|
Examples
|
||
|
|
========
|
||
|
|
|
||
|
|
Query the default resolver for google.com's A records. Print the response
|
||
|
|
packet.
|
||
|
|
|
||
|
|
>>> import ldnsx
|
||
|
|
>>> resolver = ldnsx.resolver()
|
||
|
|
>>> print resolver.query("google.com","A")
|
||
|
|
|
||
|
|
Print the NS records for com. from f.root-servers.net if we get a
|
||
|
|
response, else an error message.
|
||
|
|
|
||
|
|
>>> import ldnsx
|
||
|
|
>>> pkt = ldnsx.resolver("f.root-servers.net").query("com.","NS")
|
||
|
|
>>> if pkt:
|
||
|
|
>>> for rr in pkt.answer():
|
||
|
|
>>> print rr
|
||
|
|
>>> else:
|
||
|
|
>>> print "response not received"
|
||
|
|
|
||
|
|
|