同步多域名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",
                 "aa.test.com",
        ]

     obj = Mydig()
     obj.get_dig_domain(domain_list)

     print obj.data


本文转自cloves 51CTO博客,原文链接:http://blog.51cto.com/yeqing/1925162


上一篇:JS解释器之自动类型转换:[] == ![]


下一篇:原创内容与高质量链接, 为什么SEO关键词排名还不理想?