iwla/plugins/post_analysis/reverse_dns.py

31 lines
625 B
Python
Raw Normal View History

import socket
from iwla import IWLA
PLUGIN_CLASS = 'HTTP'
API_VERSION = 1
def get_plugins_infos():
infos = {
'class' : PLUGIN_CLASS,
'min_version' : API_VERSION,
'max_version' : -1
}
return infos
def load():
socket.setdefaulttimeout(0.5)
return True
def hook(iwla):
hits = iwla.getValidVisitors()
for (k, hit) in hits.items():
if hit.get('dns_analysed', False): continue
try:
name, _, _ = socket.gethostbyaddr(k)
hit['remote_addr'] = name
except:
pass
finally:
hit['dns_analysed'] = True