minor update

This commit is contained in:
Bernardo Damele 2013-02-03 11:29:57 +00:00
parent 9b4eaa9272
commit a92f1fb3b4

View File

@ -59,6 +59,11 @@ def send_email(msg):
except smtplib.SMTPException, e: except smtplib.SMTPException, e:
print "Failure to send email: %s" % str(e) print "Failure to send email: %s" % str(e)
def failure_email(msg):
msg = prepare_email()
send_email(msg)
sys.exit(1)
def main(): def main():
global SUBJECT 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 = subprocess.Popen("python /opt/sqlmap/sqlmap.py --update", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
proc.wait() 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 = subprocess.Popen("python /opt/sqlmap/sqlmap.py --live-test", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
proc.wait() proc.wait()
stdout, stderr = proc.communicate() stdout, stderr = proc.communicate()
if stderr: if stderr:
msg = prepare_email("Execution of regression test failed with error:\n\n%s" % stderr) failure_email("Execution of regression test failed with error:\n\n%s" % stderr)
send_email(msg)
sys.exit(1)
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) 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)