diff --git a/lib/core/testing.py b/lib/core/testing.py index f6ef2acab..ecaaec7f5 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -169,7 +169,6 @@ def liveTest(): test_case_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "test_case"), "wb", UNICODE_ENCODING) test_case_fd.write(name) - test_case_fd.close() if result: logger.info("test passed") @@ -187,6 +186,7 @@ def liveTest(): errMsg += " - SQL injection not detected" logger.error(errMsg) + test_case_fd.write("\n%s" % errMsg) if failedParseOn: console_output_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "console_output"), "wb", UNICODE_ENCODING) @@ -203,6 +203,7 @@ def liveTest(): if conf.stopFail is True: return retVal + test_case_fd.close() retVal &= bool(result) dataToStdout("\n")