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

Skip to content

Commit a92f1fb

Browse files
committed
minor update
1 parent 9b4eaa9 commit a92f1fb

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

extra/shutils/regressiontest.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def send_email(msg):
5959
except smtplib.SMTPException, e:
6060
print "Failure to send email: %s" % str(e)
6161

62+
def failure_email(msg):
63+
msg = prepare_email()
64+
send_email(msg)
65+
sys.exit(1)
66+
6267
def main():
6368
global SUBJECT
6469

@@ -68,15 +73,17 @@ def main():
6873

6974
proc = subprocess.Popen("python /opt/sqlmap/sqlmap.py --update", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
7075
proc.wait()
76+
stdout, stderr = proc.communicate()
77+
78+
if stderr:
79+
failure_email("Update of sqlmap failed with error:\n\n%s" % stderr)
7180

7281
proc = subprocess.Popen("python /opt/sqlmap/sqlmap.py --live-test", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
7382
proc.wait()
7483
stdout, stderr = proc.communicate()
7584

7685
if stderr:
77-
msg = prepare_email("Execution of regression test failed with error:\n\n%s" % stderr)
78-
send_email(msg)
79-
sys.exit(1)
86+
failure_email("Execution of regression test failed with error:\n\n%s" % stderr)
8087

8188
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)
8289

0 commit comments

Comments
 (0)