def host_cache_lookup(ip):
try:
return host_cache[ip]
except KeyError:
pass
try:
hname = socket.gethostbyaddr(ip)[0]
host_cache[ip] = hname
host_cache_add()
return host_cache[ip]
except socket.herror:
pass
host_cache[ip] = ip
return host_cache[ip]
# Countries we're not allowed to report on (iran, north korea)
评论列表
文章目录