28 lines
896 B
Python
28 lines
896 B
Python
import time
|
|
|
|
from iwla import IWLA
|
|
from iplugin import IPlugin
|
|
from display import *
|
|
|
|
class IWLADisplayTopVisitors(IPlugin):
|
|
def __init__(self, iwla):
|
|
super(IWLADisplayTopVisitors, self).__init__(iwla)
|
|
self.API_VERSION = 1
|
|
self.requires = ['IWLAPostAnalysisTopVisitors']
|
|
|
|
def hook(self, iwla):
|
|
stats = iwla.getMonthStats()
|
|
|
|
index = iwla.getDisplayIndex()
|
|
table = DisplayHTMLBlockTable('Top visitors', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen'])
|
|
for super_hit in stats['top_visitors']:
|
|
row = [
|
|
super_hit['remote_addr'],
|
|
super_hit['viewed_pages'],
|
|
super_hit['viewed_hits'],
|
|
bytesToStr(super_hit['bandwidth']),
|
|
time.asctime(super_hit['last_access'])
|
|
]
|
|
table.appendRow(row)
|
|
index.appendBlock(table)
|