def test_ssl_2(self): # Given a server that supports SSL 2.0 try: with VulnerableOpenSslServer() as server: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(5) sock.connect((server.hostname, server.port)) ssl_client = LegacySslClient( ssl_version=OpenSslVersionEnum.SSLV2, underlying_socket=sock, ssl_verify=OpenSslVerifyEnum.NONE, ignore_client_authentication_requests=True, ) # When doing the special SSL 2.0 handshake, it succeeds try: ssl_client.do_handshake() self.assertTrue(ssl_client) finally: ssl_client.shutdown() sock.close() except NotOnLinux64Error: logging.warning('WARNING: Not on Linux - skipping test') return
def test_ssl_2(self): # Given a server that supports SSL 2.0 with LegacyOpenSslServer() as server: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(5) sock.connect((server.hostname, server.port)) ssl_client = LegacySslClient( ssl_version=OpenSslVersionEnum.SSLV2, underlying_socket=sock, ssl_verify=OpenSslVerifyEnum.NONE, ignore_client_authentication_requests=True, ) # When doing the special SSL 2.0 handshake, it succeeds try: ssl_client.do_handshake() finally: ssl_client.shutdown()