标签:同步多域名dig
#!/usr/bin/env python
import dns.resolver
class Mydig:
def __init__(self):
self.data = {}
def get_dig_domain(self, domain_list):
for domain in domain_list:
res = dns.resolver.query(domain, 1)
for i in res.response.answer:
for j in i.items:
if j.rdtype == 5:
find_res = j.to_text().find(‘***dns.com‘)
self.data[domain] = 0 if find_res != -1 else -1
else:
self.data[domain] = -1
break
if __name__ == ‘__main__‘:
domain_list = [
"www.baidu.com",
"www.qq.com",
"dl.3366.com",
]
obj = Mydig()
obj.get_dig_domain(domain_list)
print obj.data
本文出自 “开发与运维” 博客,谢绝转载!
标签:同步多域名dig
原文地址:http://yeqing.blog.51cto.com/3159086/1925162