Add excluded domain option

This commit is contained in:
Gregory Soutade 2023-06-14 09:21:11 +02:00
parent 9c688e1545
commit 9d3ff8b3b7

10
iwla.py
View File

@ -52,6 +52,7 @@ Conf values needed :
locales_path
compress_output_files
excluded_ip
excluded_domain_name
Output files :
DB_ROOT/meta.db
@ -155,6 +156,9 @@ class IWLA(object):
self.excluded_ip = []
for ip in conf.excluded_ip:
self.excluded_ip += [re.compile(ip)]
self.excluded_domain_name = []
for domain_name in conf.excluded_domain_name:
self.excluded_domain_name += [re.compile(domain_name)]
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)]
@ -350,7 +354,6 @@ class IWLA(object):
super_hit['last_access'] = self.meta_infos['last_time']
request = hit['extract_request']
uri = request.get('extract_uri', request['http_uri'])
hit['is_page'] = self.isPage(uri)
@ -707,6 +710,11 @@ class IWLA(object):
self.logger.debug("Not in domain %s" % (hit))
return False
for domain_name in self.excluded_domain_name:
if domain_name.match(hit['server_name']):
self.logger.debug("Domain name %s excluded" % (hit['server_name']))
return False
t = self._decodeTime(hit)
cur_time = self.meta_infos['last_time']