def cert_get_domains(cert):
    domains = []
    try:
        ext = cert.extensions.get_extension_for_oid(x509.OID_SUBJECT_ALTERNATIVE_NAME)
        entries = ext.value.get_values_for_type(x509.DNSName)
        for entry in entries:
            domains.append(entry)
    except Exception as e:
        app.logger.warning("Failed to get SubjectAltName: {0}".format(e))

    return domains
Attempts to get an domains listed in a certificate.
dataset/ETHPy150Open Netflix/security_monkey/security_monkey/watchers/iam/iam_ssl.py/cert_get_domains