证书透明性搜索
certificate-search的Python项目详细描述
证书搜索
查询crt.sh的非官方包装
安装
可以从以下位置安装包 PyPI
pip install certificate-search
用法
importjsonfromcryptography.x509.oidimportNameOID,ExtensionOIDfromcryptography.x509.general_nameimportDNSNamefromcrt.searchimportCertificateSearch,SUPPORTED_SITES# Print the list of all supported sitesprint(json.dumps(SUPPORTED_SITES))engines=CertificateSearch()domains=['github.com','facebook.com',]fordomainindomains:forcertinengine.search(domain=domain):not_before=cert.not_beforenot_after=cert.not_afterpem=cert.pem# An x509 certificatecommon_name=pem.subject.get_attributes_for_oid(NameOID.COMMON_NAME)[0].valuecountry_name=pem.subject.get_attributes_for_oid(NameOID.COUNTRY_NAME)[0].valueorganization_name=pem.subject.get_attributes_for_oid(NameOID.ORGANIZATION_NAME)[0].value# All SAN recordssan=pem.extensions.get_extension_for_oid(ExtensionOID.SUBJECT_ALTERNATIVE_NAME)san_names=san.value.get_values_for_type(DNSName)