now you can use kb.pageTemplate to set a page which will be used as a template in comparison process (at least in '-[RANDNUM] OR' cases we'll need to use different template(s))

This commit is contained in:
Miroslav Stampar 2010-12-04 10:05:18 +00:00
parent 95a3f4b52f
commit 04714374f9
3 changed files with 8 additions and 6 deletions

View File

@ -523,16 +523,16 @@ def checkDynamicContent(firstPage, secondPage):
infoMsg = "dynamic content marked for removal (%d region%s)" % (len(kb.dynamicMarkings), 's' if len(kb.dynamicMarkings) > 1 else '') infoMsg = "dynamic content marked for removal (%d region%s)" % (len(kb.dynamicMarkings), 's' if len(kb.dynamicMarkings) > 1 else '')
logger.info(infoMsg) logger.info(infoMsg)
if conf.seqMatcher.a: if kb.pageTemplate:
for item in kb.dynamicMarkings: for item in kb.dynamicMarkings:
prefix, suffix = item prefix, suffix = item
if prefix is None: if prefix is None:
conf.seqMatcher.a = re.sub('(?s)^.+%s' % suffix, suffix, conf.seqMatcher.a) kb.pageTemplate = re.sub('(?s)^.+%s' % suffix, suffix, kb.pageTemplate)
elif suffix is None: elif suffix is None:
conf.seqMatcher.a = re.sub('(?s)%s.+$' % prefix, prefix, conf.seqMatcher.a) kb.pageTemplate = re.sub('(?s)%s.+$' % prefix, prefix, kb.pageTemplate)
else: else:
conf.seqMatcher.a = re.sub('(?s)%s.+%s' % (prefix, suffix), '%s%s' % (prefix, suffix), conf.seqMatcher.a) kb.pageTemplate = re.sub('(?s)%s.+%s' % (prefix, suffix), '%s%s' % (prefix, suffix), kb.pageTemplate)
def checkStability(): def checkStability():
""" """
@ -548,7 +548,7 @@ def checkStability():
infoMsg = "testing if the url is stable, wait a few seconds" infoMsg = "testing if the url is stable, wait a few seconds"
logger.info(infoMsg) logger.info(infoMsg)
firstPage = conf.seqMatcher.a # set inside checkConnection() firstPage = kb.pageTemplate # set inside checkConnection()
time.sleep(1) time.sleep(1)
secondPage, _ = Request.queryPage(content=True) secondPage, _ = Request.queryPage(content=True)
@ -741,7 +741,7 @@ def checkConnection(suppressOutput=False):
start = time.time() start = time.time()
page, _ = Request.queryPage(content=True) page, _ = Request.queryPage(content=True)
kb.responseTime = time.time() - start kb.responseTime = time.time() - start
conf.seqMatcher.set_seq1(page) kb.pageTemplate = page
except sqlmapConnectionException, errMsg: except sqlmapConnectionException, errMsg:
errMsg = getUnicode(errMsg) errMsg = getUnicode(errMsg)
raise sqlmapConnectionException, errMsg raise sqlmapConnectionException, errMsg

View File

@ -1158,6 +1158,7 @@ def __setKnowledgeBaseAttributes():
kb.locks.seqLock = None kb.locks.seqLock = None
kb.nullConnection = None kb.nullConnection = None
kb.pageTemplate = None
# Back-end DBMS underlying operating system fingerprint via banner (-b) # Back-end DBMS underlying operating system fingerprint via banner (-b)
# parsing # parsing

View File

@ -23,6 +23,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
return None return None
regExpResults = None regExpResults = None
conf.seqMatcher.set_seq1(kb.pageTemplate)
if page: if page:
# String to be excluded before calculating page hash # String to be excluded before calculating page hash