Add IP exclusion feature

This commit is contained in:
Gregory Soutade 2020-04-09 09:33:59 +02:00
parent bb268114b2
commit 55983df1bc

View File

@ -150,6 +150,9 @@ class IWLA(object):
self.uri_re = re.compile(r'(?P<extract_uri>[^\?#]+)(\?(?P<extract_parameters>[^#]+))?(#.*)?')
self.domain_name_re = re.compile(r'.*%s' % conf.domain_name)
self.final_slashes_re = re.compile(r'/+$')
self.excluded_ip = []
for ip in conf.excluded_ip:
self.excluded_ip += [re.compile(ip)]
self.plugins = [(conf.PRE_HOOK_DIRECTORY , conf.pre_analysis_hooks),
(conf.POST_HOOK_DIRECTORY , conf.post_analysis_hooks),
(conf.DISPLAY_HOOK_DIRECTORY , conf.display_hooks)]
@ -316,6 +319,10 @@ class IWLA(object):
if not remote_addr: return
for ip in self.excluded_ip:
if ip.match(remote_addr):
return
if not remote_addr in self.current_analysis['visits'].keys():
self._createVisitor(hit)