From 55983df1bc4424b3ec120f4c9669296d00334637 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Thu, 9 Apr 2020 09:33:59 +0200 Subject: [PATCH] Add IP exclusion feature --- iwla.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/iwla.py b/iwla.py index a6983ed..7fe2f46 100755 --- a/iwla.py +++ b/iwla.py @@ -150,6 +150,9 @@ class IWLA(object): self.uri_re = re.compile(r'(?P[^\?#]+)(\?(?P[^#]+))?(#.*)?') 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)