python 3 で使えるDNS用ライブラリを探す。-- ToshinoriMaeno 2019-12-23 12:54:22

/dnspython

1. pydns, py3dns

https://sourceforge.net/projects/pydns/files/py3dns/

2. dnslib

https://github.com/paulc/dnslib

dnslib-0.9.10.tar.gz (69.8 kB) Source None Mar 24, 2019

/dnslib /SimpleDNSserver /FakeDns /qns

3. DNS/dnspython

ISCが作っているというだけで、近づかない方がいいかと、思ってしまう。

Dnspython Manual https://dnspython.readthedocs.io/en/stable/manual.html

https://dnspython.readthedocs.io/en/latest/query.html

http://www.dnspython.org/

2014-09-01 Bob Halley <halley@dnspython.org>

4. python/DNS

http://sourceforge.jp/projects/sfnet_pydns/releases/

5. example

import dns.query
import dns.message

q = dns.message.make_query('m.qmail.jp', 'MX')
print q ; 

print '----  query start ----'
#       answers = dns.query.udp(q, '14.192.44.5')
answers = dns.query.tcp(q, '14.192.44.5')


print answers
#    print 'Host', rdata.exchange, 'has preference', rdata.preference

%python mx.py                                                                     ~/dnsq/0318
id 44076
opcode QUERY
rcode NOERROR
flags RD
;QUESTION
m.qmail.jp. IN MX
;ANSWER
;AUTHORITY
;ADDITIONAL
----  query start ----
id 44076
opcode QUERY
rcode NOERROR
flags QR AA RD
;QUESTION
m.qmail.jp. IN MX
;ANSWER
m.qmail.jp. 3600 IN MX 0 mx.m.qmail.jp.
m.qmail.jp. 3600 IN MX 20 c.mx.m.qmail.jp.
;AUTHORITY
qmail.jp. 86400 IN NS a.ns.qmail.jp.
;ADDITIONAL
mx.m.qmail.jp. 3600 IN A 14.192.44.5
c.mx.m.qmail.jp. 3600 IN A 14.192.44.5
a.ns.qmail.jp. 86400 IN A 14.192.44.5

6. python

https://docs.python.org/2/library/stdtypes.html

MoinQ: DNS/実装/python (last edited 2021-02-26 13:03:39 by ToshinoriMaeno)