def test_guess_response_with_handshake(self): content_type = constants.ContentType.handshake data = bytearray([constants.HandshakeType.client_hello, 0, 0, 0]) self.assertEqual("Handshake(client_hello)", guess_response(content_type, data))
def test_guess_response_with_alert(self): content_type = constants.ContentType.alert data = bytearray([constants.AlertLevel.warning, constants.AlertDescription.protocol_version]) self.assertEqual("Alert(warning, protocol_version)", guess_response(content_type, data))
def test_guess_response_with_alert(self): content_type = constants.ContentType.alert data = bytearray([ constants.AlertLevel.warning, constants.AlertDescription.protocol_version ]) self.assertEqual("Alert(warning, protocol_version)", guess_response(content_type, data))
def test_guess_response_with_invalid_data(self): content_type = 0xfa data = bytearray(b'\x02\x03\x05') self.assertEqual("Message(content_type=250, first_byte=2, len=3)", guess_response(content_type, data))
def test_guess_response_with_invalid_handshake(self): content_type = constants.ContentType.handshake data = bytearray() self.assertEqual("Handshake(invalid size)", guess_response(content_type, data))
def test_guess_response_with_invalid_alert(self): content_type = constants.ContentType.alert data = bytearray([constants.AlertLevel.warning]) self.assertEqual("Alert(invalid size)", guess_response(content_type, data))
def test_guess_response_with_bad_CCS(self): content_type = constants.ContentType.change_cipher_spec data = bytearray() self.assertEqual("ChangeCipherSpec(invalid size)", guess_response(content_type, data))
def test_guess_response(self): content_type = constants.ContentType.application_data data = bytearray(10) self.assertEqual("ApplicationData(len=10)", guess_response(content_type, data))
def test_guess_response_with_SSL2_hanshake(self): content_type = constants.ContentType.handshake data = bytearray([constants.SSL2HandshakeType.server_hello]) self.assertEqual("Handshake(server_hello)", guess_response(content_type, data, ssl2=True))