本文整理汇总了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
示例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