MoinQ:

DNS/実装/python/dnslib/問い合わせについて、ここに記述してください。

   1 from dnslib.dns import DNSRecord,DNSHeader,DNSQuestion,QTYPE
   2 
   3 q=DNSRecord(q=DNSQuestion('d.qmail.jp',QTYPE.NS))
   4 print q
   5 print '------'
   6 address = '203.119.1.1'
   7 
   8 a_pkt = q.send(address, 53, tcp=False)
   9 
  10 a = DNSRecord.parse(a_pkt)
  11 
  12 if a.header.tc : # Truncated - retry in TCP mode
  13         a_pkt = q.send(address, 53,tcp=True)
  14         a = DNSRecord.parse(a_pkt)
  15 
  16 print a  # default zone format

MoinQ: DNS/実装/python/dnslib/example/問い合わせ (last edited 2021-02-28 02:01:12 by ToshinoriMaeno)