iwla

iwla Commit Details

Date:2015-02-07 15:28:24 (6 years 5 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:f3fbf8b727e6aa34136be676259f725daf433d92
Parents: e67723e58ed9f4a3cc478a7218cf29db71df36ad
Message:Add pages and hits to track_users

Changes:
Mplugins/display/track_users.py (3 diffs)

File differences

plugins/display/track_users.py
6565
6666
6767
68
6869
6970
7071
......
8182
8283
8384
85
86
8487
8588
89
8690
87
88
91
92
8993
9094
95
9196
9297
9398
99
94100
95101
96102
......
103109
104110
105111
106
112
107113
108114
109115
110116
111117
112118
113
119
114120
def hook(self):
display = self.iwla.getDisplay()
hits = self.iwla.getCurrentVisists()
stats = {}
# All in a page
if self.create_tracked_page:
else:
ip_title = '<b>%s</b>' % (ip)
table.appendRow([ip_title, ''])
nb_hits = 0
nb_pages = 0
for r in hits[ip]['requests'][::-1]:
uri = r['extract_request']['extract_uri'].lower()
if not self.iwla.hasBeenViewed(r): continue
if not self.iwla.isPage(uri) or\
self.iwla.isMultimediaFile(uri) or\
not self.iwla.hasBeenViewed(r):
self.iwla.isMultimediaFile(uri):
nb_hits += 1
continue
nb_pages += 1
uri = "%s%s" % (r.get('server_name', ''),
r['extract_request']['extract_uri'])
table.appendRow([generateHTMLLink(uri), time.asctime(r['time_decoded'])])
stats[ip] = (nb_pages, nb_hits)
page.appendBlock(table)
display.addPage(page)
index = self.iwla.getDisplayIndex()
table = display.createBlock(DisplayHTMLBlockTable, title, [self.iwla._(u'IP'), self.iwla._(u'Last Access')])
table = display.createBlock(DisplayHTMLBlockTable, title, [self.iwla._(u'IP'), self.iwla._(u'Last Access'), self.iwla._(u'Pages'), self.iwla._(u'Hits')])
for ip in self.tracked_ip:
if not ip in hits.keys(): continue
if 'dns_name_replaced' in hits[ip].keys():
ip_title = '%s [%s]' % (hits[ip]['remote_addr'], ip)
else:
ip_title = ip
table.appendRow([ip_title, time.asctime(hits[ip]['last_access'])])
table.appendRow([ip_title, time.asctime(hits[ip]['last_access']), stats[ip][0], stats[ip][1]])
index.appendBlock(table)

Archive Download the corresponding diff file

Branches

Tags