MCPcopy Create free account
hub / github.com/adobe/Marinus / check_in_zone

Function check_in_zone

python3_cron_scripts/zgrab_port_ip.py:222–251  ·  view source on GitHub ↗

Obtain the DNS names from the common_name and dns_zones from the entry's SSL certificate. Determine if the entry's DNS names is in the list of provided zones. Return the matched zone.

(entry, zones)

Source from the content-addressed store, hash-verified

220
221
222def check_in_zone(entry, zones):
223 """
224 Obtain the DNS names from the common_name and dns_zones from the entry's SSL certificate.
225 Determine if the entry's DNS names is in the list of provided zones.
226 Return the matched zone.
227 """
228
229 try:
230 certificate = entry["server_certificates"]["certificate"]
231 except:
232 return []
233
234 try:
235 temp1 = certificate["parsed"]["subject"]["common_name"]
236 except KeyError:
237 temp1 = []
238
239 try:
240 temp2 = certificate["parsed"]["extensions"]["subject_alt_name"]["dns_names"]
241 except KeyError:
242 temp2 = []
243
244 cert_zones = []
245 value_array = temp1 + temp2
246 for value in value_array:
247 zone = zone_compare(value, zones)
248 if zone is not None and zone not in cert_zones:
249 cert_zones.append(zone)
250
251 return cert_zones
252
253
254def insert_result(entry, port, ip_context, all_zones, results_collection):

Callers 1

insert_resultFunction · 0.70

Calls 1

zone_compareFunction · 0.70

Tested by

no test coverage detected