From 8993387ad98f33be65dd5e4ce7079bb169fc2bc8 Mon Sep 17 00:00:00 2001 From: Narbeh Date: Tue, 17 Apr 2018 19:59:43 +0430 Subject: [PATCH] Add Failed Hosts Counter --- ssl_checker.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ssl_checker.py b/ssl_checker.py index 10e9dc5..840a469 100644 --- a/ssl_checker.py +++ b/ssl_checker.py @@ -28,7 +28,7 @@ def get_cert(host): try: sock.connect((host, 443)) - print('\t{}[+]{} --> {}'.format(TextColor.GREEN, TextColor.RESET, host)) + print('\t{}[+]{} {}'.format(TextColor.GREEN, TextColor.RESET, host)) except Exception as e: print('\t{}[-]{} {} failed: {}'.format(TextColor.RED, TextColor.RESET, host, e)) return None @@ -70,13 +70,17 @@ def get_cert_info(cert): def show_result(hosts): """Get the context.""" - context = {} + context, failed_cnt = {}, 0 print('Analyzing {} hosts:\n'.format(len(hosts))) for host in hosts: host = clean_hostname(host) cert = get_cert(host) if cert: context[host] = get_cert_info(cert) + else: + failed_cnt += 1 + + print('\n{} successful and {} failed.'.format(len(hosts), failed_cnt)) print(context)