Add JSON Output Arg
This commit is contained in:
parent
ddde1c7135
commit
f2418593ca
17
README.md
17
README.md
@ -1,15 +1,15 @@
|
|||||||
# SSL Checker
|
# SSL Checker
|
||||||
#### Python script that collects SSL information from hosts
|
#### Python script that collects SSL/TLS information from hosts
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
It's a simple script running in python that collects SSL information then it returns the group of information in JSON. It can also connects trough your specified SOCKS server.
|
It's a simple script running in python that collects SSL/TLS information then it returns the group of information in JSON. It can also connects trough your specified SOCKS server.
|
||||||
|
|
||||||
One of the good thing about this script, is that it will full analyze the SSL certificate for security issue's and will include the report in the output or CSV file.
|
One of the good thing about this script, is that it will full analyze the SSL certificate for security issue's and will include the report in the output, CSV or JSON file.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
You only need to installl pyOpenSSL:
|
You only need to install pyOpenSSL:
|
||||||
|
|
||||||
`pip install pyopenssl`
|
`pip install pyopenssl`
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ or
|
|||||||
|
|
||||||
```
|
```
|
||||||
./ssl_checker.py -h
|
./ssl_checker.py -h
|
||||||
usage: ssl_checker.py [-H [HOSTS [HOSTS ...]] | -f HOST_FILE] [-s HOST:PORT]
|
usage: ssl_checker.py (-H [HOSTS [HOSTS ...]] | -f HOST_FILE) [-s HOST:PORT]
|
||||||
[-c FILENAME.CSV] [-j] [-a] [-p] [-h]
|
[-c FILENAME.CSV] [-j] [-J] [-a] [-h]
|
||||||
|
|
||||||
Collects useful information about given host's SSL certificates.
|
Collects useful information about given host's SSL certificates.
|
||||||
|
|
||||||
@ -36,7 +36,8 @@ optional arguments:
|
|||||||
-c FILENAME.CSV, --csv FILENAME.CSV
|
-c FILENAME.CSV, --csv FILENAME.CSV
|
||||||
Enable CSV file export
|
Enable CSV file export
|
||||||
-j, --json Enable JSON in the output
|
-j, --json Enable JSON in the output
|
||||||
-a, --analyze Enable SSL security analysis on the host.
|
-J, --json-save Enable JSON export individually per host
|
||||||
|
-a, --analyze Enable SSL security analysis on the host
|
||||||
-h, --help Show this help message and exit
|
-h, --help Show this help message and exit
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -54,6 +55,8 @@ Port is optional here. The script will use 443 if not specified.
|
|||||||
|
|
||||||
`-j, --json ` Use this if you want to only have the result in JSON
|
`-j, --json ` Use this if you want to only have the result in JSON
|
||||||
|
|
||||||
|
`-J, --json-save` Use this if you want to save as JSON file per host
|
||||||
|
|
||||||
`-a, --analyze` This argument will include security analyze on the certificate. Takes more time. No result means failed to analyze.
|
`-a, --analyze` This argument will include security analyze on the certificate. Takes more time. No result means failed to analyze.
|
||||||
|
|
||||||
`-h, --help` Shows the help and exit
|
`-h, --help` Shows the help and exit
|
||||||
|
|||||||
@ -227,10 +227,12 @@ def show_result(user_args):
|
|||||||
|
|
||||||
# Enable JSON output if -j/--json argument specified
|
# Enable JSON output if -j/--json argument specified
|
||||||
if user_args.json_true:
|
if user_args.json_true:
|
||||||
|
print(json.dumps(context))
|
||||||
|
|
||||||
|
if user_args.json_save_true:
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
with open(host.split(".")[0] + ".json", "w", encoding="UTF-8") as fp:
|
with open(host.split('.')[0] + '.json', 'w', encoding='UTF-8') as fp:
|
||||||
fp.write(json.dumps(context))
|
fp.write(json.dumps(context))
|
||||||
print(json.dumps(context))
|
|
||||||
|
|
||||||
|
|
||||||
def export_csv(context, filename):
|
def export_csv(context, filename):
|
||||||
@ -272,6 +274,9 @@ def get_args():
|
|||||||
parser.add_argument('-j', '--json', dest='json_true',
|
parser.add_argument('-j', '--json', dest='json_true',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help='Enable JSON in the output')
|
help='Enable JSON in the output')
|
||||||
|
parser.add_argument('-J', '--json-save', dest='json_save_true',
|
||||||
|
action='store_true', default=False,
|
||||||
|
help='Enable JSON export individually per host')
|
||||||
parser.add_argument('-a', '--analyze', dest='analyze',
|
parser.add_argument('-a', '--analyze', dest='analyze',
|
||||||
default=False, action='store_true',
|
default=False, action='store_true',
|
||||||
help='Enable SSL security analysis on the host')
|
help='Enable SSL security analysis on the host')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user