2018-04-18 09:48:19 +04:30
|
|
|
# SSL Checker
|
|
|
|
|
#### Simple Python script that collects SSL information from hosts
|
|
|
|
|
|
2018-04-18 16:32:41 +04:30
|
|
|
## About
|
2018-04-18 09:48:19 +04:30
|
|
|
|
|
|
|
|
It's a simple script running in python that collects SSL information then it returns the group of information in JSON.
|
|
|
|
|
|
2018-04-18 16:32:41 +04:30
|
|
|
## Requirements
|
|
|
|
|
|
|
|
|
|
You only need to installl pyOpenSSL:
|
|
|
|
|
|
|
|
|
|
`pip install pyopenssl`
|
|
|
|
|
|
|
|
|
|
## Usage
|
2018-04-18 09:48:19 +04:30
|
|
|
|
2018-04-19 14:35:50 +04:30
|
|
|
```bash
|
|
|
|
|
./ssl_checker.py -h
|
|
|
|
|
usage: ssl_checker.py -H [HOSTS [HOSTS ...]] [-j] [-h]
|
|
|
|
|
|
|
|
|
|
optional arguments:
|
|
|
|
|
-H [HOSTS [HOSTS ...]], --host [HOSTS [HOSTS ...]]
|
|
|
|
|
Hosts as input separated by space
|
|
|
|
|
-j, --json Enable JSON in the output
|
2018-04-19 21:11:32 +04:30
|
|
|
-p, --pretty Print pretty and more human readable Json
|
2018-04-19 14:35:50 +04:30
|
|
|
-h, --help Show this help message and exit
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2018-04-18 09:59:32 +04:30
|
|
|
|
|
|
|
|
Port is optional here. The script will use 443 if not specified.
|
2018-04-18 09:48:19 +04:30
|
|
|
|
2018-04-19 14:35:50 +04:30
|
|
|
`-j, --json` Use this if you want to only have the result in JSON
|
|
|
|
|
|
2018-04-19 21:11:32 +04:30
|
|
|
`-p, --pretty` Use this with `-j` to print indented and human readable json
|
|
|
|
|
|
2018-04-19 14:35:50 +04:30
|
|
|
`-H, --host` Enter the hosts separated by space
|
|
|
|
|
|
|
|
|
|
`-h, --help` Shows the help and exit
|
|
|
|
|
|
|
|
|
|
|
2018-04-18 16:32:41 +04:30
|
|
|
## Example
|
2018-04-18 09:48:19 +04:30
|
|
|
|
|
|
|
|
```bash
|
2018-04-19 14:35:50 +04:30
|
|
|
narbeh@narbeh-xps:~/ssl-checker$ ./ssl_checker.py -H test.com narbeh.org:443 archive.org facebook.com:443 twitter.com github.com google.com
|
2018-04-18 17:15:04 +04:30
|
|
|
Analyzing 7 hosts:
|
2018-04-18 09:48:19 +04:30
|
|
|
|
2018-04-19 11:28:07 +04:30
|
|
|
[+] test.com Expired: False
|
|
|
|
|
[+] narbeh.org Expired: False
|
|
|
|
|
[+] archive.org Expired: False
|
|
|
|
|
[-] facebook.com Failed: [Errno 111] Connection refused
|
|
|
|
|
[-] twitter.com Failed: [Errno 111] Connection refused
|
|
|
|
|
[+] github.com Expired: False
|
|
|
|
|
[+] google.com Expired: False
|
|
|
|
|
|
|
|
|
|
5 successful and 2 failed
|
2018-04-19 14:35:50 +04:30
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example only with the `-j` argument which show the JSON only. Perfect for piping to another tool.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
narbeh@narbeh-xps:~/ssl-checker$ ./ssl_checker.py -j -H test.com narbeh.org:443
|
|
|
|
|
{'test.com': {'valid_till': '2020-01-24', 'valid_from': '2017-01-15', 'cert_alg': u'sha256WithRSAEncryption', 'cert_ver': 2, 'cert_sn': 73932709062103623902948514363737041075L, 'cert_exp': False, 'issuer_c': u'US', 'issuer_cn': u'Network Solutions DV Server CA 2', 'issuer_o': u'Network Solutions L.L.C.', 'validity_days': 1104, 'issuer_ou': None}, 'narbeh.org': {'valid_till': '2018-05-18', 'valid_from': '2018-02-17', 'cert_alg': u'sha256WithRSAEncryption', 'cert_ver': 2, 'cert_sn': 319510066429286596971677345373584681421772L, 'cert_exp': False, 'issuer_c': u'US', 'issuer_cn': u"Let's Encrypt Authority X3", 'issuer_o': u"Let's Encrypt", 'validity_days': 90, 'issuer_ou': None}}
|
2018-04-19 21:11:32 +04:30
|
|
|
```
|