mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-23 15:54:24 +03:00
code refactoring
This commit is contained in:
parent
04714374f9
commit
0fc7a8f9e8
|
@ -20,6 +20,7 @@ from lib.core.common import getUnicode
|
|||
from lib.core.common import randomInt
|
||||
from lib.core.common import randomStr
|
||||
from lib.core.common import readInput
|
||||
from lib.core.common import removeDynamicContent
|
||||
from lib.core.common import showStaticWords
|
||||
from lib.core.common import trimAlphaNum
|
||||
from lib.core.common import wasLastRequestDBMSError
|
||||
|
@ -523,16 +524,7 @@ 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)
|
||||
|
||||
if kb.pageTemplate:
|
||||
for item in kb.dynamicMarkings:
|
||||
prefix, suffix = item
|
||||
|
||||
if prefix is None:
|
||||
kb.pageTemplate = re.sub('(?s)^.+%s' % suffix, suffix, kb.pageTemplate)
|
||||
elif suffix is None:
|
||||
kb.pageTemplate = re.sub('(?s)%s.+$' % prefix, prefix, kb.pageTemplate)
|
||||
else:
|
||||
kb.pageTemplate = re.sub('(?s)%s.+%s' % (prefix, suffix), '%s%s' % (prefix, suffix), kb.pageTemplate)
|
||||
kb.pageTemplate = removeDynamicContent(kb.pageTemplate)
|
||||
|
||||
def checkStability():
|
||||
"""
|
||||
|
|
|
@ -1637,3 +1637,15 @@ def aliasToDbmsEnum(value):
|
|||
break
|
||||
return retVal
|
||||
|
||||
def removeDynamicContent(page):
|
||||
if page:
|
||||
for item in kb.dynamicMarkings:
|
||||
prefix, suffix = item
|
||||
if prefix is None:
|
||||
page = re.sub('(?s)^.+%s' % suffix, suffix, page)
|
||||
elif suffix is None:
|
||||
page = re.sub('(?s)%s.+$' % prefix, prefix, page)
|
||||
else:
|
||||
page = re.sub('(?s)%s.+%s' % (prefix, suffix), '%s%s' % (prefix, suffix), page)
|
||||
|
||||
return page
|
||||
|
|
|
@ -11,6 +11,7 @@ import re
|
|||
|
||||
from difflib import SequenceMatcher
|
||||
|
||||
from lib.core.common import removeDynamicContent
|
||||
from lib.core.common import wasLastRequestDBMSError
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
|
@ -60,15 +61,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:
|
||||
for item in kb.dynamicMarkings:
|
||||
prefix, suffix = item
|
||||
|
||||
if prefix is None:
|
||||
page = re.sub('(?s)^.+%s' % suffix, suffix, page)
|
||||
elif suffix is None:
|
||||
page = re.sub('(?s)%s.+$' % prefix, prefix, page)
|
||||
else:
|
||||
page = re.sub('(?s)%s.+%s' % (prefix, suffix), '%s%s' % (prefix, suffix), page)
|
||||
page = removeDynamicContent(page)
|
||||
|
||||
if not pageLength:
|
||||
pageLength = len(page)
|
||||
|
|
Loading…
Reference in New Issue
Block a user