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