def test_server_connectivity_test_succeeded(self): # Given a server to scan to which sslyze was able to connect server_info = ServerConnectivityInfoFactory.create() # When generating the console output for this with StringIO() as file_out: console_gen = ConsoleOutputGenerator(file_to=file_out) console_gen.server_connectivity_test_succeeded(server_info) final_output = file_out.getvalue() # It succeeds and the server is displayed assert final_output assert server_info.server_location.hostname in final_output
def test_server_connectivity_test_succeeded_with_optional_client_auth(self): # Test when client authentication is optional output_file = StringIO() generator = ConsoleOutputGenerator(output_file) server_info = MockServerConnectivityInfo(ClientAuthenticationServerConfigurationEnum.OPTIONAL) generator.server_connectivity_test_succeeded(server_info) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly warned about client authentication self.assertIn('Server requested optional client authentication', received_output)
def test_server_connectivity_test_succeeded_with_optional_client_auth(self): # Test when client authentication is optional output_file = StringIO() generator = ConsoleOutputGenerator(output_file) server_info = MockServerConnectivityInfo(ClientAuthenticationServerConfigurationEnum.OPTIONAL) generator.server_connectivity_test_succeeded(server_info) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly warned about client authentication assert 'Server requested optional client authentication' in received_output
def test_server_connectivity_test_succeeded_with_required_client_auth(self): # Test when client authentication is required output_file = StringIO() generator = ConsoleOutputGenerator(output_file) server_info = MockServerConnectivityInfo(ClientAuthenticationServerConfigurationEnum.REQUIRED) generator.server_connectivity_test_succeeded(server_info) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly warned about client authentication assert 'Server REQUIRED client authentication' in received_output
def test_server_connectivity_test_succeeded(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) server_info = MockServerConnectivityInfo() generator.server_connectivity_test_succeeded(server_info) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the online domain self.assertIn(server_info.hostname, received_output) self.assertIn(str(server_info.port), received_output) self.assertIn(server_info.ip_address, received_output)
def test_server_connectivity_test_succeeded_with_http_tunneling(self): # Given a server to scan to which sslyze was able to connect server_info = ServerConnectivityInfoFactory.create( # And sslyze connected to it via an HTTP proxy server_location=ServerNetworkLocationViaHttpProxyFactory.create()) # When generating the console output for this with StringIO() as file_out: console_gen = ConsoleOutputGenerator(file_to=file_out) console_gen.server_connectivity_test_succeeded(server_info) final_output = file_out.getvalue() # It succeeds and the fact that an HTTP proxy was used was displayed assert final_output assert "proxy" in final_output
def test_server_connectivity_test_succeeded_with_required_client_auth( self): # Test when client authentication is required output_file = StringIO() generator = ConsoleOutputGenerator(output_file) server_info = MockServerConnectivityInfo( ClientAuthenticationServerConfigurationEnum.REQUIRED) generator.server_connectivity_test_succeeded(server_info) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly warned about client authentication self.assertIn('Server REQUIRED client authentication', received_output)
def test_server_connectivity_test_succeeded_with_required_client_auth( self): # Given a server to scan to which sslyze was able to connect server_info = ServerConnectivityInfoFactory.create( tls_probing_result=ServerTlsProbingResult( highest_tls_version_supported=TlsVersionEnum.TLS_1_2, cipher_suite_supported="AES", # And the server requires client authentication client_auth_requirement=ClientAuthRequirementEnum.REQUIRED, )) # When generating the console output for this with StringIO() as file_out: console_gen = ConsoleOutputGenerator(file_to=file_out) console_gen.server_connectivity_test_succeeded(server_info) final_output = file_out.getvalue() # It succeeds and the fact that the server requires client auth was displayed assert final_output assert "Server REQUIRED client authentication" in final_output
def test_server_connectivity_test_succeeded_with_http_tunneling(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) # When scanning through a proxy, we do not know the final server's IP address # This makes sure the console output properly handles that tunneling_settings = HttpConnectTunnelingSettings('ûnicôdé.com', 3128) server_info = MockServerConnectivityInfo(http_tunneling_settings=tunneling_settings) generator.server_connectivity_test_succeeded(server_info) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the online domain and that it was going through a proxy self.assertIn(server_info.hostname, received_output) self.assertIn(str(server_info.port), received_output) self.assertIn('Proxy', received_output) self.assertIn(tunneling_settings.hostname, received_output) self.assertIn(str(tunneling_settings.port), received_output)
def test_server_connectivity_test_succeeded_with_http_tunneling(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) # When scanning through a proxy, we do not know the final server's IP address # This makes sure the console output properly handles that tunneling_settings = HttpConnectTunnelingSettings('ûnicôdé.com', 3128) server_info = MockServerConnectivityInfo(http_tunneling_settings=tunneling_settings) generator.server_connectivity_test_succeeded(server_info) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the online domain and that it was going through a proxy assert server_info.hostname in received_output assert str(server_info.port) in received_output assert 'Proxy' in received_output assert tunneling_settings.hostname in received_output assert str(tunneling_settings.port) in received_output