Files
zonemaster.es/zonemaster-ldns/ldns/contrib/python/examples/python3/ldns-mx1.py
Malin eaaa8f6a11 fix: populate ldns submodule and add autotools to LDNS build stage
- Re-cloned zonemaster-ldns with --recurse-submodules so the bundled
  ldns C library source (including Changelog and configure.ac) is present
- Added autoconf, automake, libtool to Dockerfile.backend ldns-build stage
  so libtoolize + autoreconf can generate ldns/configure during make

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 08:33:38 +02:00

19 lines
433 B
Python
Executable File

#!/usr/bin/python
#
# MX is a small program that prints out the mx records for a particular domain
#
import ldns
dname = ldns.ldns_dname("nic.cz")
print(dname)
resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf")
pkt = resolver.query(dname, ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN)
if (pkt):
mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER)
if (mx):
mx.sort()
print(mx)