Add pages and hits to track_users
This commit is contained in:
		| @@ -65,6 +65,7 @@ class IWLADisplayTrackUsers(IPlugin): | ||||
|     def hook(self): | ||||
|         display = self.iwla.getDisplay() | ||||
|         hits = self.iwla.getCurrentVisists() | ||||
|         stats = {} | ||||
|  | ||||
|         # All in a page | ||||
|         if self.create_tracked_page: | ||||
| @@ -81,16 +82,21 @@ class IWLADisplayTrackUsers(IPlugin): | ||||
|                 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) | ||||
| @@ -103,12 +109,12 @@ class IWLADisplayTrackUsers(IPlugin): | ||||
|  | ||||
|         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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user