From 6ce0374fe72793c4ad4eb07bb99247be6bbd0b2a Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Mon, 7 Nov 2022 21:13:49 +0100 Subject: [PATCH] Display external referers in filter_users plugin --- plugins/display/filter_users.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/display/filter_users.py b/plugins/display/filter_users.py index bc81899..2d8a5ab 100644 --- a/plugins/display/filter_users.py +++ b/plugins/display/filter_users.py @@ -74,8 +74,8 @@ class IWLADisplayFilterUsers(IPlugin): path = self.iwla.getCurDisplayPath(filename) page = display.createPage(title, path, self.iwla.getConfValue('css_path', [])) - table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Filtered users'), [self.iwla._(u'Pages'), self.iwla._(u'Last Access'), self.iwla._(u'User Agent')]) - table.setColsCSSClass(['iwla_page', '', '']) + table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Filtered users'), [self.iwla._(u'Pages'), self.iwla._(u'Last Access'), self.iwla._(u'User Agent'), self.iwla._(u'Referer')]) + table.setColsCSSClass(['iwla_page', '', '', '']) row = 0 unknown = self.iwla._('Unknown') for filtered_user in self.filtered_users: @@ -95,9 +95,15 @@ class IWLADisplayFilterUsers(IPlugin): if not self.iwla.isPage(uri): continue if not self.iwla.hasBeenViewed(r): continue + referer = '' + if r.get('extract_referer', ''): + referer = r['extract_referer']['extract_uri'] + # Display only external referers + if referer == '-' or self.iwla.domain_name_re.match(referer): + referer = '' uri = "%s%s" % (r.get('server_name', ''), r['extract_request']['extract_uri']) - table.appendRow([generateHTMLLink(uri), time.asctime(r['time_decoded']), r['http_user_agent']]) + table.appendRow([generateHTMLLink(uri), time.asctime(r['time_decoded']), r['http_user_agent'], referer]) page.appendBlock(table) display.addPage(page)