2021-04-03 04:10:37 +00:00
{% extends "base.html" %}
{% block content %}
{% from 'include/input_macros.html' import input, checkbox, select %}
< script src = "/inc/overview.js" > < / script >
{% if serv %}
< style >
@media (max-width: 1280px) {
.div-pannel {
height: 430px !important;
}
}
< / style >
{% endif %}
< style >
.alert-danger {
width: 250px;
display: inline-block;
height: 15px;
padding-top: 0px;
padding-bottom: 8px;
margin-bottom: -20px !important;
}
.ui-checkboxradio-label {
padding-bottom: 5px !important;
padding-top: 5px !important;
}
< / style >
2022-05-02 19:00:25 +00:00
{% if user_status == 0 %}
2022-04-29 10:28:48 +00:00
{% include 'include/no_sub.html' %}
{% else %}
2021-04-03 04:10:37 +00:00
{% if history %}
{% include 'include/port_scan_history.html' %}
{% elif port_scanner_stderr != '' %}
< div style = "text-align: center;" >
< br / >
2022-07-30 17:00:36 +00:00
< h3 > You have not installed Port scanner service. Read < a href = "https://roxy-wi.org/services.py/portscanner"
2021-04-03 04:10:37 +00:00
title="Port scanner" target="_blank">here< / a > how to install Port scanner service< / h3 >
< / div >
{% else %}
< div id = "up-pannel" >
{% if servers|length == 0 %}
{% include 'include/getstarted.html' %}
{% endif %}
{% for s in servers %}
2021-05-29 15:24:17 +00:00
< div id = "div-server-{{s.0}}" class = "div-server-hapwi
{%- if port_scanner == 'active' %}
div-server-head-up
{%- else %}
div-server-head-down
{%- endif -%}">
2021-04-03 04:10:37 +00:00
< div class = "server-name" >
< input type = "hidden" id = "server-name-{{s.0}}" value = "{{s.1}}" / >
{% for p in port_scanner_settings %}
{% if port_scanner_settings|length > 0 %}
2021-08-02 08:19:22 +00:00
{% if p.server_id == s.0 and p.enabled == 1 %}
2021-04-03 04:10:37 +00:00
{% if port_scanner == 'active' %}
2021-08-02 08:19:22 +00:00
< span id = "portscanner_enable_status-{{p.server_id}}" class = "serverUp server-status" title = "Port scanner is enabled and service is UP" > < / span >
2021-04-03 04:10:37 +00:00
{% else %}
2021-08-02 08:19:22 +00:00
< span id = "portscanner_enable_status-{{p.server_id}}" class = "serverDown server-status" title = "Port scanner is enabled, but service is DOWN" > < / span >
2021-04-03 04:10:37 +00:00
{% endif %}
2021-08-02 08:19:22 +00:00
{% elif p.server_id == s.0 and p.enabled == 0 %}
< span id = "portscanner_enable_status-{{p.server_id}}" class = "serverNone server-status" title = "Port scanner is disabled" > < / span >
2021-04-03 04:10:37 +00:00
{% endif %}
{% else %}
2021-08-02 08:19:22 +00:00
< span id = "portscanner_enable_status-{{p.server_id}}" class = "serverNone server-status" title = "Port scanner is disabled" > < / span >
2021-04-03 04:10:37 +00:00
{% endif %}
{% endfor %}
2021-08-02 08:19:22 +00:00
{% if s.0 not in port_scanner_settings|map(attribute='server_id') %}
2021-04-03 04:10:37 +00:00
< span id = "portscanner_enable_status-{{s.0}}" class = "serverNone server-status" title = "Port scanner is disabled" > < / span >
{% endif %}
{% if not serv %}
< a href = "/app/portscanner.py?history={{s.2}}" title = "View Port scanner history for {{s.1}}" style = "color: #5d9ceb" > {{s.1}}< / a >
{% else %}
{{s.1}}
{% endif %}
{% if role < = 2 %}
< span class = "server-action" > < / span >
{% endif %}
< / div >
< div class = "server-desc" >
{{s.11}}
< br / >
IP: {{s.2}}
< br / >
Last scan:
{% if count_ports is defined %}
{% for c in count_ports %}
{% if c.0 == s.2 %}
{{c.1.0.1}}
{% endif %}
{% endfor %}
{% endif %}
< br / >
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 %}
< br / >
< / div >
< div class = "server-act-links" id = "server-{{s.0}}" >
{% 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 %}
2021-08-02 08:19:22 +00:00
{% if p.server_id == s.0 %}
2021-04-03 04:10:37 +00:00
{% set disabled = 'false' %}
2021-08-02 08:19:22 +00:00
{% if p.enabled == 0 %}
2021-04-03 04:10:37 +00:00
{% set disabled = 'true' %}
{% endif %}
2021-08-02 08:19:22 +00:00
{% if p.enabled == 1 %}
2021-04-03 04:10:37 +00:00
{{ 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 %}
2021-08-02 08:19:22 +00:00
{% if p.notify == 1 %}
2021-04-03 04:10:37 +00:00
{{ 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 %}
2021-08-02 08:19:22 +00:00
{% if p.history == 1 %}
2021-04-03 04:10:37 +00:00
{{ 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 %}
2021-08-02 08:19:22 +00:00
{% if s.0 not in port_scanner_settings|map(attribute='server_id') %}
2021-04-03 04:10:37 +00:00
{{ 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 %}
< br / >
< button onclick = "scanPorts('{{s.0}}')" title = "Scanning open/filtered ports for the server {{s.1}}" > Run scan< / button >
< / div >
< / div >
{% endfor %}
< / div >
< div class = "add-note addName alert-info" style = "width: inherit; margin-right: 15px; margin-top: 45%" >
2022-07-30 17:00:36 +00:00
Read about Port scanner service in this < a href = "https://roxy-wi.org/services/portscanner" title = "The Port scanner service description" target = "_blank" > article< / a >
2021-04-03 04:10:37 +00:00
< / div >
{% endif %}
< div id = "dialog-confirm" style = "display: none;" >
< p > < span class = "ui-icon ui-icon-alert" style = "float:left; margin:3px 12px 20px 0;" > < / span > Are you sure?< / p >
< / div >
< div id = "show_scans_ports" style = "display: none; padding: 0;" >
< div id = "show_scans_ports_body" > < / div >
< / div >
< script >
function scanPorts(id) {
$.ajax({
url: "options.py",
data: {
scan_ports: id,
token: $('#token').val()
},
type: "POST",
success: function (data) {
data = data.replace(/\s+/g, ' ');
if (data.indexOf('danger') != '-1' || data.indexOf('unique') != '-1' || data.indexOf('error:') != '-1') {
toastr.error(data);
} else {
toastr.clear();
$("#show_scans_ports_body").html(data);
$("#show_scans_ports" ).dialog({
resizable: false,
height: "auto",
width: 360,
modal: true,
title: "Opened ports",
buttons: {
Close: function() {
$( this ).dialog( "close" );
$("#show_scans_ports_body").html('');
}
}
});
}
}
} );
}
$( ".server-act-links" ).change(function() {
var id = $(this).attr('id').split('-');
updatePortScannerSettings(id[1])
});
function updatePortScannerSettings(id) {
var portscanner_enabled = 0;
var portscanner_notify = 0;
var portscanner_history = 0;
if ($('#portscanner_enable-'+id).is(':checked')) {
portscanner_enabled = '1';
$('#portscanner_enable_status-'+id).removeClass('serverDown');
$('#portscanner_enable_status-'+id).removeClass('serverNone');
$('#portscanner_enable_status-'+id).addClass('serverUp');
}
if (portscanner_enabled == '0') {
$('#portscanner_enable_status-'+id).removeClass('serverDown');
$('#portscanner_enable_status-'+id).removeClass('serverUp');
$('#portscanner_enable_status-'+id).addClass('serverNone');
}
if ($('#portscanner_notify-'+id).is(':checked')) {
portscanner_notify = '1';
}
if ($('#portscanner_history-'+id).is(':checked')) {
portscanner_history = '1';
}
if (portscanner_enabled == '1') {
$('#portscanner_notify-'+id).checkboxradio('enable');
$('#portscanner_history-'+id).checkboxradio('enable');
}
if (portscanner_enabled == '0') {
$('#portscanner_notify-'+id).checkboxradio('disable');
$('#portscanner_history-'+id).checkboxradio('disable');
}
$.ajax( {
url: "options.py",
data: {
portscanner_history_server_id: id,
portscanner_enabled: portscanner_enabled,
portscanner_notify: portscanner_notify,
portscanner_history: portscanner_history,
token: $('#token').val()
},
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error:') != '-1') {
toastr.error(data);
} else {
toastr.clear();
$("#server-"+id).addClass( "update", 1000 );
setTimeout(function() {
$( "#server-"+id).removeClass( "update" );
}, 2500 );
}
}
} );
}
< / script >
2022-04-29 10:28:48 +00:00
{% endif %}
2021-04-03 04:10:37 +00:00
{% endblock %}