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


Python AS_resolver_riswhois._resolve_one方法代碼示例

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


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

示例1: _resolve_one

# 需要導入模塊: from scapy.as_resolvers import AS_resolver_riswhois [as 別名]
# 或者: from scapy.as_resolvers.AS_resolver_riswhois import _resolve_one [as 別名]
def _resolve_one(self, ip):
        """
        overloaded version to provide a Whois resolution on the
        embedded IPv4 address if the address is 6to4 or Teredo. 
        Otherwise, the native IPv6 address is passed.
        """

        if in6_isaddr6to4(ip): # for 6to4, use embedded @
            tmp = inet_pton(socket.AF_INET6, ip)
            addr = inet_ntop(socket.AF_INET, tmp[2:6])
        elif in6_isaddrTeredo(ip): # for Teredo, use mapped address
            addr = teredoAddrExtractInfo(ip)[2]
        else:
            addr = ip
        
        _, asn, desc = AS_resolver_riswhois._resolve_one(self, addr)

        return ip,asn,desc 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:20,代碼來源:inet6.py

示例2: _resolve_one

# 需要導入模塊: from scapy.as_resolvers import AS_resolver_riswhois [as 別名]
# 或者: from scapy.as_resolvers.AS_resolver_riswhois import _resolve_one [as 別名]
def _resolve_one(self, ip):
        """
        overloaded version to provide a Whois resolution on the
        embedded IPv4 address if the address is 6to4 or Teredo.
        Otherwise, the native IPv6 address is passed.
        """

        if in6_isaddr6to4(ip):  # for 6to4, use embedded @
            tmp = inet_pton(socket.AF_INET6, ip)
            addr = inet_ntop(socket.AF_INET, tmp[2:6])
        elif in6_isaddrTeredo(ip):  # for Teredo, use mapped address
            addr = teredoAddrExtractInfo(ip)[2]
        else:
            addr = ip

        _, asn, desc = AS_resolver_riswhois._resolve_one(self, addr)

        if asn.startswith("AS"):
            try:
                asn = int(asn[2:])
            except ValueError:
                pass

        return ip, asn, desc 
開發者ID:secdev,項目名稱:scapy,代碼行數:26,代碼來源:inet6.py


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