This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
ssltest.py
executable file
·86 lines (75 loc) · 2.39 KB
/
ssltest.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python3.7
# BEGIN LICENSE #
#
# CERT Tapioca
#
# Copyright 2018 Carnegie Mellon University. All Rights Reserved.
#
# NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE
# ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS.
# CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER
# EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED
# TO, WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY,
# OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON
# UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO
# FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
#
# Released under a BSD (SEI)-style license, please see license.txt or
# contact [email protected] for full terms.
#
# [DISTRIBUTION STATEMENT A] This material has been approved for
# public release and unlimited distribution. Please see Copyright
# notice for non-US Government use and distribution.
# CERT(R) is registered in the U.S. Patent and Trademark Office by
# Carnegie Mellon University.
#
# DM18-0637
#
# END LICENSE #
import subprocess
import re
import sys
import os
try:
import wx
import dialogs
except ImportError:
import qtdialogs as dialogs
def main():
try:
# Initialize wx App
app = wx.App()
app.MainLoop()
except NameError:
# We're using Qt5 dialogs
pass
if os.path.isfile('.lastapp'):
with open('.lastapp', 'r') as lastfile:
lastapp = lastfile.read()
else:
lastapp = ''
# Call Dialog
appname = dialogs.Ask(
message='What application is being tested?', default_value=lastapp)
testapp(appname, standalone=True)
def testapp(appname, rewrite=False, standalone=False):
outdir = './logs'
overwrite = False
if rewrite:
rewrite = '1'
else:
rewrite = ''
appname = re.sub(r'\W+', '', appname).lower()
with open('.lastapp', 'w+') as lastfile:
lastfile.write(appname)
if appname != '':
outdir = './results/%s' % appname
flowsfile = '%s/ssltest.log' % outdir
if os.path.isfile(flowsfile) and standalone:
overwrite = dialogs.YesNo(
question='Output file %s already exists. Continue?' % flowsfile)
if not overwrite:
sys.exit()
subprocess.call(['./ssltest.sh', outdir, rewrite])
if __name__ == "__main__":
main()