Main key for visits is now remote_ip and not remote_addr
This commit is contained in:
parent
7507b8e77f
commit
7ef0911fa7
15
iwla.py
15
iwla.py
|
@ -92,7 +92,7 @@ days_stats :
|
|||
nb_visitors
|
||||
|
||||
visits :
|
||||
remote_addr =>
|
||||
remote_ip =>
|
||||
remote_addr
|
||||
remote_ip
|
||||
viewed_pages{0..31} # 0 contains total
|
||||
|
@ -323,22 +323,22 @@ class IWLA(object):
|
|||
return hit['robot'] == True
|
||||
|
||||
def _appendHit(self, hit):
|
||||
remote_addr = hit['remote_addr']
|
||||
remote_ip = hit['remote_ip']
|
||||
|
||||
if not remote_addr: return
|
||||
if not remote_ip: return
|
||||
|
||||
for ip in self.excluded_ip:
|
||||
if ip.match(remote_addr):
|
||||
if ip.match(remote_ip):
|
||||
return
|
||||
|
||||
# Redirected page/hit
|
||||
if int(hit['status']) in (301, 302, 307, 308):
|
||||
return
|
||||
|
||||
if not remote_addr in self.current_analysis['visits'].keys():
|
||||
if not remote_ip in self.current_analysis['visits'].keys():
|
||||
self._createVisitor(hit)
|
||||
|
||||
super_hit = self.current_analysis['visits'][remote_addr]
|
||||
super_hit = self.current_analysis['visits'][remote_ip]
|
||||
# Don't keep all requests for robots
|
||||
if not super_hit['robot']:
|
||||
super_hit['requests'].append(hit)
|
||||
|
@ -424,6 +424,9 @@ class IWLA(object):
|
|||
hit['extract_referer'] = referer_groups.groupdict("")
|
||||
hit['extract_referer']['extract_uri'] = self._normalizeURI(hit['extract_referer']['extract_uri'], True)
|
||||
hit['extract_referer']['extract_parameters'] = self._normalizeParameters(hit['extract_referer']['extract_parameters'])
|
||||
|
||||
hit['remote_ip'] = hit['remote_addr']
|
||||
|
||||
return True
|
||||
|
||||
def _decodeTime(self, hit):
|
||||
|
|
|
@ -71,15 +71,14 @@ class IWLADisplayAllVisits(IPlugin):
|
|||
table.setColsCSSClass(['', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', ''])
|
||||
|
||||
for super_hit in last_access:
|
||||
address = super_hit['remote_addr']
|
||||
row = [
|
||||
address,
|
||||
super_hit['remote_addr'],
|
||||
super_hit['viewed_pages'][0],
|
||||
super_hit['viewed_hits'][0],
|
||||
super_hit['bandwidth'][0],
|
||||
time.asctime(super_hit['last_access'])
|
||||
]
|
||||
table.appendRow(row, address)
|
||||
table.appendRow(row, super_hit['remote_ip'])
|
||||
page.appendBlock(table)
|
||||
|
||||
display.addPage(page)
|
||||
|
|
|
@ -71,9 +71,9 @@ class IWLADisplayAllVisitsEnlight(IPlugin):
|
|||
return
|
||||
|
||||
for (idx, row) in enumerate(block.rows):
|
||||
remote_addr = block.objects[idx]
|
||||
if remote_addr is None or not remote_addr in visitors.keys(): continue
|
||||
visitor = visitors[remote_addr]
|
||||
remote_ip = block.objects[idx]
|
||||
if remote_ip is None or not remote_ip in visitors.keys(): continue
|
||||
visitor = visitors[remote_ip]
|
||||
if visitor.get('enlight', False) or\
|
||||
visitor.get('filtered', False):
|
||||
block.setCellCSSClass(idx, 0, 'iwla_enlight')
|
||||
|
|
|
@ -105,7 +105,7 @@ class IWLADisplayFilterUsers(IPlugin):
|
|||
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'], referer], filtered_user['remote_addr'])
|
||||
table.appendRow([generateHTMLLink(uri), time.asctime(r['time_decoded']), r['http_user_agent'], referer], filtered_user['remote_ip'])
|
||||
page.appendBlock(table)
|
||||
|
||||
display.addPage(page)
|
||||
|
@ -121,8 +121,7 @@ class IWLADisplayFilterUsers(IPlugin):
|
|||
table = display.createBlock(DisplayHTMLBlockTable, title, [self.iwla._(u'Host'), self.iwla._(u'Pages'), self.iwla._(u'Hits'), self.iwla._(u'Last Access')])
|
||||
table.setColsCSSClass(['', '', 'iwla_page', 'iwla_hit'])
|
||||
for filtered_user in self.filtered_users[:10]:
|
||||
ip_title = filtered_user['remote_ip']
|
||||
table.appendRow([ip_title, filtered_user['viewed_pages'][0], filtered_user['viewed_hits'][0], time.asctime(hits[ip]['last_access'])], filtered_user['remote_addr'])
|
||||
table.appendRow([filtered_user['remote_addr'], filtered_user['viewed_pages'][0], filtered_user['viewed_hits'][0], time.asctime(filtered_user['last_access'])], filtered_user['remote_ip'])
|
||||
if len(self.filtered_users) > 10:
|
||||
table.appendRow([self.iwla._(u'Others'), len(self.filtered_users)-10, '', ''])
|
||||
table.setCellCSSClass(table.getNbRows()-1, 0, 'iwla_others')
|
||||
|
|
|
@ -64,10 +64,10 @@ class IWLADisplayIPToGeo(IPlugin):
|
|||
return True
|
||||
|
||||
@staticmethod # Needed to have unbound method
|
||||
def FlagFilter(host, remote_addr, self):
|
||||
if remote_addr is None or not remote_addr in self.visitors.keys():
|
||||
def FlagFilter(host, remote_ip, self):
|
||||
if remote_ip is None or not remote_ip in self.visitors.keys():
|
||||
return None
|
||||
visitor = self.visitors[remote_addr]
|
||||
visitor = self.visitors[remote_ip]
|
||||
cc = visitor.get('country_code', None)
|
||||
if not cc: return None
|
||||
icon = '<img alt="%s flag" src="/%s/flags/%s.png"/>' % (cc, self.icon_path, cc)
|
||||
|
|
|
@ -82,7 +82,7 @@ class IWLADisplayTopVisitors(IPlugin):
|
|||
total[1] -= super_hit['viewed_pages'][0]
|
||||
total[2] -= super_hit['viewed_hits'][0]
|
||||
total[3] -= super_hit['bandwidth'][0]
|
||||
table.appendRow(row, super_hit['remote_addr'])
|
||||
table.appendRow(row, super_hit['remote_ip'])
|
||||
if total[1] or total[2] or total[3]:
|
||||
total[0] = self.iwla._(u'Others')
|
||||
total[4] = ''
|
||||
|
|
|
@ -39,7 +39,7 @@ Output files :
|
|||
|
||||
Statistics creation :
|
||||
visits :
|
||||
remote_addr =>
|
||||
remote_ip =>
|
||||
browser
|
||||
|
||||
month_stats :
|
||||
|
@ -99,7 +99,7 @@ class IWLAPostAnalysisBrowsers(IPlugin):
|
|||
|
||||
for (k, super_hit) in stats.items():
|
||||
if not 'browser' in super_hit:
|
||||
for r in super_hit['requests'][::-1]:
|
||||
for r in super_hit['requests']:
|
||||
user_agent = r['http_user_agent']
|
||||
if not user_agent: continue
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ Output files :
|
|||
None
|
||||
|
||||
Statistics creation :
|
||||
remote_addr =>
|
||||
remote_ip =>
|
||||
feed_parser
|
||||
feed_name_analysed
|
||||
feed_parser_last_access (for merged parser)
|
||||
|
|
|
@ -66,13 +66,13 @@ Output files :
|
|||
|
||||
Statistics creation :
|
||||
visits :
|
||||
remote_addr =>
|
||||
remote_ip =>
|
||||
filtered
|
||||
geo_location
|
||||
|
||||
Statistics update :
|
||||
visits :
|
||||
remote_addr =>
|
||||
remote_ip =>
|
||||
keep_requests
|
||||
|
||||
Statistics deletion :
|
||||
|
@ -92,7 +92,7 @@ class IWLAPostAnalysisFilterUsers(IPlugin):
|
|||
raise Exception('Bad filter ' + ' '.join(_filter))
|
||||
except Exception as e:
|
||||
if field == 'ip':
|
||||
_filter[0] = 'remote_addr'
|
||||
_filter[0] = 'remote_ip'
|
||||
if operator not in ('=', '==', '!=', 'in', 'match'):
|
||||
raise Exception('Bad filter ' + ' '.join(_filter))
|
||||
if operator == 'match':
|
||||
|
|
|
@ -39,7 +39,7 @@ Output files :
|
|||
|
||||
Statistics creation :
|
||||
visits :
|
||||
remote_addr =>
|
||||
remote_ip =>
|
||||
ip_type
|
||||
|
||||
month_stats :
|
||||
|
|
|
@ -41,7 +41,7 @@ Output files :
|
|||
|
||||
Statistics creation :
|
||||
visits :
|
||||
remote_addr =>
|
||||
remote_ip =>
|
||||
operating_system
|
||||
|
||||
month_stats :
|
||||
|
|
Loading…
Reference in New Issue
Block a user