mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-25 18:30:23 +00:00
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@5 e7d03fd6-7b0d-0410-9947-9c21f3af8025
24 lines
665 B
Python
24 lines
665 B
Python
# $Id$
|
|
# routines for lazy people.
|
|
import Base
|
|
|
|
def revlookup(name):
|
|
"convenience routine for doing a reverse lookup of an address"
|
|
import string
|
|
a = string.split(name, '.')
|
|
a.reverse()
|
|
b = string.join(a, '.')+'.in-addr.arpa'
|
|
# this will only return one of any records returned.
|
|
return Base.DnsRequest(b, qtype = 'ptr').req().answers[0]['data']
|
|
|
|
def mxlookup(name):
|
|
"""
|
|
convenience routine for doing an MX lookup of a name. returns a
|
|
sorted list of (preference, mail exchanger) records
|
|
"""
|
|
|
|
a = Base.DnsRequest(name, qtype = 'mx').req().answers
|
|
l = map(lambda x:x['data'], a)
|
|
l.sort()
|
|
return l
|
|
|