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

Function create_IPv6_zone

python3_cron_scripts/setup.py:399–432  ·  view source on GitHub ↗

When examinging reverse DNS records, Marinus can match based on the IP address range owned by the organization. This will an IPv6 CIDR to the list of the organizations known ranges. This information is stored in the ipv6_zones collection.

(mongo_collection, cidr)

Source from the content-addressed store, hash-verified

397
398
399def create_IPv6_zone(mongo_collection, cidr):
400 """
401 When examinging reverse DNS records, Marinus can match based on the IP address range owned by the organization.
402 This will an IPv6 CIDR to the list of the organizations known ranges.
403 This information is stored in the ipv6_zones collection.
404 """
405 ipv6_zone_collection = mongo_collection.get_ipv6_zone_connection()
406 now = datetime.now()
407
408 double_check = ipv6_zone_collection.count_documents({"zone": cidr})
409 if double_check != 0:
410 print("CIDR value: " + cidr + " already exists!")
411 return
412
413 try:
414 foo = ipaddress.ip_network(cidr)
415 except:
416 print("Error: Not a valid IPv6 CIDR value")
417 return
418
419 if type(foo) is not ipaddress.IPv6Network:
420 print("Not an IPv6 Address")
421 return
422
423 new_entry = {}
424 new_entry["status"] = "unconfirmed"
425 new_entry["source"] = "manual"
426 new_entry["updated"] = now
427 new_entry["created"] = now
428 new_entry["notes"] = []
429 new_entry["zone"] = cidr
430
431 print("Inserting IPv6 zone: " + cidr)
432 ipv6_zone_collection.insert_one(new_entry)
433
434
435def add_new_job(mongo_connector, job_name):

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected