mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 17:46:37 +03:00
usage of compiled regexes in case of dynamic markings and other refactoring
This commit is contained in:
parent
0fc7a8f9e8
commit
eeb199375b
|
@ -524,8 +524,6 @@ def checkDynamicContent(firstPage, secondPage):
|
|||
infoMsg = "dynamic content marked for removal (%d region%s)" % (len(kb.dynamicMarkings), 's' if len(kb.dynamicMarkings) > 1 else '')
|
||||
logger.info(infoMsg)
|
||||
|
||||
kb.pageTemplate = removeDynamicContent(kb.pageTemplate)
|
||||
|
||||
def checkStability():
|
||||
"""
|
||||
This function checks if the URL content is stable requesting the
|
||||
|
|
|
@ -1642,10 +1642,10 @@ def removeDynamicContent(page):
|
|||
for item in kb.dynamicMarkings:
|
||||
prefix, suffix = item
|
||||
if prefix is None:
|
||||
page = re.sub('(?s)^.+%s' % suffix, suffix, page)
|
||||
getCompiledRegex('(?s)^.+%s' % suffix).sub(suffix, page)
|
||||
elif suffix is None:
|
||||
page = re.sub('(?s)%s.+$' % prefix, prefix, page)
|
||||
getCompiledRegex('(?s)%s.+$' % prefix).sub(prefix, page)
|
||||
else:
|
||||
page = re.sub('(?s)%s.+%s' % (prefix, suffix), '%s%s' % (prefix, suffix), page)
|
||||
getCompiledRegex('(?s)%s.+%s' % (prefix, suffix)).sub('%s%s' % (prefix, suffix), page)
|
||||
|
||||
return page
|
||||
|
|
|
@ -62,6 +62,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
|
|||
# Dynamic content lines to be excluded before comparison
|
||||
if not kb.nullConnection and not conf.longestCommon:
|
||||
page = removeDynamicContent(page)
|
||||
conf.seqMatcher.set_seq1(removeDynamicContent(kb.pageTemplate))
|
||||
|
||||
if not pageLength:
|
||||
pageLength = len(page)
|
||||
|
|
Loading…
Reference in New Issue
Block a user