Merge pull request #7 from jpmens/json_fix

Fix JSON (-j) and (-j -p) output to produce
This commit is contained in:
Narbeh 2019-11-30 20:41:53 +04:00 committed by GitHub
commit af29641bcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ from datetime import datetime
from ssl import PROTOCOL_TLSv1 from ssl import PROTOCOL_TLSv1
from time import sleep from time import sleep
from csv import DictWriter from csv import DictWriter
import json
try: try:
from OpenSSL import SSL from OpenSSL import SSL
@ -55,7 +56,6 @@ def border_msg(message):
def analyze_ssl(host, context): def analyze_ssl(host, context):
"""Analyze the security of the SSL certificate.""" """Analyze the security of the SSL certificate."""
from json import loads
try: try:
from urllib.request import urlopen from urllib.request import urlopen
except ImportError: except ImportError:
@ -223,9 +223,9 @@ def show_result(user_args):
if user_args.json_true: if user_args.json_true:
if user_args.pretty_output: if user_args.pretty_output:
from pprint import pprint from pprint import pprint
pprint(context) print(json.dumps(context, indent=4))
else: else:
print(context) print(json.dumps(context))
def export_csv(context, filename): def export_csv(context, filename):