Get the count of matching certificates for the provided hash
(zgrab_collection, sha256_hash, version)
| 158 | |
| 159 | |
| 160 | def get_scan_count(zgrab_collection, sha256_hash, version): |
| 161 | """ |
| 162 | Get the count of matching certificates for the provided hash |
| 163 | """ |
| 164 | if version == 1: |
| 165 | result_count = zgrab_collection.count_documents( |
| 166 | { |
| 167 | "$or": [ |
| 168 | { |
| 169 | "data.http.response.request.tls_handshake.server_certificates.certificate.parsed.fingerprint_sha256": sha256_hash |
| 170 | }, |
| 171 | { |
| 172 | "data.http.response.redirect_response_chain.0.request.tls_handshake.server_certificates.certificate.parsed.fingerprint_sha256": sha256_hash |
| 173 | }, |
| 174 | ] |
| 175 | } |
| 176 | ) |
| 177 | else: |
| 178 | result_count = zgrab_collection.count_documents( |
| 179 | { |
| 180 | "$or": [ |
| 181 | { |
| 182 | "data.http.result.response.request.tls_log.handshake_log.server_certificates.certificate.parsed.fingerprint_sha256": sha256_hash |
| 183 | }, |
| 184 | { |
| 185 | "data.http.result.redirect_response_chain.0.request.tls_log.handshake_log.server_certificates.certificate.parsed.fingerprint_sha256": sha256_hash |
| 186 | }, |
| 187 | ] |
| 188 | } |
| 189 | ) |
| 190 | return result_count |
| 191 | |
| 192 | |
| 193 | def add_terminal_zgrab_certificates( |
no outgoing calls
no test coverage detected