File: dot.py

package info (click to toggle)
dnspython 2.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,448 kB
  • sloc: python: 34,885; sh: 7; makefile: 4
file content (22 lines) | stat: -rw-r--r-- 451 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3
#
# This is an example of sending DNS queries over TLS (DoT) with dnspython.

import dns.message
import dns.query
import dns.rdatatype


def main():
    where = "1.1.1.1"
    qname = "example.com."
    q = dns.message.make_query(qname, dns.rdatatype.A)
    r = dns.query.tls(q, where)
    for answer in r.answer:
        print(answer)

        # ... do more lookups


if __name__ == "__main__":
    main()