in cartography/intel/dns.py [0:0]
def ingest_dns_record_by_fqdn(session, update_tag, fqdn, points_to_record):
"""
Ingest a new DNS record by it's FQDN
:param session: Neo4j session object
:param update_tag: Update tag to set the node with and childs
:param fqdn: the fqdn record to add
:param points_to_record: parent record to set DNS_POINTS_TO relationship to. Can be None
:return: the graph node id for the new/merged record
"""
fqdn_data = get_dns_resolution_by_fqdn(fqdn)
record_type = get_dns_record_type(fqdn_data)
if record_type == 'A':
ip_list = []
for result in fqdn_data:
ip = str(result)
ip_list.append(ip)
value = ",".join(ip_list)
record_id = ingest_dns_record(session, fqdn, value, record_type, update_tag, points_to_record)
_link_ip_to_A_record(session, update_tag, ip_list, record_id)
return record_id
else:
raise NotImplementedError(
"Ingestion of DNS record type '{0}' by FQDN has not been implemented. Failed to ingest '{1}'.".format(
record_type,
fqdn
)
)