iwla/plugins/post_analysis/reverse_dns.py

28 lines
517 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():
try:
name, _, _ = socket.gethostbyaddr(k)
hit['remote_addr'] = name
except:
pass