chore: initial release #22

Merged
jon_nfc merged 54 commits from development into master 2024-02-21 09:07:13 +00:00
24 changed files with 709 additions and 9 deletions
Showing only changes of commit 68f43bf70f - Show all commits

View File

@ -38,7 +38,9 @@
SELECT id, subnet FROM subnets WHERE
scanAgent='{{ mysql_query_agent_details.query_result[0][0].id }}'
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
register: mysql_query_agent_subnets

View File

@ -26,17 +26,23 @@
subnet_scan_results: |-
[
{% 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 -%}
{%- if cached_host.ip == scanned_host.address[0]['@addr'] -%}
{% for cached_host in cached_subnet | default([]) -%}
{%- if cached_host.ip == scanned_host.address['@addr'] | default(scanned_host.address[0]['@addr']) -%}
"id": {{ cached_host.id }},
{%- endif -%}
{%- endfor %}
"subnetId": "{{ subnet.id }}",
"ip": "{{ scanned_host.address[0]['@addr'] }}",
"ip": "{{ scanned_host.address['@addr'] | default(scanned_host.address[0]['@addr']) }}",
"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 %}
{% endfor %}