diff --git a/lib/core/testing.py b/lib/core/testing.py
index 2b209868d..32659785a 100644
--- a/lib/core/testing.py
+++ b/lib/core/testing.py
@@ -26,6 +26,8 @@ from lib.core.option import setVerbosity
from lib.core.optiondict import optDict
from lib.parse.cmdline import cmdLineParser
+failedItem = None
+
def smokeTest():
"""
This will run the basic smoke testing of a program
@@ -95,6 +97,8 @@ def liveTest():
"""
This will run the test of a program against the live testing environment
"""
+ global failedItem
+
retVal = True
count = 0
global_ = {}
@@ -147,8 +151,10 @@ def liveTest():
if result:
logger.info("test passed")
else:
- logger.error("test failed")
+ logger.error("test failed at parsing item '%s'" % failedItem)
beep()
+ if conf.stopFail is True:
+ return retVal
retVal &= result
@@ -162,6 +168,9 @@ def liveTest():
return retVal
def initCase(switches=None):
+ global failedItem
+ failedItem = None
+
paths.SQLMAP_OUTPUT_PATH = tempfile.mkdtemp(prefix="sqlmaptest-")
paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump")
paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files")
@@ -187,8 +196,9 @@ def cleanCase():
def runCase(switches=None, parse=None):
retVal = True
- initCase(switches)
+ global failedItem
+ initCase(switches)
result = start()
if result == False: # if None, ignore
@@ -203,9 +213,11 @@ def runCase(switches=None, parse=None):
if item.startswith("r'") and item.endswith("'"):
if not re.search(item[2:-1], content, re.DOTALL):
retVal = False
+ failedItem = item
break
elif content.find(item) < 0:
retVal = False
+ failedItem = item
break
cleanCase()
diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py
index e717d7152..b3a01a8d5 100644
--- a/lib/parse/cmdline.py
+++ b/lib/parse/cmdline.py
@@ -679,6 +679,9 @@ def cmdLineParser():
parser.add_option("--live-test", dest="liveTest", action="store_true",
help=SUPPRESS_HELP)
+ parser.add_option("--stop-fail", dest="stopFail", action="store_true",
+ help=SUPPRESS_HELP)
+
parser.add_option("--run-case", dest="runCase", help=SUPPRESS_HELP)
parser.add_option("--restapi", dest="restApi", action="store_true",
diff --git a/xml/livetests.xml b/xml/livetests.xml
index 86e7d9a53..ec1928bfe 100644
--- a/xml/livetests.xml
+++ b/xml/livetests.xml
@@ -49,14 +49,14 @@
-
-
+
+
-
+
@@ -75,14 +75,14 @@
-
-
+
+
-
+
@@ -101,14 +101,14 @@
-
-
+
+
-
+
@@ -128,7 +128,7 @@
-
+
@@ -154,7 +154,7 @@
-
+
@@ -180,7 +180,7 @@
-
+
@@ -206,7 +206,7 @@
-
+
@@ -233,7 +233,7 @@
-
+
@@ -259,7 +259,7 @@
-
+
@@ -285,7 +285,7 @@
-
+
@@ -311,7 +311,7 @@
-
+
@@ -338,14 +338,14 @@
-
+
-
+
@@ -364,14 +364,14 @@
-
+
-
+
@@ -390,14 +390,14 @@
-
+
-
+
@@ -416,14 +416,14 @@
-
+
-
+