如何检查线上域名的过期时间,sslyze这个包不错,可以试试
from sslyze import *
from sslyze.server_connectivity import *
from sslyze.plugins.certificate_info_plugin import *
from sslyze.synchronous_scanner import *
server_info = ServerConnectivityInfo(hostname=u'www.baidu.com')
server_info.test_connectivity_to_server(network_timeout=1)
synchronous_scanner = SynchronousScanner()
command = CertificateInfoScanCommand()
scan_result = synchronous_scanner.run_scan_command(server_info, command)
cert=scan_result.certificate_chain[0]
print(cert.not_valid_after)
网友评论