服务器协议密码,确定SSL服务器支持的最差/最佳协议、最弱/最强密码的最快速方法?...

为此,我需要找出服务器支持的最差/最佳协议和最弱/最强的密码。在

以下是我使用sslyze的代码:from plugins import PluginOpenSSLCipherSuites

from nassl import SSLV2, SSLV3, TLSV1, TLSV1_1, TLSV1_2

shared_settings = {'certinfo': 'basic', 'starttls': None, 'resum': True, 'resum_rate': None, 'http_get': True, 'xml_file': '/tmp/example.com_443.xml', 'compression': True, 'tlsv1': True, 'targets_in': None, 'keyform': 1, 'hsts': None, 'sslv3': True, 'sslv2': True, 'https_tunnel': None, 'nb_retries': 4, 'heartbleed': True, 'sni': None, 'https_tunnel_host': None, 'regular': False, 'key': None, 'reneg': True, 'tlsv1_2': True, 'tlsv1_1': True, 'hide_rejected_ciphers': True, 'keypass': '', 'cert': None, 'certform': 1, 'timeout': 5, 'xmpp_to': None}

target = ('example.com', '1.2.3.4', 443, TLSV1_2)

cipher_plugin = PluginOpenSSLCipherSuites.PluginOpenSSLCipherSuites()

cipher_plugin._shared_settings = shared_settings

protocols = ['sslv2', 'sslv3', 'tlsv1', 'tlsv1_1', 'tlsv1_2']

for p in protocols:

cipher_result = cipher_plugin.process_task(target, p, None)

cipher_result = cipher_plugin.process_task

if any('Accepted' in c for c in cipher_result.get_txt_result()):

worst_protocol = p

break

for p in reversed(protocols):

cipher_result = cipher_plugin.process_task(target, p, None)

if any('Accepted' in c for c in cipher_result.get_txt_result()):

best_protocol = p

break

print(worst_protocol)

print(best_protocol)

ciphers = []

for protocol in ('sslv2', 'sslv3', 'tlsv1', 'tlsv1_1', 'tlsv1_2'):

cipher_result = cipher_plugin.process_task(target, protocol, None)

for e in cipher_result.get_txt_result():

if 'bits' in e:

ciphers.append(e.split()[1])

print(sorted(ciphers)[0])

print(sorted(ciphers)[-1])

因为这需要一些时间来完成。在

使用下面的代码,执行时间从~50秒减少到~40秒。还有什么可以改进的吗?在

^{pr2}$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值