@@ -0,0 +1,757 @@
+import sys%0Aimport dnslib%0Aimport dnstype%0Aimport dnsopcode%0Aimport dnsclass%0Aimport socket%0Aimport select%0A%0Adef main():%0A    server = 'cnri.reston.va.us'%09# How?%0A    port = 53%0A    opcode = dnsopcode.QUERY%0A    rd = 0%0A    qtype = dnstype.MX%0A    qname = sys.argv%5B1:%5D and sys.argv%5B1%5D or 'www.python.org'%0A    m = dnslib.Mpacker()%0A    m.addHeader(0,%0A%09%090, opcode, 0, 0, rd, 0, 0, 0,%0A%09%091, 0, 0, 0)%0A    m.addQuestion(qname, qtype, dnsclass.IN)%0A    request = m.getbuf()%0A    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)%0A    s.connect((server, port))%0A    s.send(request)%0A    while 1:%0A%09r, w, x = %5Bs%5D, %5B%5D, %5B%5D%0A%09r, w, x = select.select(r, w, x, 0.333)%0A%09print r, w, x%0A%09if r:%0A%09    reply = s.recv(1024)%0A%09    u = dnslib.Munpacker(reply)%0A%09    dnslib.dumpM(u)%0A%09    break%0A%0Amain()%0A

print MX record