Add Geo IP location in filter users
This commit is contained in:
parent
c84373b2d7
commit
7ec7e0d644
|
@ -23,6 +23,7 @@ import re
|
||||||
from iwla import IWLA
|
from iwla import IWLA
|
||||||
from iplugin import IPlugin
|
from iplugin import IPlugin
|
||||||
from display import *
|
from display import *
|
||||||
|
from misc.geoiplookup import geoiplookup
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Post analysis hook
|
Post analysis hook
|
||||||
|
@ -67,6 +68,7 @@ Statistics creation :
|
||||||
visits :
|
visits :
|
||||||
remote_addr =>
|
remote_addr =>
|
||||||
filtered
|
filtered
|
||||||
|
geo_location
|
||||||
|
|
||||||
Statistics update :
|
Statistics update :
|
||||||
visits :
|
visits :
|
||||||
|
@ -167,10 +169,19 @@ class IWLAPostAnalysisFilterUsers(IPlugin):
|
||||||
|
|
||||||
hits = self.iwla.getValidVisitors()
|
hits = self.iwla.getValidVisitors()
|
||||||
|
|
||||||
if len(self.filters) or len(self.ip_filters):
|
for (key,value) in hits.items():
|
||||||
for (key,value) in hits.items():
|
# Already filtered
|
||||||
if self._do_filter(key, hits):
|
if value.get('filtered', False):
|
||||||
print('Keep for {}'.format(key))
|
continue
|
||||||
value['filtered'] = True
|
|
||||||
value['keep_requests'] = True
|
if self._do_filter(key, hits):
|
||||||
|
value['filtered'] = True
|
||||||
|
value['keep_requests'] = True
|
||||||
|
try:
|
||||||
|
if not value.get('geo_location', None):
|
||||||
|
value['geo_location'] = geoiplookup(value['remote_ip'])
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user