[scripts] Proper file handling in the SSL reporter
@@ -7,15 +7,17 @@ import traceback
with open(str(sys.argv[1]), 'r') as data_file:
data = json.load(data_file)
-orgName = str(sys.argv[1]).split('.json', 1)[0]
+
+org_name = str(sys.argv[1]).split('.json', 1)[0]
+
if data[0]['status'] == 'ERROR':
print "sslscan finished with errors"
sys.exit(0)
+
print "RESULT IN SSL_TLS_TESTING_FUNCTIONALITY_FROM_SSLLABS_REPORT.html"
try:
-
- f = open(orgName+'_report.html', 'w')
+ with open(org_name+"_report.html", 'w') as f:
f.write('<html>')
f.write('<body>')
f.write('<div style="background-color: lightgrey;border:1px solid;border-radius:10px;width:300px;"')
@@ -53,7 +55,6 @@ try:
f.write('<h2> Secure renegotiation support: </h2>' + secureRenegotiationSuported)
f.write('</body>')
f.write('</html>')
- f.close()
except:
print('Something went wrong when parsing result')
print traceback.format_exc()
