@ -38,7 +38,9 @@
|
|||||||
SELECT id, subnet FROM subnets WHERE
|
SELECT id, subnet FROM subnets WHERE
|
||||||
scanAgent='{{ mysql_query_agent_details.query_result[0][0].id }}'
|
scanAgent='{{ mysql_query_agent_details.query_result[0][0].id }}'
|
||||||
and
|
and
|
||||||
subnet='{{ inbound_data.scan[0].subnet | ip2ipam }}'
|
subnet='{{ (inbound_data.scan.subnet | split('/'))[0] | ip2ipam }}'
|
||||||
|
and
|
||||||
|
mask = '{{ (inbound_data.scan.subnet | split('/'))[1] | int }}'
|
||||||
single_transaction: true
|
single_transaction: true
|
||||||
register: mysql_query_agent_subnets
|
register: mysql_query_agent_subnets
|
||||||
|
|
||||||
|
@ -26,17 +26,23 @@
|
|||||||
subnet_scan_results: |-
|
subnet_scan_results: |-
|
||||||
[
|
[
|
||||||
{% for scanned_host in ((nmap_scan.stdout | ansible.utils.from_xml) | from_yaml).nmaprun.host %}
|
{% for scanned_host in ((nmap_scan.stdout | ansible.utils.from_xml) | from_yaml).nmaprun.host %}
|
||||||
{% if scanned_host.address[0]['@addrtype'] | default('') == 'ipv4' %}
|
{% if
|
||||||
|
scanned_host.address[0]['@addrtype'] | default('') == 'ipv4'
|
||||||
|
or
|
||||||
|
scanned_host.address['@addrtype'] | default('') == 'ipv4'
|
||||||
|
%}
|
||||||
{
|
{
|
||||||
{% for cached_host in cached_subnet -%}
|
{% for cached_host in cached_subnet | default([]) -%}
|
||||||
{%- if cached_host.ip == scanned_host.address[0]['@addr'] -%}
|
{%- if cached_host.ip == scanned_host.address['@addr'] | default(scanned_host.address[0]['@addr']) -%}
|
||||||
"id": {{ cached_host.id }},
|
"id": {{ cached_host.id }},
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
"subnetId": "{{ subnet.id }}",
|
"subnetId": "{{ subnet.id }}",
|
||||||
"ip": "{{ scanned_host.address[0]['@addr'] }}",
|
"ip": "{{ scanned_host.address['@addr'] | default(scanned_host.address[0]['@addr']) }}",
|
||||||
"lastSeen": "{{ nmap_scan.start }}",
|
"lastSeen": "{{ nmap_scan.start }}",
|
||||||
"mac": "{{ scanned_host.address[1]['@addr'] | upper }}"
|
{% 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 %}
|
||||||
},
|
},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Reference in New Issue
Block a user