mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 00:04:23 +03:00
more adjustments
This commit is contained in:
parent
a73aa422fc
commit
c61ee5e5ef
|
@ -28,9 +28,6 @@ SMTP_TIMEOUT = 30
|
|||
FROM = "regressiontest@sqlmap.org"
|
||||
TO = "dev@sqlmap.org"
|
||||
SUBJECT = "Regression test results on %s using revision %s" % (TIME, REVISION)
|
||||
CONTENT = ""
|
||||
TEST_COUNTS = []
|
||||
ATTACHMENTS = {}
|
||||
|
||||
def prepare_email(content):
|
||||
msg = MIMEMultipart()
|
||||
|
@ -53,6 +50,10 @@ def send_email(msg):
|
|||
print "Failure to send email: %s" % str(e)
|
||||
|
||||
def main():
|
||||
content = ""
|
||||
test_counts = []
|
||||
attachments = {}
|
||||
|
||||
command_line = "cd %s && python sqlmap.py --live-test" % SQLMAP_HOME
|
||||
proc = subprocess.Popen(command_line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
|
@ -74,13 +75,13 @@ def main():
|
|||
traceback = False if failed_test[5] == "False" else bool(failed_test[5])
|
||||
detected = False if failed_test[6] else True
|
||||
|
||||
TEST_COUNTS.append(test_count)
|
||||
test_counts.append(test_count)
|
||||
|
||||
console_output_fd = codecs.open(os.path.join(output_folder, "console_output"), "rb", "utf8")
|
||||
console_output = console_output_fd.read()
|
||||
console_output_fd.close()
|
||||
|
||||
ATTACHMENTS[test_count] = str(console_output)
|
||||
attachments[test_count] = str(console_output)
|
||||
|
||||
log_fd = codecs.open(os.path.join(output_folder, "debiandev", "log"), "rb", "utf8")
|
||||
log = log_fd.read()
|
||||
|
@ -91,28 +92,28 @@ def main():
|
|||
traceback = traceback_fd.read()
|
||||
traceback_fd.close()
|
||||
|
||||
CONTENT += "Failed test case '%s'" % title
|
||||
content += "Failed test case '%s'" % title
|
||||
|
||||
if parse:
|
||||
CONTENT += " at parsing: %s:\n\n" % parse
|
||||
CONTENT += "### Log file:\n\n"
|
||||
CONTENT += "%s\n" % log
|
||||
content += " at parsing: %s:\n\n" % parse
|
||||
content += "### Log file:\n\n"
|
||||
content += "%s\n" % log
|
||||
elif not detected:
|
||||
CONTENT += " - SQL injection not detected\n\n"
|
||||
content += " - SQL injection not detected\n\n"
|
||||
|
||||
if traceback:
|
||||
CONTENT += "### Traceback:\n\n"
|
||||
CONTENT += "%s\n" % str(traceback)
|
||||
content += "### Traceback:\n\n"
|
||||
content += "%s\n" % str(traceback)
|
||||
|
||||
CONTENT += "#######################################################################\n\n"
|
||||
content += "#######################################################################\n\n"
|
||||
|
||||
if CONTENT:
|
||||
SUBJECT += " (%s)" % ", ".join("#%d" % count for count in TEST_COUNTS)
|
||||
CONTENT += "\n\nRegression test finished at %s" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())
|
||||
if content:
|
||||
SUBJECT += " (%s)" % ", ".join("#%d" % count for count in test_counts)
|
||||
content += "\n\nRegression test finished at %s" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())
|
||||
|
||||
msg = prepare_email(CONTENT)
|
||||
msg = prepare_email(content)
|
||||
|
||||
for test_count, attachment in ATTACHMENTS.items():
|
||||
for test_count, attachment in attachments.items():
|
||||
attachment = MIMEText(attachment)
|
||||
attachment.add_header("Content-Disposition", "attachment", filename="test_case_%d_console_output.txt" % test_count)
|
||||
msg.attach(attachment)
|
||||
|
|
Loading…
Reference in New Issue
Block a user