bug fix (dynamic markings were not restored in program rerun which potentially led to no data retrieved)

This commit is contained in:
Miroslav Stampar 2010-12-29 19:48:19 +00:00
parent 8f32c740ff
commit 613242e298
2 changed files with 24 additions and 0 deletions

View File

@ -44,6 +44,7 @@ from lib.core.exception import sqlmapGenericException
from lib.core.exception import sqlmapNoneDataException
from lib.core.exception import sqlmapSiteTooDynamic
from lib.core.exception import sqlmapUserQuitException
from lib.core.session import setDynamicMarkings
from lib.core.session import setString
from lib.core.session import setRegexp
from lib.core.settings import UPPER_RATIO_BOUND
@ -531,6 +532,8 @@ def checkDynamicContent(firstPage, secondPage):
secondPage, _ = Request.queryPage(content=True)
findDynamicContent(firstPage, secondPage)
setDynamicMarkings(kb.dynamicMarkings)
def checkStability():
"""
This function checks if the URL content is stable requesting the

View File

@ -82,6 +82,22 @@ def setInjection(inj):
if condition:
dataToSessionFile("[%s][%s][%s][Injection data][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), base64pickle(inj)))
def setDynamicMarkings(markings):
"""
Save information retrieved about dynamic markings to the
session file.
"""
condition = (
( not kb.resumedQueries
or ( kb.resumedQueries.has_key(conf.url) and
not kb.resumedQueries[conf.url].has_key("Dynamic markings")
) )
)
if condition:
dataToSessionFile("[%s][%s][%s][Dynamic markings][%s]\n" % (conf.url, None, None, base64pickle(markings)))
def setDbms(dbms):
"""
@param dbms: database management system to be set into the knowledge
@ -303,6 +319,11 @@ def resumeConfKb(expression, url, value):
warnMsg += "but you did not provided it this time"
logger.warn(warnMsg)
elif expression == "Dynamic markings" and url == conf.url:
kb.dynamicMarkings = base64unpickle(value[:-1])
logMsg = "resuming dynamic markings from session file"
logger.info(logMsg)
elif expression == "DBMS" and url == conf.url:
dbms = unSafeFormatString(value[:-1])
dbms = dbms.lower()