• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python server_connectivity.ServerConnectivityInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sslyze.server_connectivity.ServerConnectivityInfo的典型用法代码示例。如果您正苦于以下问题:Python ServerConnectivityInfo类的具体用法?Python ServerConnectivityInfo怎么用?Python ServerConnectivityInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ServerConnectivityInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_https_tunneling

    def test_https_tunneling(self):
        # Start a local proxy
        proxy_port = 8000
        p = multiprocessing.Process(target=proxy_worker, args=(proxy_port, ))
        p.start()

        try:
            # Run a scan through the proxy
            tunnel_settings = HttpConnectTunnelingSettings('localhost', proxy_port)
            server_info = ServerConnectivityInfo(hostname=u'www.google.com', http_tunneling_settings=tunnel_settings)

            # Try to connect to the proxy - retry if the proxy subprocess wasn't ready
            proxy_connection_attempts = 0
            while True:
                try:
                    server_info.test_connectivity_to_server()
                    break
                except ServerConnectivityError:
                    if proxy_connection_attempts > 3:
                        raise
                    proxy_connection_attempts += 1


            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())
        finally:
            # Kill the local proxy - unclean
            p.terminate()
开发者ID:,项目名称:,代码行数:33,代码来源:


示例2: test_ca_file_bad_file

    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,代码行数:7,代码来源:test_certificate_info_plugin.py


示例3: test_invalid_chain

    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,代码行数:28,代码来源:test_certificate_info_plugin.py


示例4: test_1000_sans_chain

    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,代码行数:7,代码来源:test_certificate_info_plugin.py


示例5: test_valid_chain_with_ev_cert

    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,代码行数:26,代码来源:test_certificate_info_plugin.py


示例6: test_valid_chain

    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,代码行数:35,代码来源:test_certificate_info_plugin.py


示例7: _get_plugin_result

    def _get_plugin_result(self, hostname, command=Tlsv12ScanCommand()):
        server_info = ServerConnectivityInfo(hostname=hostname)
        server_info.test_connectivity_to_server()

        plugin = OpenSslCipherSuitesPlugin()
        plugin_result = plugin.process_task(server_info, command)

        return plugin_result
开发者ID:pfeiffersz,项目名称:sslyze,代码行数:8,代码来源:test_openssl_cipher_suites_plugin.py


示例8: test_synchronous_scanner

    def test_synchronous_scanner(self):
        server_info = ServerConnectivityInfo(hostname='www.google.com')
        server_info.test_connectivity_to_server()

        sync_scanner = SynchronousScanner()
        plugin_result = sync_scanner.run_scan_command(server_info, CompressionScanCommand())
        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
开发者ID:pfeiffersz,项目名称:sslyze,代码行数:8,代码来源:test_scanner.py


示例9: test_smtp_post_handshake_response

    def test_smtp_post_handshake_response(self):
        server_info = ServerConnectivityInfo(hostname='smtp.gmail.com', port=587,
                                             tls_wrapped_protocol=TlsWrappedProtocolEnum.STARTTLS_SMTP)
        server_info.test_connectivity_to_server()

        plugin = OpenSslCipherSuitesPlugin()
        plugin_result = plugin.process_task(server_info, Tlsv12ScanCommand())

        self._test_plugin_outputs(plugin_result)
开发者ID:pfeiffersz,项目名称:sslyze,代码行数:9,代码来源:test_openssl_cipher_suites_plugin.py


示例10: test_1000_sans_chain

    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,代码行数:10,代码来源:test_certificate_info_plugin.py


示例11: test_sha256_chain

    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,代码行数:10,代码来源:test_certificate_info_plugin.py


示例12: test_sha1_chain

    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,代码行数:11,代码来源:test_certificate_info_plugin.py


示例13: test_unicode_certificate

    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,代码行数:11,代码来源:test_certificate_info_plugin.py


示例14: test_chain_with_anchor

    def test_chain_with_anchor(self):
        server_info = ServerConnectivityInfo(hostname=u'www.verizon.com')
        server_info.test_connectivity_to_server()

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

        self.assertTrue(plugin_result.has_anchor_in_certificate_chain)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
开发者ID:,项目名称:,代码行数:11,代码来源:


示例15: test_dh_info

    def test_dh_info(self):
        server_info = ServerConnectivityInfo(hostname=u'dh480.badssl.com')
        server_info.test_connectivity_to_server()

        plugin = OpenSslCipherSuitesPlugin()
        plugin_result = plugin.process_task(server_info, 'tlsv1')

        self.assertTrue(plugin_result.preferred_cipher)
        self.assertEquals(plugin_result.preferred_cipher.dh_info['GroupSize'], '480')
        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
开发者ID:,项目名称:,代码行数:11,代码来源:


示例16: test_sha1_chain

    def test_sha1_chain(self):
        server_info = ServerConnectivityInfo(hostname=u'sha1-2017.badssl.com')
        server_info.test_connectivity_to_server()

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

        self.assertTrue(plugin_result.has_sha1_in_certificate_chain)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
开发者ID:,项目名称:,代码行数:11,代码来源:


示例17: test_sha1_chain

    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,代码行数:11,代码来源:test_certificate_info_plugin.py


示例18: test_compression_disabled

    def test_compression_disabled(self):
        server_info = ServerConnectivityInfo(hostname=u"www.google.com")
        server_info.test_connectivity_to_server()

        plugin = CompressionPlugin()
        plugin_result = plugin.process_task(server_info, "compression")

        self.assertFalse(plugin_result.compression_name)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
开发者ID:nabla-c0d3,项目名称:sslyze,代码行数:11,代码来源:test_compression_plugin.py


示例19: test_hsts_enabled

    def test_hsts_enabled(self):
        server_info = ServerConnectivityInfo(hostname='hsts.badssl.com')
        server_info.test_connectivity_to_server()

        plugin = HstsPlugin()
        plugin_result = plugin.process_task(server_info, 'hsts')

        self.assertTrue(plugin_result.hsts_header)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
开发者ID:LucaBongiorni,项目名称:sslyze,代码行数:11,代码来源:test_hsts_plugin.py


示例20: test_heartbleed_good

    def test_heartbleed_good(self):
        server_info = ServerConnectivityInfo(hostname='www.google.com')
        server_info.test_connectivity_to_server()

        plugin = HeartbleedPlugin()
        plugin_result = plugin.process_task(server_info, 'heartbleed')

        self.assertFalse(plugin_result.is_vulnerable_to_heartbleed)

        self.assertTrue(plugin_result.as_text())
        self.assertTrue(plugin_result.as_xml())
开发者ID:LucaBongiorni,项目名称:sslyze,代码行数:11,代码来源:test_heartbleed_plugin.py



注:本文中的sslyze.server_connectivity.ServerConnectivityInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap