Refactor Code and Update README.md

This commit is contained in:
Narbeh 2018-04-19 11:28:07 +04:30
parent f6d05ca3b9
commit 1dee91b82c
2 changed files with 11 additions and 12 deletions

View File

@ -23,13 +23,13 @@ Port is optional here. The script will use 443 if not specified.
narbeh@narbeh-xps:~/ssl-checker$ python ssl_checker.py test.com narbeh.org:443 archive.org facebook.com:443 twitter.com github.com google.com
Analyzing 7 hosts:
[+] test.com
[+] narbeh.org
[+] archive.org
[-] facebook.com failed: [Errno 111] Connection refused
[-] twitter.com failed: [Errno 111] Connection refused
[+] github.com
[+] google.com
[+] 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.
```
5 successful and 2 failed
```

View File

@ -81,12 +81,11 @@ def show_result(hosts):
try:
cert = get_cert(host, port)
context[host] = get_cert_info(cert)
print('\t{}[+]{} {}'.format(Clr.GREEN, Clr.RST, host))
print('\t{}[+]{} {:<20s} Expired: {}'.format(Clr.GREEN, Clr.RST, host, context[host]['cert_exp']))
except Exception as error:
print('\t{}[-]{} {:<20s} failed: {}'.format(Clr.RED, Clr.RST, host, error))
print('\t{}[-]{} {:<20s} Failed: {}'.format(Clr.RED, Clr.RST, host, error))
failed_cnt += 1
print('\n{} successful and {} failed\n'.format(len(hosts) - failed_cnt, failed_cnt))
pprint(context)