當前位置: 首頁>>代碼示例>>Python>>正文


Python Base.DiscoverNameServers方法代碼示例

本文整理匯總了Python中Base.DiscoverNameServers方法的典型用法代碼示例。如果您正苦於以下問題:Python Base.DiscoverNameServers方法的具體用法?Python Base.DiscoverNameServers怎麽用?Python Base.DiscoverNameServers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Base的用法示例。


在下文中一共展示了Base.DiscoverNameServers方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: revlookup

# 需要導入模塊: import Base [as 別名]
# 或者: from Base import DiscoverNameServers [as 別名]
def revlookup(name):
    "convenience routine for doing a reverse lookup of an address"
    if Base.defaults['server'] == []:
        Base.DiscoverNameServers()
    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'] 
開發者ID:Yukinoshita47,項目名稱:Yuki-Chan-The-Auto-Pentest,代碼行數:11,代碼來源:lazy.py

示例2: mxlookup

# 需要導入模塊: import Base [as 別名]
# 或者: from Base import DiscoverNameServers [as 別名]
def mxlookup(name):
    """
    convenience routine for doing an MX lookup of a name. returns a
    sorted list of (preference, mail exchanger) records
    """
    if Base.defaults['server'] == []:
        Base.DiscoverNameServers()
    a = Base.DnsRequest(name, qtype='mx').req().answers
    l = sorted(map(lambda x: x['data'], a))
    return l

#
# $Log: lazy.py,v $
# Revision 1.5.2.1  2007/05/22 20:23:38  customdesigned
# Lazy call to DiscoverNameServers
#
# Revision 1.5  2002/05/06 06:14:38  anthonybaxter
# reformat, move import to top of file.
#
# Revision 1.4  2002/03/19 12:41:33  anthonybaxter
# tabnannied and reindented everything. 4 space indent, no tabs.
# yay.
#
# Revision 1.3  2001/08/09 09:08:55  anthonybaxter
# added identifying header to top of each file
#
# Revision 1.2  2001/07/19 06:57:07  anthony
# cvs keywords added
#
# 
開發者ID:Yukinoshita47,項目名稱:Yuki-Chan-The-Auto-Pentest,代碼行數:32,代碼來源:lazy.py

示例3: dnslookup

# 需要導入模塊: import Base [as 別名]
# 或者: from Base import DiscoverNameServers [as 別名]
def dnslookup(name,qtype):
    "convenience routine to return just answer data for any query type"
    if Base.defaults['server'] == []: Base.DiscoverNameServers()
    result = Base.DnsRequest(name=name, qtype=qtype).req()
    if result.header['status'] != 'NOERROR':
        raise ServerError("DNS query status: %s" % result.header['status'],
            result.header['rcode'])
    elif len(result.answers) == 0 and Base.defaults['server_rotate']:
        # check with next DNS server
        result = Base.DnsRequest(name=name, qtype=qtype).req()
    if result.header['status'] != 'NOERROR':
        raise ServerError("DNS query status: %s" % result.header['status'],
            result.header['rcode'])
    return [x['data'] for x in result.answers] 
開發者ID:Flolagale,項目名稱:mailin,代碼行數:16,代碼來源:lazy.py

示例4: revlookup

# 需要導入模塊: import Base [as 別名]
# 或者: from Base import DiscoverNameServers [as 別名]
def revlookup(name):
    "convenience routine for doing a reverse lookup of an address"
    if Base.defaults['server'] == []: Base.DiscoverNameServers()
    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'] 
開發者ID:blackye,項目名稱:luscan-devel,代碼行數:10,代碼來源:lazy.py

示例5: mxlookup

# 需要導入模塊: import Base [as 別名]
# 或者: from Base import DiscoverNameServers [as 別名]
def mxlookup(name):
    """
    convenience routine for doing an MX lookup of a name. returns a
    sorted list of (preference, mail exchanger) records
    """
    if Base.defaults['server'] == []: Base.DiscoverNameServers()
    a = Base.DnsRequest(name, qtype = 'mx').req().answers
    l = map(lambda x:x['data'], a)
    l.sort()
    return l

#
# $Log: lazy.py,v $
# Revision 1.5.2.1  2007/05/22 20:23:38  customdesigned
# Lazy call to DiscoverNameServers
#
# Revision 1.5  2002/05/06 06:14:38  anthonybaxter
# reformat, move import to top of file.
#
# Revision 1.4  2002/03/19 12:41:33  anthonybaxter
# tabnannied and reindented everything. 4 space indent, no tabs.
# yay.
#
# Revision 1.3  2001/08/09 09:08:55  anthonybaxter
# added identifying header to top of each file
#
# Revision 1.2  2001/07/19 06:57:07  anthony
# cvs keywords added
#
# 
開發者ID:blackye,項目名稱:luscan-devel,代碼行數:32,代碼來源:lazy.py

示例6: mxlookup

# 需要導入模塊: import Base [as 別名]
# 或者: from Base import DiscoverNameServers [as 別名]
def mxlookup(name):
    """
    convenience routine for doing an MX lookup of a name. returns a
    sorted list of (preference, mail exchanger) records
    """
    l = dnslookup(name, qtype = 'mx')
    l.sort()
    return l

#
# $Log: lazy.py,v $
# Revision 1.5.2.7  2011/11/23 17:14:11  customdesigned
# Apply patch 3388075 from sourceforge: raise subclasses of DNSError.
#
# Revision 1.5.2.6  2011/03/21 21:06:47  customdesigned
# Replace map() with list comprehensions.
#
# Revision 1.5.2.5  2011/03/21 21:03:22  customdesigned
# Get rid of obsolete string module
#
# Revision 1.5.2.4  2011/03/19 22:15:01  customdesigned
# Added rotation of name servers - SF Patch ID: 2795929
#
# Revision 1.5.2.3  2011/03/16 20:06:24  customdesigned
# Expand convenience methods.
#
# Revision 1.5.2.2  2011/03/08 21:06:42  customdesigned
# Address sourceforge patch requests 2981978, 2795932 to add revlookupall
# and raise DNSError instead of IndexError on server fail.
#
# Revision 1.5.2.1  2007/05/22 20:23:38  customdesigned
# Lazy call to DiscoverNameServers
#
# Revision 1.5  2002/05/06 06:14:38  anthonybaxter
# reformat, move import to top of file.
#
# Revision 1.4  2002/03/19 12:41:33  anthonybaxter
# tabnannied and reindented everything. 4 space indent, no tabs.
# yay.
#
# Revision 1.3  2001/08/09 09:08:55  anthonybaxter
# added identifying header to top of each file
#
# Revision 1.2  2001/07/19 06:57:07  anthony
# cvs keywords added
#
# 
開發者ID:Flolagale,項目名稱:mailin,代碼行數:49,代碼來源:lazy.py


注:本文中的Base.DiscoverNameServers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。