Remove Pretty JSON

This commit is contained in:
Narbeh Arakil 2019-12-01 00:05:23 +04:00
parent dca407d0a7
commit 6cd1ed4075
2 changed files with 5 additions and 40 deletions

View File

@ -37,7 +37,6 @@ optional arguments:
Enable CSV file export
-j, --json Enable JSON in the output
-a, --analyze Enable SSL security analysis on the host.
-p, --pretty Print pretty and more human readable JSON
-h, --help Show this help message and exit
```
@ -57,8 +56,6 @@ Port is optional here. The script will use 443 if not specified.
`-a, --analyze` This argument will include security analyze on the certificate. Takes more time. No result means failed to analyze.
`-p, --pretty ` Use this with `-j` to print indented and human readable JSON
`-h, --help` Shows the help and exit
## Censored?
@ -157,7 +154,7 @@ narbeh@narbeh-laptop:~/ssl-checker$ ./ssl_checker.py -H time.com github.com:443
By passing `-a/--analyze` to the script, it will scan the certificate for security issues and vulnerabilities. It will also mark a grade for the certificate. **This will take more time to finish.**
```
narbeh@narbeh-xps:~/ssl-checker$ ./ssl_checker.py -j -p -H narbeh.org:443 -a
narbeh@narbeh-xps:~/ssl-checker$ ./ssl_checker.py -H narbeh.org:443 -a
+---------------------+
| Analyzing 1 host(s) |
+---------------------+
@ -193,36 +190,11 @@ Warning: -a/--analyze is enabled. It takes more time...
## JSON And CSV Output
Example only with the `-j/--json` and `-p/--pretty` arguments which shows the JSON only. Perfect for piping to another tool.
Example only with the `-j/--json` argument which shows the JSON only. Perfect for piping to another tool.
```
narbeh@narbeh-xps:~/ssl-checker$ ./ssl_checker.py -j -p -H narbeh.org:443 test.com
{'narbeh.org': {'cert_alg': u'sha256WithRSAEncryption',
'cert_exp': False,
'cert_sn': 338163108483756707389368573553026254634358L,
'cert_ver': 2,
'issued_o': None,
'issued_to': u'narbeh.org',
'issuer_c': u'US',
'issuer_cn': u"Let's Encrypt Authority X3",
'issuer_o': u"Let's Encrypt",
'issuer_ou': None,
'valid_from': '2018-04-21',
'valid_till': '2018-07-20',
'validity_days': 90},
'test.com': {'cert_alg': u'sha256WithRSAEncryption',
'cert_exp': False,
'cert_sn': 73932709062103623902948514363737041075L,
'cert_ver': 2,
'issued_o': None,
'issued_to': u'www.test.com',
'issuer_c': u'US',
'issuer_cn': u'Network Solutions DV Server CA 2',
'issuer_o': u'Network Solutions L.L.C.',
'issuer_ou': None,
'valid_from': '2017-01-15',
'valid_till': '2020-01-24',
'validity_days': 1104}}
narbeh@narbeh-xps:~/ssl-checker$ ./ssl_checker.py -j -H narbeh.org:443 test.com
{"narbeh.org": {"issued_to": "narbeh.org", "cert_sans": "DNS:narbeh.org", "valid_till": "2019-12-26", "valid_from": "2019-09-27", "issuer_ou": null, "days_left": 25, "cert_ver": 2, "cert_alg": "sha256WithRSAEncryption", "issued_o": null, "cert_exp": false, "cert_sha1": "05:52:4E:89:1E:98:1D:40:C1:41:F4:DD:F7:51:86:20:27:CF:E7:7F", "issuer_c": "US", "issuer_cn": "Let's Encrypt Authority X3", "issuer_o": "Let's Encrypt", "validity_days": 90, "cert_sn": 293690843427182569577385918507679703674563}}
```

View File

@ -225,11 +225,7 @@ def show_result(user_args):
# Enable JSON output if -j/--json argument specified
if user_args.json_true:
if user_args.pretty_output:
from pprint import pprint
pprint(context)
else:
print(json.dumps(context))
print(json.dumps(context))
def export_csv(context, filename):
@ -274,9 +270,6 @@ def get_args():
parser.add_argument('-a', '--analyze', dest='analyze',
default=False, action='store_true',
help='Enable SSL security analysis on the host')
parser.add_argument('-p', '--pretty', dest='pretty_output',
action='store_true', default=False,
help='Print pretty and more human readable JSON')
parser.add_argument('-h', '--help', default=SUPPRESS,
action='help',
help='Show this help message and exit')