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

Function create_nodes

python3_cron_scripts/create_cert_graphs.py:641–688  ·  view source on GitHub ↗

Create the list of D3.js nodes and links based on the collected certificates

(graph, mongo_connector, zone, all_certs)

Source from the content-addressed store, hash-verified

639
640
641def create_nodes(graph, mongo_connector, zone, all_certs):
642 """
643 Create the list of D3.js nodes and links based on the collected certificates
644 """
645 DNS_MGR = DNSManager.DNSManager(mongo_connector)
646
647 for cert in all_certs:
648 matched_count = 0
649 if "censys_count" in cert:
650 matched_count = cert["censys_count"]
651
652 if "zgrab_count" in cert:
653 matched_count = matched_count + cert["zgrab_count"]
654
655 graph.add_node(
656 cert["id"],
657 type="certificate",
658 sources=cert["sources"],
659 total_count=matched_count,
660 )
661 for dns_entry in cert["dns_entries"]:
662 lookup = DNS_MGR.find_one({"fqdn": dns_entry}, None)
663
664 root_flag = "false"
665 if dns_entry == zone:
666 root_flag = "true"
667
668 if lookup is None:
669 graph.add_node(
670 dns_entry,
671 root=root_flag,
672 status="No Host",
673 type="domain",
674 sources=cert["sources"],
675 )
676 else:
677 graph.add_node(
678 dns_entry,
679 root=root_flag,
680 status="Resolves",
681 type="domain",
682 sources=cert["sources"],
683 )
684
685 graph.add_edge(cert["id"], dns_entry, type="sans")
686 graph.add_edge(dns_entry, cert["id"], type="uses")
687
688 return graph
689
690
691def main(logger=None):

Callers 1

mainFunction · 0.85

Calls 1

find_oneMethod · 0.95

Tested by

no test coverage detected