DNS/実装/python/dnslib/lame_check/CF.pyについて、ここに記述してください。

   1 class CFH:
   2    
   3    def __init__(self):
   4       self.cf_ns = {} 
   5       for line in open('/home/tmaeno/dnslib/cf.h.a', 'r'):
   6         s = line.split()
   7         self.cf_ns[s[0]] = s[-1]
   8 
   9    
  10    def checkns(self, d, nsset):
  11       from Get_ns import get_ns
  12       print ('NS ', d, nsset)
  13       for delns in nsset:
  14           p = delns.find('.ns.cloudflare.com')  # domain
  15           if p >=0 :
  16              name = delns[0:p] 
  17              if name in self.cf_ns:
  18                 address = self.cf_ns[name]
  19           else: 
  20              return set () # empty list
  21 
  22           zonens = get_ns(d, address)
  23           if zonens:
  24                 if nsset <= zonens :   # delegation set == zone ns set
  25                    print ('match', d, name, list(zonens - nsset))
  26                 else:
  27                    print ('zone', d, zonens)
  28           else:
  29                 print ('RF  ', d, name)   # no zone
  30          # non-cloudflare ns are ignored       

MoinQ: DNS/実装/python/dnslib/lame_check/CF.py (last edited 2021-03-04 15:07:36 by ToshinoriMaeno)