本文整理汇总了Python中tlsfuzzer.runner.ConnectionState类的典型用法代码示例。如果您正苦于以下问题:Python ConnectionState类的具体用法?Python ConnectionState怎么用?Python ConnectionState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConnectionState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_process_with_ssl2
def test_process_with_ssl2(self):
exp = ExpectFinished((2, 0))
state = ConnectionState()
state.msg_sock = mock.MagicMock()
msg = ServerFinished().create(bytearray(range(12)))
exp.process(state, msg)
开发者ID:akokare,项目名称:tlsfuzzer,代码行数:7,代码来源:test_tlsfuzzer_expect.py
示例2: test_process_with_not_matching_signature_algorithms
def test_process_with_not_matching_signature_algorithms(self):
exp = ExpectServerKeyExchange(valid_sig_algs=[(HashAlgorithm.sha256,
SignatureAlgorithm.rsa)])
state = ConnectionState()
state.cipher = CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA
cert = Certificate(CertificateType.x509).\
create(X509CertChain([X509().parse(srv_raw_certificate)]))
private_key = parsePEMKey(srv_raw_key, private=True)
client_hello = ClientHello()
client_hello.client_version = (3, 3)
client_hello.random = bytearray(32)
state.client_random = client_hello.random
state.handshake_messages.append(client_hello)
server_hello = ServerHello()
server_hello.server_version = (3, 3)
server_hello.random = bytearray(32)
state.server_random = server_hello.random
# server hello is not necessary for the test to work
#state.handshake_messages.append(server_hello)
state.handshake_messages.append(cert)
srv_key_exchange = DHE_RSAKeyExchange(\
CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
client_hello,
server_hello,
private_key)
msg = srv_key_exchange.makeServerKeyExchange('sha1')
with self.assertRaises(TLSIllegalParameterException):
exp.process(state, msg)
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:33,代码来源:test_tlsfuzzer_expect.py
示例3: test_post_send
def test_post_send(self):
state = ConnectionState()
state.get_server_public_key = lambda: self.priv_key
cke = ClientKeyExchangeGenerator(constants.CipherSuite.TLS_RSA_WITH_NULL_MD5, (3, 3))
ret = cke.generate(state)
cke.post_send(state)
开发者ID:NetPainter,项目名称:tlsfuzzer,代码行数:8,代码来源:test_tlsfuzzer_messages.py
示例4: test_get_last_message_of_type_with_no_messages_of_that_type
def test_get_last_message_of_type_with_no_messages_of_that_type(self):
state = ConnectionState()
msg = messages.ServerHello()
msg.server_version = (3, 1)
state.handshake_messages.append(msg)
msg = state.get_last_message_of_type(messages.ClientHello)
self.assertIsNone(msg)
开发者ID:akokare,项目名称:tlsfuzzer,代码行数:8,代码来源:test_tlsfuzzer_runner.py
示例5: test_process
def test_process(self):
state = ConnectionState()
state.msg_sock = mock.MagicMock()
close = Close()
close.process(state)
state.msg_sock.sock.close.called_once_with()
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:8,代码来源:test_tlsfuzzer_messages.py
示例6: test_post_send_with_resumption
def test_post_send_with_resumption(self):
fg = FinishedGenerator()
state = ConnectionState()
state.resuming = True
ret = fg.generate(state)
fg.post_send(state)
self.assertFalse(state.resuming)
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:9,代码来源:test_tlsfuzzer_messages.py
示例7: test_process_with_size
def test_process_with_size(self):
node = SetMaxRecordSize(2048)
state = ConnectionState()
state.msg_sock = mock.MagicMock()
node.process(state)
self.assertEqual(2048, state.msg_sock.recordSize)
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:9,代码来源:test_tlsfuzzer_messages.py
示例8: test_generate_with_dhe
def test_generate_with_dhe(self):
state = ConnectionState()
state.key_exchange = mock.MagicMock()
cke = ClientKeyExchangeGenerator(
cipher=constants.CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA)
ret = cke.generate(state)
self.assertIs(ret, state.key_exchange.makeClientKeyExchange())
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:10,代码来源:test_tlsfuzzer_messages.py
示例9: test_post_send
def test_post_send(self):
ccsg = ChangeCipherSpecGenerator()
ccsg.generate(None)
state = ConnectionState()
state.msg_sock = mock.MagicMock()
ccsg.post_send(state)
self.assertTrue(state.msg_sock.calcPendingStates.called)
self.assertTrue(state.msg_sock.changeWriteState.called)
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:10,代码来源:test_tlsfuzzer_messages.py
示例10: test_generate_TLS_1_1
def test_generate_TLS_1_1(self):
priv_key = generateRSAKey(1024)
cert_ver_g = CertificateVerifyGenerator(priv_key)
state = ConnectionState()
state.version = (3, 2)
msg = cert_ver_g.generate(state)
self.assertIsNotNone(msg)
self.assertEqual(len(msg.signature), 128)
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:10,代码来源:test_tlsfuzzer_messages.py
示例11: test_generate_with_export_cipher
def test_generate_with_export_cipher(self):
cmk = ClientMasterKeyGenerator(
cipher=constants.CipherSuite.SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5)
state = ConnectionState()
state.msg_sock = mock.MagicMock()
state.get_server_public_key = mock.MagicMock()
ret = cmk.generate(state)
self.assertEqual(len(ret.clear_key), 11)
开发者ID:jamella,项目名称:tlsfuzzer,代码行数:10,代码来源:test_tlsfuzzer_messages.py
示例12: test_generate
def test_generate(self):
state = ConnectionState()
state.get_server_public_key = lambda: self.priv_key
cke = ClientKeyExchangeGenerator()
ret = cke.generate(state)
self.assertEqual(len(ret.encryptedPreMasterSecret), 128)
decrypt = self.priv_key.decrypt(ret.encryptedPreMasterSecret)
self.assertEqual(decrypt[:2], bytearray([3, 3]))
开发者ID:NetPainter,项目名称:tlsfuzzer,代码行数:11,代码来源:test_tlsfuzzer_messages.py
示例13: test_generate_with_ssl2
def test_generate_with_ssl2(self):
fg = FinishedGenerator((0, 2))
state = ConnectionState()
state.msg_sock = mock.MagicMock()
state.session_id = bytearray(b'abba')
ret = fg.generate(state)
self.assertEqual(ret.verify_data, bytearray(b'abba'))
state.msg_sock.changeWriteState.assert_called_once_with()
state.msg_sock.changeReadState.assert_called_once_with()
开发者ID:jamella,项目名称:tlsfuzzer,代码行数:11,代码来源:test_tlsfuzzer_messages.py
示例14: test_generate_with_des_cipher
def test_generate_with_des_cipher(self):
cmk = ClientMasterKeyGenerator(
cipher=constants.CipherSuite.SSL_CK_DES_64_CBC_WITH_MD5)
state = ConnectionState()
state.msg_sock = mock.MagicMock()
state.get_server_public_key = mock.MagicMock()
ret = cmk.generate(state)
self.assertEqual(ret.encrypted_key,
state.get_server_public_key().encrypt())
开发者ID:jamella,项目名称:tlsfuzzer,代码行数:11,代码来源:test_tlsfuzzer_messages.py
示例15: test_get_server_public_key_with_valid_messages
def test_get_server_public_key_with_valid_messages(self):
state = ConnectionState()
msg = messages.Certificate(constants.CertificateType.x509)
cert_list = mock.MagicMock()
msg.create(cert_list)
state.handshake_messages.append(msg)
state.get_server_public_key()
self.assertTrue(cert_list.getEndEntityPublicKey.called)
开发者ID:ZESecurity,项目名称:tlsfuzzer,代码行数:11,代码来源:test_tlsfuzzer_runner.py
示例16: test_process
def test_process(self):
exp = ExpectChangeCipherSpec()
state = ConnectionState()
state.msg_sock = mock.MagicMock()
msg = Message(ContentType.change_cipher_spec, bytearray(1))
exp.process(state, msg)
state.msg_sock.changeReadState.assert_called_once_with()
开发者ID:iambrosie,项目名称:tlsfuzzer,代码行数:11,代码来源:test_tlsfuzzer_expect.py
示例17: test_get_last_message_of_type
def test_get_last_message_of_type(self):
state = ConnectionState()
msg = messages.ServerHello()
msg.server_version = (3, 1)
state.handshake_messages.append(msg)
msg = messages.ServerHello()
msg.server_version = (3, 3)
state.handshake_messages.append(msg)
msg = state.get_last_message_of_type(messages.ServerHello)
self.assertEqual(msg.server_version, (3, 3))
开发者ID:akokare,项目名称:tlsfuzzer,代码行数:12,代码来源:test_tlsfuzzer_runner.py
示例18: test_generate
def test_generate(self):
state = ConnectionState()
state.get_server_public_key = lambda : self.priv_key
cke = ClientKeyExchangeGenerator(
cipher=constants.CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA)
ret = cke.generate(state)
self.assertEqual(len(ret.encryptedPreMasterSecret), 128)
decrypt = self.priv_key.decrypt(ret.encryptedPreMasterSecret)
self.assertEqual(decrypt[:2], bytearray([3, 3]))
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:12,代码来源:test_tlsfuzzer_messages.py
示例19: test_process
def test_process(self):
exp = ExpectServerHello2()
state = ConnectionState()
state.msg_sock = mock.MagicMock()
msg = ServerHello2()
msg.session_id_hit = 1
msg.session_id = bytearray(b'\x12')
msg.certificate = X509().parse(srv_raw_certificate).writeBytes()
ret = exp.process(state, msg)
self.assertEqual(state.session_id, msg.session_id)
开发者ID:akokare,项目名称:tlsfuzzer,代码行数:13,代码来源:test_tlsfuzzer_expect.py
示例20: test_generate_TLS_1_2
def test_generate_TLS_1_2(self):
priv_key = generateRSAKey(1024)
cert_ver_g = CertificateVerifyGenerator(priv_key)
state = ConnectionState()
state.version = (3, 3)
msg = cert_ver_g.generate(state)
self.assertIsNotNone(msg)
self.assertEqual(len(msg.signature), 128)
self.assertEqual(msg.signatureAlgorithm,
(constants.HashAlgorithm.sha1,
constants.SignatureAlgorithm.rsa))
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:13,代码来源:test_tlsfuzzer_messages.py
注:本文中的tlsfuzzer.runner.ConnectionState类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论