Filter by domain name

This commit is contained in:
Grégory Soutadé 2014-12-17 21:06:48 +01:00
parent 14c1686d98
commit 50fb09104e
1 changed files with 6 additions and 3 deletions

View File

@ -124,6 +124,7 @@ class IWLA(object):
self.http_request_extracted = re.compile(r'(?P<http_method>\S+) (?P<http_uri>\S+) (?P<http_version>\S+)')
self.log_re = re.compile(self.log_format_extracted)
self.uri_re = re.compile(r'(?P<extract_uri>[^\?]+)(\?(?P<extract_parameters>.+))?')
self.domain_name_re = re.compile(r'.*%s' % conf.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)]
@ -582,6 +583,9 @@ class IWLA(object):
self.current_analysis['days_stats'][cur_time.tm_mday] = stats
def _newHit(self, hit):
if not self.domain_name_re.match(hit['server_name']):
return False
t = self._decodeTime(hit)
cur_time = self.meta_infos['last_time']
@ -609,7 +613,7 @@ class IWLA(object):
for k in hit.keys():
if hit[k] == '-' or hit[k] == '*':
hit[k] = ''
self._appendHit(hit)
return True
@ -637,8 +641,7 @@ class IWLA(object):
groups = self.log_re.match(l)
if groups:
if not self._newHit(groups.groupdict()):
continue
self._newHit(groups.groupdict())
else:
self.logger.warning("No match for %s" % (l))
#break