important update regarding restoring of potentially changed switch values in multi-target mode and/or missing switch values in resume mode

This commit is contained in:
Miroslav Stampar
2011-01-02 10:37:32 +00:00
parent 96341f8f78
commit dce9a762f1
4 changed files with 57 additions and 2 deletions

View File

@@ -40,6 +40,19 @@ def unSafeFormatString(value):
retVal = retVal.replace("__LEFT_SQUARE_BRACKET__", "[").replace("__RIGHT_SQUARE_BRACKET__", "]")
return retVal
def setTextOnly():
"""
Save text only option to session file.
"""
condition = (
not kb.resumedQueries or ( kb.resumedQueries.has_key(conf.url) and
not kb.resumedQueries[conf.url].has_key("Text only") )
)
if condition:
dataToSessionFile("[%s][None][None][Text only][True]\n" % conf.url)
def setString():
"""
Save string to match in session file.
@@ -263,7 +276,23 @@ def setRemoteTempPath():
dataToSessionFile("[%s][%s][%s][Remote temp path][%s]\n" % (conf.url, kb.injection.place, safeFormatString(conf.parameters[kb.injection.place]), safeFormatString(conf.tmpPath)))
def resumeConfKb(expression, url, value):
if expression == "String" and url == conf.url:
if expression == "Text only" and url == conf.url:
value = unSafeFormatString(value[:-1])
logMsg = "resuming text only option '%s' from session file" % value
logger.info(logMsg)
if value and not conf.textOnly:
message = "you did not turned on --text-only switch this time "
message += "which could potentially lead to different "
message += "and/or unstable results. "
message += "Do you want to turn it on? [Y/n] "
test = readInput(message, default="Y")
if not test or test[0] in ("y", "Y"):
conf.textOnly = value
elif expression == "String" and url == conf.url:
string = unSafeFormatString(value[:-1])
logMsg = "resuming string match '%s' from session file" % string