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

Skip to content

Commit d43b04c

Browse files
committed
better detection if vulnerable of not for regression test
1 parent 3cfa6cd commit d43b04c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/core/testing.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def liveTest():
139139
parse = []
140140
switches = dict(global_)
141141
value = ""
142+
vulnerable = True
142143

143144
if case.hasAttribute("name"):
144145
name = case.getAttribute("name")
@@ -165,7 +166,10 @@ def liveTest():
165166
msg = "running live test case: %s (%d/%d)" % (name, count, length)
166167
logger.info(msg)
167168

168-
result = runCase(switches, parse)
169+
try:
170+
runCase(switches, parse)
171+
except SqlmapNotVulnerableException:
172+
vulnerable = False
169173

170174
test_case_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "test_case"), "wb", UNICODE_ENCODING)
171175
test_case_fd.write("%s\n" % name)
@@ -182,7 +186,7 @@ def liveTest():
182186
errMsg += "- scan folder: %s " % paths.SQLMAP_OUTPUT_PATH
183187
errMsg += "- traceback: %s" % bool(failedTraceBack)
184188

185-
if result is False:
189+
if not vulnerable:
186190
errMsg += " - SQL injection not detected"
187191

188192
logger.error(errMsg)

0 commit comments

Comments
 (0)