Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7127869

Browse files
committed
Minor bug fix (live test specific verbosity should be valid only inside of it)
1 parent 68ce51b commit 7127869

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/core/testing.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from lib.core.log import LOGGER_HANDLER
3131
from lib.core.option import init
3232
from lib.core.option import initOptions
33+
from lib.core.option import setVerbosity
3334
from lib.core.optiondict import optDict
3435
from lib.core.settings import UNICODE_ENCODING
3536
from lib.parse.cmdline import cmdLineParser
@@ -166,6 +167,9 @@ def liveTest():
166167

167168
parse.append((value, parse_from_console_output))
168169

170+
conf.verbose = global_.get("verbose", 1)
171+
setVerbosity()
172+
169173
msg = "running live test case: %s (%d/%d)" % (name, count, length)
170174
logger.info(msg)
171175

@@ -178,6 +182,9 @@ def liveTest():
178182
result = runCase(parse)
179183
except SqlmapNotVulnerableException:
180184
vulnerable = False
185+
finally:
186+
conf.verbose = global_.get("verbose", 1)
187+
setVerbosity()
181188

182189
if result is True:
183190
logger.info("test passed")
@@ -239,6 +246,8 @@ def initCase(switches, count):
239246

240247
logger.debug("using output directory '%s' for this test case" % paths.SQLMAP_OUTPUT_PATH)
241248

249+
LOGGER_HANDLER.stream = sys.stdout = tempfile.SpooledTemporaryFile(max_size=0, mode="w+b", prefix="sqlmapstdout-")
250+
242251
cmdLineOptions = cmdLineParser()
243252

244253
if switches:
@@ -257,7 +266,6 @@ def runCase(parse):
257266
global failedParseOn
258267
global failedTraceBack
259268

260-
LOGGER_HANDLER.stream = sys.stdout = tempfile.SpooledTemporaryFile(max_size=0, mode="w+b", prefix="sqlmapstdout-")
261269
retVal = True
262270
handled_exception = None
263271
unhandled_exception = None

0 commit comments

Comments
 (0)