Add top visitors and reverse dns plugins
This commit is contained in:
27
plugins/display/top_visitors.py
Normal file
27
plugins/display/top_visitors.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import time
|
||||
from display import *
|
||||
|
||||
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():
|
||||
return True
|
||||
|
||||
def hook(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'], super_hit['bandwidth'], 0]
|
||||
row = map(lambda(v): str(v), row)
|
||||
row[4] = time.asctime(super_hit['last_access'])
|
||||
table.appendRow(row)
|
||||
index.appendBlock(table)
|
Reference in New Issue
Block a user