From a92f1fb3b4872f78325412ca6dc380776f700271 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Sun, 3 Feb 2013 11:29:57 +0000 Subject: [PATCH] minor update --- extra/shutils/regressiontest.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/extra/shutils/regressiontest.py b/extra/shutils/regressiontest.py index 2447d4468..797b376ef 100644 --- a/extra/shutils/regressiontest.py +++ b/extra/shutils/regressiontest.py @@ -59,6 +59,11 @@ def send_email(msg): except smtplib.SMTPException, e: print "Failure to send email: %s" % str(e) +def failure_email(msg): + msg = prepare_email() + send_email(msg) + sys.exit(1) + def main(): global SUBJECT @@ -68,15 +73,17 @@ def main(): proc = subprocess.Popen("python /opt/sqlmap/sqlmap.py --update", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc.wait() + stdout, stderr = proc.communicate() + + if stderr: + failure_email("Update of sqlmap failed with error:\n\n%s" % stderr) proc = subprocess.Popen("python /opt/sqlmap/sqlmap.py --live-test", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc.wait() stdout, stderr = proc.communicate() if stderr: - msg = prepare_email("Execution of regression test failed with error:\n\n%s" % stderr) - send_email(msg) - sys.exit(1) + failure_email("Execution of regression test failed with error:\n\n%s" % stderr) failed_tests = re.findall("running live test case: (.+?) \((\d+)\/\d+\)[\r]*\n.+test failed (at parsing item \"(.+)\" )?\- scan folder: (\/.+) \- traceback: (.*?)( - SQL injection not detected)?[\r]*\n", stdout, re.M)