| 1 |
LDNSX: Easy DNS (including DNSSEC) via ldns. |
| 2 |
|
| 3 |
ldns is a great library. It is a powerful tool for |
| 4 |
working with DNS. python-ldns it is a straight up clone of the C |
| 5 |
interface, however that is not a very good interface for python. Its |
| 6 |
documentation is incomplete and some functions don't work as |
| 7 |
described. And some objects don't have a full python API. |
| 8 |
|
| 9 |
ldnsx aims to fix this. It wraps around the ldns python bindings, |
| 10 |
working around its limitations and providing a well-documented, more |
| 11 |
pythonistic interface. |
| 12 |
|
| 13 |
Written by Christopher Olah <[email protected]> |
| 14 |
|
| 15 |
Examples |
| 16 |
======== |
| 17 |
|
| 18 |
Query the default resolver for google.com's A records. Print the response |
| 19 |
packet. |
| 20 |
|
| 21 |
>>> import ldnsx |
| 22 |
>>> resolver = ldnsx.resolver() |
| 23 |
>>> print resolver.query("google.com","A") |
| 24 |
|
| 25 |
Print the NS records for com. from f.root-servers.net if we get a |
| 26 |
response, else an error message. |
| 27 |
|
| 28 |
>>> import ldnsx |
| 29 |
>>> pkt = ldnsx.resolver("f.root-servers.net").query("com.","NS") |
| 30 |
>>> if pkt: |
| 31 |
>>> for rr in pkt.answer(): |
| 32 |
>>> print rr |
| 33 |
>>> else: |
| 34 |
>>> print "response not received" |
| 35 |
|
| 36 |
|