feat(agent): if hostname present in nmap scan report, add to report for server
!8 #4
This commit is contained in:
@ -43,6 +43,13 @@
|
|||||||
"subnetId": "{{ subnet.id }}",
|
"subnetId": "{{ subnet.id }}",
|
||||||
"ip": "{{ scanned_host.address['@addr'] | default(scanned_host.address[0]['@addr']) }}",
|
"ip": "{{ scanned_host.address['@addr'] | default(scanned_host.address[0]['@addr']) }}",
|
||||||
"lastSeen": "{{ nmap_scan.start }}",
|
"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' %}
|
{% if scanned_host.address['@addrtype'] | default(scanned_host.address[1]['@addrtype']) == 'mac' %}
|
||||||
"mac": "{{ scanned_host.address['@addr'] | default(scanned_host.address[1]['@addr']) | upper }}"
|
"mac": "{{ scanned_host.address['@addr'] | default(scanned_host.address[1]['@addr']) | upper }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Reference in New Issue
Block a user