/FakeDns /dnslib /dnspython /qns /set |
Contents
python 3 で使えるDNS用ライブラリを探す。-- ToshinoriMaeno 2019-12-23 12:54:22
1. pydns, py3dns
https://sourceforge.net/projects/pydns/files/py3dns/
- py3dns-3.0.2.tar.gz 2012-04-28 29.4 kB (保守停止?)
2. dnslib
https://github.com/paulc/dnslib
https://pypi.org/project/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/docs/1.12.0/ # Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
2014-09-01 Bob Halley <halley@dnspython.org>
- (Version 1.12.0 released)
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