better detection if vulnerable of not for regression test

This commit is contained in:
Bernardo Damele 2013-01-21 17:09:35 +00:00
parent 3cfa6cd191
commit d43b04c582

View File

@ -139,6 +139,7 @@ def liveTest():
parse = [] parse = []
switches = dict(global_) switches = dict(global_)
value = "" value = ""
vulnerable = True
if case.hasAttribute("name"): if case.hasAttribute("name"):
name = case.getAttribute("name") name = case.getAttribute("name")
@ -165,7 +166,10 @@ def liveTest():
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)
result = runCase(switches, parse) try:
runCase(switches, parse)
except SqlmapNotVulnerableException:
vulnerable = False
test_case_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "test_case"), "wb", UNICODE_ENCODING) test_case_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "test_case"), "wb", UNICODE_ENCODING)
test_case_fd.write("%s\n" % name) test_case_fd.write("%s\n" % name)
@ -182,7 +186,7 @@ def liveTest():
errMsg += "- scan folder: %s " % paths.SQLMAP_OUTPUT_PATH errMsg += "- scan folder: %s " % paths.SQLMAP_OUTPUT_PATH
errMsg += "- traceback: %s" % bool(failedTraceBack) errMsg += "- traceback: %s" % bool(failedTraceBack)
if result is False: if not vulnerable:
errMsg += " - SQL injection not detected" errMsg += " - SQL injection not detected"
logger.error(errMsg) logger.error(errMsg)