forked from mushorg/glastopf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
57 lines (50 loc) · 2.21 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright (C) 2012 Lukas Rist
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import unittest
import sys
import os
from testing import test_honeypot
from testing import test_emulators
from testing import test_sqli
from testing import test_dork_list
from testing import test_classifiers
from testing import HTMLTestRunner
if sys.version_info[1] == 6:
test_list = unittest.TestSuite()
else:
test_list = unittest.suite.TestSuite()
test_list.addTests(unittest.TestLoader().loadTestsFromModule(test_honeypot))
test_list.addTests(unittest.TestLoader().loadTestsFromModule(test_emulators))
test_list.addTests(unittest.TestLoader().loadTestsFromModule(test_sqli))
test_list.addTests(unittest.TestLoader().loadTestsFromModule(test_dork_list))
test_list.addTests(unittest.TestLoader().loadTestsFromModule(test_classifiers))
if __name__ == '__main__':
report_name = "report.html"
reports_dir = "testing/reports"
if not os.path.isdir(reports_dir):
os.mkdir(reports_dir)
outfile = open("testing/reports/" + report_name, "w")
html_test = HTMLTestRunner
runner = html_test.HTMLTestRunner(
stream=outfile,
verbosity=3,
title="""Glastopf v3: Web Application Honeypot - Automated Test Report""",
description="""Test results of the implementation and unit tests."""
)
html_test.stdout_redirector.write("""Web Application Honeypot Integration and Unit Testing.\n\n""")
runner.run(test_list)
print "Report will be available at testing/reports/" + report_name