Core: Add multimedia_re filter
This commit is contained in:
parent
c9500e2e99
commit
a03b1dfc4f
|
@ -44,6 +44,7 @@ count_hit_only_visitors = False
|
|||
# Multimedia extensions (not accounted as downloaded files)
|
||||
multimedia_files = ['png', 'jpg', 'jpeg', 'gif', 'ico', 'svg',
|
||||
'css', 'js']
|
||||
multimedia_files_re = []
|
||||
|
||||
# Default resources path (will be symlinked in DISPLAY_OUTPUT)
|
||||
resources_path = ['resources']
|
||||
|
|
14
iwla.py
14
iwla.py
|
@ -159,6 +159,9 @@ class IWLA(object):
|
|||
self.excluded_domain_name = []
|
||||
for domain_name in conf.excluded_domain_name:
|
||||
self.excluded_domain_name += [re.compile(domain_name)]
|
||||
self.multimedia_files_re = []
|
||||
for file_re in conf.multimedia_files_re:
|
||||
self.multimedia_files_re += [re.compile(file_re)]
|
||||
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)]
|
||||
|
@ -311,13 +314,18 @@ class IWLA(object):
|
|||
self.logger.debug("False")
|
||||
return False
|
||||
|
||||
def isMultimediaFile(self, request):
|
||||
self.logger.debug("Is multimedia %s" % (request))
|
||||
def isMultimediaFile(self, uri):
|
||||
self.logger.debug("Is multimedia %s" % (uri))
|
||||
for e in conf.multimedia_files:
|
||||
if request.lower().endswith(e):
|
||||
if uri.lower().endswith(e):
|
||||
self.logger.debug("True")
|
||||
return True
|
||||
self.logger.debug("False")
|
||||
|
||||
for file_re in self.multimedia_files_re:
|
||||
if file_re.match(uri):
|
||||
self.logger.debug("Is multimedia re True")
|
||||
return True
|
||||
return False
|
||||
|
||||
def isValidVisitor(self, hit):
|
||||
|
|
Loading…
Reference in New Issue
Block a user