Minor bug fix (live test specific verbosity should be valid only inside of it)

This commit is contained in:
stamparm 2013-02-22 17:26:48 +01:00
parent 68ce51bfd4
commit 7127869ede

View File

@ -30,6 +30,7 @@ from lib.core.exception import SqlmapNotVulnerableException
from lib.core.log import LOGGER_HANDLER from lib.core.log import LOGGER_HANDLER
from lib.core.option import init from lib.core.option import init
from lib.core.option import initOptions from lib.core.option import initOptions
from lib.core.option import setVerbosity
from lib.core.optiondict import optDict from lib.core.optiondict import optDict
from lib.core.settings import UNICODE_ENCODING from lib.core.settings import UNICODE_ENCODING
from lib.parse.cmdline import cmdLineParser from lib.parse.cmdline import cmdLineParser
@ -166,6 +167,9 @@ def liveTest():
parse.append((value, parse_from_console_output)) parse.append((value, parse_from_console_output))
conf.verbose = global_.get("verbose", 1)
setVerbosity()
msg = "running live test case: %s (%d/%d)" % (name, count, length) msg = "running live test case: %s (%d/%d)" % (name, count, length)
logger.info(msg) logger.info(msg)
@ -178,6 +182,9 @@ def liveTest():
result = runCase(parse) result = runCase(parse)
except SqlmapNotVulnerableException: except SqlmapNotVulnerableException:
vulnerable = False vulnerable = False
finally:
conf.verbose = global_.get("verbose", 1)
setVerbosity()
if result is True: if result is True:
logger.info("test passed") logger.info("test passed")
@ -239,6 +246,8 @@ def initCase(switches, count):
logger.debug("using output directory '%s' for this test case" % paths.SQLMAP_OUTPUT_PATH) logger.debug("using output directory '%s' for this test case" % paths.SQLMAP_OUTPUT_PATH)
LOGGER_HANDLER.stream = sys.stdout = tempfile.SpooledTemporaryFile(max_size=0, mode="w+b", prefix="sqlmapstdout-")
cmdLineOptions = cmdLineParser() cmdLineOptions = cmdLineParser()
if switches: if switches:
@ -257,7 +266,6 @@ def runCase(parse):
global failedParseOn global failedParseOn
global failedTraceBack global failedTraceBack
LOGGER_HANDLER.stream = sys.stdout = tempfile.SpooledTemporaryFile(max_size=0, mode="w+b", prefix="sqlmapstdout-")
retVal = True retVal = True
handled_exception = None handled_exception = None
unhandled_exception = None unhandled_exception = None