iwla

iwla Commit Details

Date:2016-01-16 08:43:29 (5 years 6 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:5c750e8b0c406f4d7cd3c1aac2282ea4deffe9b3
Parents: ec0a3a52a80196edd80a46a3c3afa1e2ae3df23e
Message:Remove final slashes for referers

Changes:
Miwla.py (3 diffs)

File differences

iwla.py
148148
149149
150150
151
151
152152
153153
154154
......
337337
338338
339339
340
340
341341
342342
343
344
345
346
343347
344348
345349
......
368372
369373
370374
371
375
372376
373377
374378
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.normalize_uri_final_slashes = re.compile(r'/+$')
self.final_slashes_re = re.compile(r'/+$')
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)]
def _normalizeURI(self, uri):
if uri == '/': return uri
uri = self.normalize_uri_final_slashes.sub('/', uri)
uri = self.final_slashes_re.sub('/', uri)
return uri
def _removeFinalSlashes(self, uri):
if uri == '/': return uri
return self.final_slashes_re.sub('', uri)
def _normalizeParameters(self, parameters):
# No parameters
if parameters == '?': return None
referer_groups = self.uri_re.match(hit['http_referer'])
if referer_groups:
hit['extract_referer'] = referer_groups.groupdict()
hit['extract_referer']['extract_uri'] = self._normalizeURI(hit['extract_referer']['extract_uri'])
hit['extract_referer']['extract_uri'] = self._removeFinalSlashes(hit['extract_referer']['extract_uri'])
hit['extract_referer']['extract_parameters'] = self._normalizeParameters(hit['extract_referer']['extract_parameters'])
return True

Archive Download the corresponding diff file

Branches

Tags