I'd like to make DNS queries to check if some entries in the /etc/hosts file are obsolete (now working DNS) or conflicting with DNS answers. nsswitch.conf is configured to lookup /etc/hosts first. gethostbyname() or getaddrinfo() will not work because they both use the OSes mechasnims (nsswitch.conf).
I know about the pythonDNS package. Unfortunatly it's rather difficult to install 开发者_如何学Goadditional packages on the systems. Also, the python version available is rather old (python23).
The only possible solution I see so far is parsing nslookup or dig output. But I really don't like the idea because of the complexity involved (CNAMEs, multiple records,...).
I'm searching for a single class/function solution to make DNS A-Record Lookups.
The obvious options:
- PyDNS
- dnspython
- Call res_query via the libresolv C API (e.g. using ctypes)
Twisted Names contains a DNS client.
I always liked evdns
http://linux.die.net/man/3/evdns
There appears to be a python binding called pyevent
http://code.google.com/p/pyevent/source/browse/trunk/evdns.pxi?r=44
Is it impossible to install additional software because of technical limitations or because of policy?
If it's not policy you might be able to get somewhere with virtualenv
精彩评论