apt-get install -y python-adns
#!/usr/bin/python
import DNS
import string
DNS.ParseResolvConf()
def get_ptr(ip):
a = string.split(ip, '.')
a.reverse()
name = string.join(a, '.') + '.in-addr.arpa'
x = DNS.DnsRequest(name,qtype='ptr')
x.req()
return x.response.answers[0]['data']
print get_ptr('67.195.37.179')
В результате получаем:
python dns.py
llf320063.crawl.yahoo.net
No comments :
Post a Comment
Note: only a member of this blog may post a comment.