Get the list of non-expired certificate transparency certificates for the indicated zone.
(ct_connection, zone)
| 31 | |
| 32 | |
| 33 | def get_current_ct_certificates(ct_connection, zone): |
| 34 | """ |
| 35 | Get the list of non-expired certificate transparency certificates for the indicated zone. |
| 36 | """ |
| 37 | |
| 38 | results = ct_connection.find( |
| 39 | { |
| 40 | "isExpired": False, |
| 41 | "subject_common_names": {"$regex": r"^(.+\.)*" + zone + "$"}, |
| 42 | "subject_dns_names": {"$regex": r"^(.+\.)*" + zone + "$"}, |
| 43 | }, |
| 44 | {"fingerprint_sha256": 1, "subject_common_names": 1, "subject_dns_names": 1}, |
| 45 | ) |
| 46 | |
| 47 | collection = [] |
| 48 | for result in results: |
| 49 | item = {"id": result["fingerprint_sha256"]} |
| 50 | item["dns_entries"] = ( |
| 51 | result["subject_common_names"] + result["subject_dns_names"] |
| 52 | ) |
| 53 | item["sources"] = ["ct_logs"] |
| 54 | collection.append(item) |
| 55 | |
| 56 | return collection |
| 57 | |
| 58 | |
| 59 | def get_censys_count(censys_collection, sha256_hash): |