{% extends "base.html" %}
{% block content %}
{% from 'include/input_macros.html' import input, checkbox, select %}
{% if serv %}
{% endif %}
{% if history %}
{% include 'include/port_scan_history.html' %}
{% elif port_scanner_stderr != '' %}
You have not installed Port scanner service. Read here how to install Port scanner service
{% else %}
{% if servers|length == 0 %}
{% include 'include/getstarted.html' %}
{% endif %}
{% for s in servers %}
{% for p in port_scanner_settings %}
{% if port_scanner_settings|length > 0 %}
{% if p.server_id == s.0 and p.enabled == 1 %}
{% if port_scanner == 'active' %}
{% else %}
{% endif %}
{% elif p.server_id == s.0 and p.enabled == 0 %}
{% endif %}
{% else %}
{% endif %}
{% endfor %}
{% if s.0 not in port_scanner_settings|map(attribute='server_id') %}
{% endif %}
{% if not serv %}
{{s.1}}
{% else %}
{{s.1}}
{% endif %}
{% if role <= 2 %}
{% endif %}
{{s.11}}
IP: {{s.2}}
Last scan:
{% if count_ports is defined %}
{% for c in count_ports %}
{% if c.0 == s.2 %}
{{c.1.0.1}}
{% endif %}
{% endfor %}
{% endif %}
Total opened ports:
{% if count_ports is defined %}
{% for c in count_ports %}
{% if c.0 == s.2 %}
{{c.1.0.0}}
{% endif %}
{% endfor %}
{% endif %}
{% if role <= 2 %}
{% set portscanner_enable_id = 'portscanner_enable-' + s.0|string() %}
{% set portscanner_notify_id = 'portscanner_notify-' + s.0|string() %}
{% set portscanner_history_id = 'portscanner_history-' + s.0|string() %}
{% if port_scanner_settings|length > 0 %}
{% for p in port_scanner_settings %}
{% if p.server_id == s.0 %}
{% set disabled = 'false' %}
{% if p.enabled == 0 %}
{% set disabled = 'true' %}
{% endif %}
{% if p.enabled == 1 %}
{{ checkbox(portscanner_enable_id, title="Port scanner enabled", checked='checked', desc='Port scanner') }}
{% else %}
{{ checkbox(portscanner_enable_id, title="Port scanner disabled", desc='Port scanner') }}
{% endif %}
{% if p.notify == 1 %}
{{ checkbox(portscanner_notify_id, title="Notification via Telegram enabled", checked='checked', desc='Notify') }}
{% else %}
{{ checkbox(portscanner_notify_id, title="Notification via Telegram disabled", desc='Notify', disabled=disabled) }}
{% endif %}
{% if p.history == 1 %}
{{ checkbox(portscanner_history_id, title="Keeping history enabled", checked='checked', desc='Keep history') }}
{% else %}
{{ checkbox(portscanner_history_id, title="Keeping history disabled", desc='Keep history', disabled=disabled) }}
{% endif %}
{% endif %}
{% endfor %}
{% if s.0 not in port_scanner_settings|map(attribute='server_id') %}
{{ checkbox(portscanner_enable_id, title="Port scanner disabled", desc='Port scanner') }}
{{ checkbox(portscanner_notify_id, title="Notification via Telegram disabled", desc='Notify', disabled='true') }}
{{ checkbox(portscanner_history_id, title="Keeping history disabled", desc='Keep history', disabled='true') }}
{% endif %}
{% else %}
{{ checkbox(portscanner_enable_id, title="Port scanner disabled", desc='Port scanner') }}
{{ checkbox(portscanner_notify_id, title="Notification via Telegram disabled", desc='Notify', disabled='true') }}
{{ checkbox(portscanner_history_id, title="Keeping history disabled", desc='Keep history', disabled='true') }}
{% endif %}
{% endif %}