Add option count_hit_only_visitors and function isValidForCurrentAnalysis()
This commit is contained in:
@@ -11,6 +11,8 @@ class IWLADisplayAllVisits(IPlugin):
|
||||
|
||||
def hook(self):
|
||||
hits = self.iwla.getValidVisitors()
|
||||
display_visitor_ip = self.iwla.getConfValue('display_visitor_ip', False)
|
||||
|
||||
last_access = sorted(hits.values(), key=lambda t: t['last_access'], reverse=True)
|
||||
|
||||
cur_time = self.iwla.getCurTime()
|
||||
@@ -23,7 +25,7 @@ class IWLADisplayAllVisits(IPlugin):
|
||||
table = DisplayHTMLBlockTable('Last seen', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen'])
|
||||
for super_hit in last_access:
|
||||
address = super_hit['remote_addr']
|
||||
if self.iwla.getConfValue('display_visitor_ip', False) and\
|
||||
if display_visitor_ip and\
|
||||
super_hit.get('dns_name_replaced', False):
|
||||
address = '%s [%s]' % (address, super_hit['remote_ip'])
|
||||
|
||||
|
@@ -91,7 +91,6 @@ class IWLADisplayReferers(IPlugin):
|
||||
index.appendBlock(table)
|
||||
|
||||
# All key phrases in a file
|
||||
cur_time = self.iwla.getCurTime()
|
||||
title = time.strftime('Key Phrases - %B %Y', cur_time)
|
||||
|
||||
filename = 'key_phrases_%d.html' % (cur_time.tm_mon)
|
||||
|
@@ -11,8 +11,11 @@ class IWLADisplayTopVisitors(IPlugin):
|
||||
|
||||
def hook(self):
|
||||
hits = self.iwla.getValidVisitors()
|
||||
count_hit_only = self.iwla.getConfValue('count_hit_only_visitors', False)
|
||||
display_visitor_ip = self.iwla.getConfValue('display_visitor_ip', False)
|
||||
|
||||
top_bandwidth = [(k,hits[k]['bandwidth']) for k in hits.keys()]
|
||||
top_bandwidth = [(k,v['bandwidth']) for (k,v) in hits.items() \
|
||||
if count_hit_only or v['viewed_pages']]
|
||||
top_bandwidth = sorted(top_bandwidth, key=lambda t: t[1], reverse=True)
|
||||
top_visitors = [hits[h[0]] for h in top_bandwidth[:10]]
|
||||
|
||||
@@ -20,7 +23,7 @@ class IWLADisplayTopVisitors(IPlugin):
|
||||
table = DisplayHTMLBlockTable('Top visitors', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen'])
|
||||
for super_hit in top_visitors:
|
||||
address = super_hit['remote_addr']
|
||||
if self.iwla.getConfValue('display_visitor_ip', False) and\
|
||||
if display_visitor_ip and\
|
||||
super_hit.get('dns_name_replaced', False):
|
||||
address = '%s [%s]' % (address, super_hit['remote_ip'])
|
||||
|
||||
|
Reference in New Issue
Block a user