當前位置: 首頁>>代碼示例>>Python>>正文


Python CertificateInfoPlugin.process_task方法代碼示例

本文整理匯總了Python中sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin.process_task方法的典型用法代碼示例。如果您正苦於以下問題:Python CertificateInfoPlugin.process_task方法的具體用法?Python CertificateInfoPlugin.process_task怎麽用?Python CertificateInfoPlugin.process_task使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin的用法示例。


在下文中一共展示了CertificateInfoPlugin.process_task方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_ca_file_bad_file

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_ca_file_bad_file(self):
        server_info = ServerConnectivityInfo(hostname='www.hotmail.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        with self.assertRaises(ValueError):
            plugin.process_task(server_info, CertificateInfoScanCommand(ca_file='doesntexist'))
開發者ID:pfeiffersz,項目名稱:sslyze,代碼行數:9,代碼來源:test_certificate_info_plugin.py

示例2: test_1000_sans_chain

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_1000_sans_chain(self):
        # Ensure SSLyze can process a leaf cert with 1000 SANs
        server_info = ServerConnectivityInfo(hostname='1000-sans.badssl.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin.process_task(server_info, CertificateInfoScanCommand())
開發者ID:pfeiffersz,項目名稱:sslyze,代碼行數:9,代碼來源:test_certificate_info_plugin.py

示例3: test_valid_chain

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_valid_chain(self):
        server_info = ServerConnectivityInfo(hostname='www.hotmail.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, 'certinfo_basic')

        self.assertTrue(plugin_result.ocsp_response)
        self.assertTrue(plugin_result.is_ocsp_response_trusted)
        self.assertTrue(plugin_result.is_leaf_certificate_ev)

        self.assertEquals(len(plugin_result.certificate_chain), 2)

        self.assertEquals(len(plugin_result.path_validation_result_list), 5)
        for path_validation_result in plugin_result.path_validation_result_list:
            self.assertTrue(path_validation_result.is_certificate_trusted)

        self.assertEquals(len(plugin_result.path_validation_error_list), 0)
        self.assertEquals(plugin_result.hostname_validation_result, X509_NAME_MATCHES_SAN)
        self.assertTrue(plugin_result.is_certificate_chain_order_valid)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())

        # Test the --ca_path option
        plugin_result = plugin.process_task(server_info, 'certinfo_basic',
                                            {'ca_file': os.path.join(os.path.dirname(__file__), 'utils',
                                                                     'wildcard-self-signed.pem')})

        self.assertEquals(len(plugin_result.path_validation_result_list), 6)
        for path_validation_result in plugin_result.path_validation_result_list:
            if path_validation_result.trust_store.name == 'Custom --ca_file':
                self.assertFalse(path_validation_result.is_certificate_trusted)
            else:
                self.assertTrue(path_validation_result.is_certificate_trusted)
開發者ID:sandeepl337,項目名稱:sslyze,代碼行數:37,代碼來源:test_certificate_info_plugin.py

示例4: test_valid_chain_with_ev_cert

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_valid_chain_with_ev_cert(self):
        server_info = ServerConnectivityInfo(hostname='www.comodo.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, CertificateInfoScanCommand())

        self.assertTrue(plugin_result.is_leaf_certificate_ev)

        self.assertEqual(len(plugin_result.certificate_chain), 3)
        self.assertEqual(len(plugin_result.verified_certificate_chain), 3)
        self.assertFalse(plugin_result.has_anchor_in_certificate_chain)

        self.assertEqual(len(plugin_result.path_validation_result_list), 5)
        for path_validation_result in plugin_result.path_validation_result_list:
            self.assertTrue(path_validation_result.is_certificate_trusted)

        self.assertEqual(len(plugin_result.path_validation_error_list), 0)
        self.assertEqual(plugin_result.certificate_matches_hostname, True)
        self.assertTrue(plugin_result.is_certificate_chain_order_valid)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())

        # Ensure the results are pickable so the ConcurrentScanner can receive them via a Queue
        self.assertTrue(pickle.dumps(plugin_result))
開發者ID:pfeiffersz,項目名稱:sslyze,代碼行數:28,代碼來源:test_certificate_info_plugin.py

示例5: test_invalid_chain

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_invalid_chain(self):
        server_info = ServerConnectivityInfo(hostname='self-signed.badssl.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, CertificateInfoScanCommand())

        self.assertIsNone(plugin_result.ocsp_response)
        self.assertEqual(len(plugin_result.certificate_chain), 1)

        self.assertEqual(len(plugin_result.path_validation_result_list), 5)
        for path_validation_result in plugin_result.path_validation_result_list:
            self.assertFalse(path_validation_result.is_certificate_trusted)

        self.assertEqual(plugin_result.certificate_included_scts_count, 0)

        self.assertEqual(len(plugin_result.path_validation_error_list), 0)
        self.assertEqual(plugin_result.certificate_matches_hostname, True)
        self.assertTrue(plugin_result.is_certificate_chain_order_valid)
        self.assertIsNone(plugin_result.has_anchor_in_certificate_chain)
        self.assertIsNone(plugin_result.has_sha1_in_certificate_chain)
        self.assertFalse(plugin_result.verified_certificate_chain)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())

        # Ensure the results are pickable so the ConcurrentScanner can receive them via a Queue
        self.assertTrue(pickle.dumps(plugin_result))
開發者ID:pfeiffersz,項目名稱:sslyze,代碼行數:30,代碼來源:test_certificate_info_plugin.py

示例6: test_sha256_chain

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_sha256_chain(self):
        server_info = ServerConnectivityInfo(hostname='sha256.badssl.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, 'certinfo_basic')

        self.assertIn('OK - No SHA1-signed certificate in the chain', '\n'.join(plugin_result.as_text()))

        self.assertTrue(plugin_result.as_xml())
開發者ID:sandeepl337,項目名稱:sslyze,代碼行數:12,代碼來源:test_certificate_info_plugin.py

示例7: test_1000_sans_chain

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_1000_sans_chain(self):
        # Ensure SSLyze can process a leaf cert with 1000 SANs
        server_info = ServerConnectivityInfo(hostname='1000-sans.badssl.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, 'certinfo_basic')

        san_list = plugin_result.certificate_chain[0].as_dict['extensions']['X509v3 Subject Alternative Name']['DNS']
        self.assertEquals(len(san_list), 1000)
開發者ID:sandeepl337,項目名稱:sslyze,代碼行數:12,代碼來源:test_certificate_info_plugin.py

示例8: test_sha1_chain

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_sha1_chain(self):
        server_info = ServerConnectivityInfo(hostname='sha1-intermediate.badssl.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, CertificateInfoScanCommand())

        self.assertTrue(plugin_result.has_sha1_in_certificate_chain)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
開發者ID:pfeiffersz,項目名稱:sslyze,代碼行數:13,代碼來源:test_certificate_info_plugin.py

示例9: test_sha1_chain

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_sha1_chain(self):
        server_info = ServerConnectivityInfo(hostname='sha1-2017.badssl.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, 'certinfo_basic')

        # TODO: Expose has_sha1 as an attribute
        self.assertIn('INSECURE - SHA1-signed certificate in the chain', '\n'.join(plugin_result.as_text()))

        self.assertTrue(plugin_result.as_xml())
開發者ID:sandeepl337,項目名稱:sslyze,代碼行數:13,代碼來源:test_certificate_info_plugin.py

示例10: test_unicode_certificate

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_unicode_certificate(self):
        server_info = ServerConnectivityInfo(hostname=u'www.főgáz.hu')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, 'certinfo_basic')

        self.assertTrue(plugin_result.certificate_chain)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
開發者ID:sandeepl337,項目名稱:sslyze,代碼行數:13,代碼來源:test_certificate_info_plugin.py

示例11: test_optional_client_authentication

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_optional_client_authentication(self):
        for hostname in ['auth.startssl.com', 'xnet-eu.intellij.net']:
            server_info = ServerConnectivityInfo(hostname=hostname)
            server_info.test_connectivity_to_server()
            self.assertEquals(server_info.client_auth_requirement, ClientAuthenticationServerConfigurationEnum.OPTIONAL)

            plugin = CertificateInfoPlugin()
            plugin_result = plugin.process_task(server_info, 'certinfo_basic')

            self.assertTrue(plugin_result.as_text())
            self.assertTrue(plugin_result.as_xml())
開發者ID:LucaBongiorni,項目名稱:sslyze,代碼行數:13,代碼來源:test_protocols.py

示例12: test_smtp_custom_port

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_smtp_custom_port(self):
        server_info = ServerConnectivityInfo(hostname='smtp.gmail.com', port=587,
                                             tls_wrapped_protocol=TlsWrappedProtocolEnum.STARTTLS_SMTP)
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, 'certinfo_basic')

        self.assertEquals(len(plugin_result.certificate_chain), 3)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
開發者ID:LucaBongiorni,項目名稱:sslyze,代碼行數:14,代碼來源:test_protocols.py

示例13: test_xmpp_to

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_xmpp_to(self):
        server_info = ServerConnectivityInfo(hostname='talk.google.com',
                                             tls_wrapped_protocol=TlsWrappedProtocolEnum.STARTTLS_XMPP,
                                             xmpp_to_hostname='gmail.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, 'certinfo_basic')

        self.assertEquals(len(plugin_result.certificate_chain), 3)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
開發者ID:LucaBongiorni,項目名稱:sslyze,代碼行數:15,代碼來源:test_protocols.py

示例14: test_starttls

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_starttls(self):
        for hostname, protocol in [('imap.comcast.net', TlsWrappedProtocolEnum.STARTTLS_IMAP),
                                   ('pop.comcast.net', TlsWrappedProtocolEnum.STARTTLS_POP3),
                                   ('ldap.virginia.edu', TlsWrappedProtocolEnum.STARTTLS_LDAP),
                                   ('jabber.org', TlsWrappedProtocolEnum.STARTTLS_XMPP_SERVER)]:

            server_info = ServerConnectivityInfo(hostname=hostname, tls_wrapped_protocol=protocol)
            server_info.test_connectivity_to_server()

            plugin = CertificateInfoPlugin()
            plugin_result = plugin.process_task(server_info, 'certinfo_basic')

            self.assertTrue(plugin_result.as_text())
            self.assertTrue(plugin_result.as_xml())
開發者ID:LucaBongiorni,項目名稱:sslyze,代碼行數:16,代碼來源:test_protocols.py

示例15: test_ecdsa_certificate

# 需要導入模塊: from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin [as 別名]
# 或者: from sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin import process_task [as 別名]
    def test_ecdsa_certificate(self):
        server_info = ServerConnectivityInfo(hostname='www.cloudflare.com')
        server_info.test_connectivity_to_server()

        plugin = CertificateInfoPlugin()
        plugin_result = plugin.process_task(server_info, CertificateInfoScanCommand())

        self.assertGreaterEqual(len(plugin_result.certificate_chain), 1)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())

        # Ensure the results are pickable so the ConcurrentScanner can receive them via a Queue
        self.assertTrue(pickle.dumps(plugin_result))
開發者ID:pfeiffersz,項目名稱:sslyze,代碼行數:16,代碼來源:test_certificate_info_plugin.py


注:本文中的sslyze.plugins.certificate_info_plugin.CertificateInfoPlugin.process_task方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。