feat(agent): if hostname present in nmap scan report, add to report for server

!8 #4
This commit is contained in:
2024-02-22 20:10:13 +09:30
parent f8bdccd122
commit 4c631c67f9

View File

@ -43,6 +43,13 @@
"subnetId": "{{ subnet.id }}",
"ip": "{{ scanned_host.address['@addr'] | default(scanned_host.address[0]['@addr']) }}",
"lastSeen": "{{ nmap_scan.start }}",
{% if scanned_host.hostnames.hostname is defined %}
{% if '.' in scanned_host.hostnames.hostname['@name'] | string %}
"hostname": "{{ (scanned_host.hostnames.hostname['@name'] | split('.'))[0] }}",
{% else %}
"hostname": "{{ scanned_host.hostnames.hostname['@name'] }}",
{% endif %}
{% endif %}
{% if scanned_host.address['@addrtype'] | default(scanned_host.address[1]['@addrtype']) == 'mac' %}
"mac": "{{ scanned_host.address['@addr'] | default(scanned_host.address[1]['@addr']) | upper }}"
{% endif %}