[Unbound-users] Can python module handle an answer of DNS query?
Christopher Olah
christopherolah.co at gmail.com
Tue Sep 6 00:15:03 UTC 2011
You can do this in ldns, but may find it easier to do in ldnsx (
http://oldwww.xelerance.com/ldnsx/html/). Using the convenience function
get_rrs() we can do:
import ldnsx
ip_addr = ldnsx.get_rrs("example.com","A")[0].ip()
Though you'll get an exception if there aren't any A records.
Alternatively, you could not use convenience functions and do:
import ldnsx
res = ldnsx.resolver()
pkt = res.query("example.com","A")
ans = pkt.answer()
ip_addr = ans[0].ip()
Christopher
On Mon, Sep 5, 2011 at 3:07 PM, Rishat <rishat at nixnotes.ru> wrote:
> **
> Hello
>
> Having python module i want to record queries and answers to MySQL
> database. From example1,2 i know how to get queries like "example.com" but
> don't yet know which python variable can get me answer of IP address list
> from respond. Is it possible with python module to do this?
>
> Sorry for my English and thanks in advance.
>
> BR Rishat
>
>
>
>
> _______________________________________________
> Unbound-users mailing list
> Unbound-users at unbound.net
> http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/unbound-users/attachments/20110905/7050d82f/attachment.htm>
More information about the Unbound-users
mailing list