Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. try:
  2.         for port in ports:
  3.             cert = ssl.get_server_certificate((host, port), ssl_version=ssl.PROTOCOL_TLSv1)
  4.             connect_type = "TLSv1"
  5.             return cert, connect_type
  6.     except Exception:
  7.         for port in ports:
  8.             cert = ssl.get_server_certificate((host, port), ssl_version=ssl.PROTOCOL_SSLv2)
  9.             connect_type = "SSLv2"
  10.             return cert, connect_type
  11.     except Exception:
  12.         for port in ports:
  13.             cert = ssl.get_server_certificate((host, port), ssl_version=ssl.PROTOCOL_SSLv23)
  14.             connect_type = "SSLv23"
  15.             return cert, connect_type
  16.     except Exception:
  17.         get_starttls_cert(host)
  18.         return cert
  19.     except Exception as e:
  20.         print("Something went wrong: %s" % e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement