mirror of https://github.com/Aidaho12/haproxy-wi
parent
9b17c24b55
commit
4d0d94fca9
|
@ -1104,6 +1104,76 @@ def update_db_v_5_0_1(**kwargs):
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
|
def update_db_v_5_1_0_11(**kwargs):
|
||||||
|
con, cur = get_cur()
|
||||||
|
sql = """CREATE TABLE IF NOT EXISTS port_scanner_settings (
|
||||||
|
server_id INTEGER NOT NULL,
|
||||||
|
user_group_id INTEGER NOT NULL,
|
||||||
|
enabled INTEGER NOT NULL,
|
||||||
|
notify INTEGER NOT NULL,
|
||||||
|
history INTEGER NOT NULL,
|
||||||
|
UNIQUE(server_id)
|
||||||
|
); """
|
||||||
|
try:
|
||||||
|
cur.execute(sql)
|
||||||
|
con.commit()
|
||||||
|
except sqltool.Error as e:
|
||||||
|
if kwargs.get('silent') != 1:
|
||||||
|
if e.args[0] == 'duplicate column name: version' or e == "1060 (42S21): Duplicate column name 'version' ":
|
||||||
|
print('Updating... DB has been updated to version 5.1.0')
|
||||||
|
else:
|
||||||
|
print("Updating... DB has been updated to version 5.1.0")
|
||||||
|
|
||||||
|
cur.close()
|
||||||
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
|
def update_db_v_5_1_0_12(**kwargs):
|
||||||
|
con, cur = get_cur()
|
||||||
|
sql = """CREATE TABLE IF NOT EXISTS port_scanner_ports (
|
||||||
|
`serv` varchar(64),
|
||||||
|
user_group_id INTEGER NOT NULL,
|
||||||
|
port INTEGER NOT NULL,
|
||||||
|
service_name varchar(64),
|
||||||
|
`date` DATETIME default '0000-00-00 00:00:00'
|
||||||
|
); """
|
||||||
|
try:
|
||||||
|
cur.execute(sql)
|
||||||
|
con.commit()
|
||||||
|
except sqltool.Error as e:
|
||||||
|
if kwargs.get('silent') != 1:
|
||||||
|
if e.args[0] == 'duplicate column name: version' or e == "1060 (42S21): Duplicate column name 'version' ":
|
||||||
|
print('Updating... DB has been updated to version 5.1.0')
|
||||||
|
else:
|
||||||
|
print("Updating... DB has been updated to version 5.1.0")
|
||||||
|
|
||||||
|
cur.close()
|
||||||
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
|
def update_db_v_5_1_0_13(**kwargs):
|
||||||
|
con, cur = get_cur()
|
||||||
|
sql = """CREATE TABLE IF NOT EXISTS port_scanner_history (
|
||||||
|
`serv` varchar(64),
|
||||||
|
port INTEGER NOT NULL,
|
||||||
|
status varchar(64),
|
||||||
|
service_name varchar(64),
|
||||||
|
`date` DATETIME default '0000-00-00 00:00:00'
|
||||||
|
); """
|
||||||
|
try:
|
||||||
|
cur.execute(sql)
|
||||||
|
con.commit()
|
||||||
|
except sqltool.Error as e:
|
||||||
|
if kwargs.get('silent') != 1:
|
||||||
|
if e.args[0] == 'duplicate column name: version' or e == "1060 (42S21): Duplicate column name 'version' ":
|
||||||
|
print('Updating... DB has been updated to version 5.1.0')
|
||||||
|
else:
|
||||||
|
print("Updating... DB has been updated to version 5.1.0")
|
||||||
|
|
||||||
|
cur.close()
|
||||||
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
def update_db_v_5_1_0(**kwargs):
|
def update_db_v_5_1_0(**kwargs):
|
||||||
con, cur = get_cur()
|
con, cur = get_cur()
|
||||||
sql = """
|
sql = """
|
||||||
|
@ -1151,7 +1221,7 @@ def update_db_v_5_1_0_1(**kwargs):
|
||||||
|
|
||||||
def update_ver():
|
def update_ver():
|
||||||
con, cur = get_cur()
|
con, cur = get_cur()
|
||||||
sql = """update version set version = '5.0.2.0'; """
|
sql = """update version set version = '5.1.0.0'; """
|
||||||
try:
|
try:
|
||||||
cur.execute(sql)
|
cur.execute(sql)
|
||||||
con.commit()
|
con.commit()
|
||||||
|
@ -1187,6 +1257,9 @@ def update_all():
|
||||||
update_db_v_4_5_9()
|
update_db_v_4_5_9()
|
||||||
update_db_v_5()
|
update_db_v_5()
|
||||||
update_db_v_51()
|
update_db_v_51()
|
||||||
|
update_db_v_5_1_0_11()
|
||||||
|
update_db_v_5_1_0_12()
|
||||||
|
update_db_v_5_1_0_13()
|
||||||
update_db_v_5_0_1()
|
update_db_v_5_0_1()
|
||||||
update_db_v_5_1_0()
|
update_db_v_5_1_0()
|
||||||
update_db_v_5_1_0_1()
|
update_db_v_5_1_0_1()
|
||||||
|
@ -1220,6 +1293,9 @@ def update_all_silent():
|
||||||
update_db_v_5(silent=1)
|
update_db_v_5(silent=1)
|
||||||
update_db_v_51(silent=1)
|
update_db_v_51(silent=1)
|
||||||
update_db_v_5_0_1(silent=1)
|
update_db_v_5_0_1(silent=1)
|
||||||
|
update_db_v_5_1_0_11(silent=1)
|
||||||
|
update_db_v_5_1_0_12(silent=1)
|
||||||
|
update_db_v_5_1_0_13(silent=1)
|
||||||
update_db_v_5_1_0(silent=1)
|
update_db_v_5_1_0(silent=1)
|
||||||
update_db_v_5_1_0_1(silent=1)
|
update_db_v_5_1_0_1(silent=1)
|
||||||
update_ver()
|
update_ver()
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import funct
|
||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
|
template = env.get_template('nettools.html')
|
||||||
|
form = funct.form
|
||||||
|
|
||||||
|
print('Content-type: text/html\n')
|
||||||
|
funct.check_login()
|
||||||
|
|
||||||
|
try:
|
||||||
|
user, user_id, role, token, servers = funct.get_users_params(virt=1)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
output_from_parsed_template = template.render(h2=1, autorefresh=0,
|
||||||
|
title="Network tools",
|
||||||
|
role=role,
|
||||||
|
user=user,
|
||||||
|
servers=servers,
|
||||||
|
versions=funct.versions(),
|
||||||
|
token=token)
|
||||||
|
print(output_from_parsed_template)
|
115
app/options.py
115
app/options.py
|
@ -1115,11 +1115,9 @@ if form.getvalue('install_grafana'):
|
||||||
'success: Grafana and Prometheus servers were installed. You can find Grafana on http://' + socket.gethostname() + ':3000<br>')
|
'success: Grafana and Prometheus servers were installed. You can find Grafana on http://' + socket.gethostname() + ':3000<br>')
|
||||||
else:
|
else:
|
||||||
for l in output:
|
for l in output:
|
||||||
if "FAILED" in l:
|
if "Traceback" in l or "FAILED" in l:
|
||||||
try:
|
try:
|
||||||
l = l.split(':')[1]
|
print(l)
|
||||||
l = l.split('"')[1]
|
|
||||||
print(l + "<br>")
|
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
print(output)
|
print(output)
|
||||||
|
@ -2342,6 +2340,115 @@ if form.getvalue('geoip_install'):
|
||||||
|
|
||||||
os.system("rm -f %s" % script)
|
os.system("rm -f %s" % script)
|
||||||
|
|
||||||
|
if form.getvalue('nettools_icmp_server_from'):
|
||||||
|
server_from = form.getvalue('nettools_icmp_server_from')
|
||||||
|
server_to = form.getvalue('nettools_icmp_server_to')
|
||||||
|
action = form.getvalue('nettools_action')
|
||||||
|
stderr = ''
|
||||||
|
|
||||||
|
if action == 'nettools_ping':
|
||||||
|
action_for_sending = 'ping -c 4 -W 1 -s 56 -O '
|
||||||
|
elif action == 'nettools_trace':
|
||||||
|
action_for_sending = 'tracepath -m 10 '
|
||||||
|
|
||||||
|
action_for_sending = action_for_sending + server_to
|
||||||
|
|
||||||
|
if server_from == 'localhost':
|
||||||
|
output, stderr = funct.subprocess_execute(action_for_sending)
|
||||||
|
else:
|
||||||
|
action_for_sending = [action_for_sending]
|
||||||
|
output = funct.ssh_command(server_from, action_for_sending, raw=1)
|
||||||
|
|
||||||
|
if stderr != '':
|
||||||
|
print('error: '+stderr)
|
||||||
|
sys.exit()
|
||||||
|
for i in output:
|
||||||
|
if i == ' ':
|
||||||
|
continue
|
||||||
|
i = i.strip()
|
||||||
|
print(i + '<br>')
|
||||||
|
|
||||||
|
if form.getvalue('nettools_telnet_server_from'):
|
||||||
|
server_from = form.getvalue('nettools_telnet_server_from')
|
||||||
|
server_to = form.getvalue('nettools_telnet_server_to')
|
||||||
|
port_to = form.getvalue('nettools_telnet_port_to')
|
||||||
|
stderr = ''
|
||||||
|
|
||||||
|
if server_from == 'localhost':
|
||||||
|
action_for_sending = 'echo "exit"|nc ' + server_to + ' ' + port_to + ' -t -w 1s'
|
||||||
|
output, stderr = funct.subprocess_execute(action_for_sending)
|
||||||
|
else:
|
||||||
|
action_for_sending = ['echo "exit"|nc ' + server_to + ' ' + port_to + ' -t -w 1s']
|
||||||
|
output = funct.ssh_command(server_from, action_for_sending, raw=1)
|
||||||
|
|
||||||
|
if stderr != '':
|
||||||
|
print('error: '+stderr[5:-1])
|
||||||
|
sys.exit()
|
||||||
|
count_string = 0
|
||||||
|
for i in output:
|
||||||
|
if i == ' ':
|
||||||
|
continue
|
||||||
|
i = i.strip()
|
||||||
|
if i == 'Ncat: Connection timed out.':
|
||||||
|
print('error: ' + i[5:-1])
|
||||||
|
break
|
||||||
|
print(i + '<br>')
|
||||||
|
count_string += 1
|
||||||
|
if count_string > 1:
|
||||||
|
break
|
||||||
|
|
||||||
|
if form.getvalue('nettools_nslookup_server_from'):
|
||||||
|
server_from = form.getvalue('nettools_nslookup_server_from')
|
||||||
|
dns_name = form.getvalue('nettools_nslookup_name')
|
||||||
|
record_type = form.getvalue('nettools_nslookup_record_type')
|
||||||
|
stderr = ''
|
||||||
|
|
||||||
|
action_for_sending = 'dig ' + dns_name + ' ' + record_type + ' |grep -e "SERVER\|' + dns_name + '"'
|
||||||
|
|
||||||
|
if server_from == 'localhost':
|
||||||
|
output, stderr = funct.subprocess_execute(action_for_sending)
|
||||||
|
else:
|
||||||
|
action_for_sending = [action_for_sending]
|
||||||
|
output = funct.ssh_command(server_from, action_for_sending, raw=1)
|
||||||
|
|
||||||
|
if stderr != '':
|
||||||
|
print('error: '+stderr[5:-1])
|
||||||
|
sys.exit()
|
||||||
|
count_string = 0
|
||||||
|
print('<b>There are the next records for ' + dns_name + ' domain:</b> <br />')
|
||||||
|
for i in output:
|
||||||
|
if 'dig: command not found.' in i:
|
||||||
|
print('error: Install bind-utils before using NSLookup')
|
||||||
|
break
|
||||||
|
if ';' in i and ';; SERVER:' not in i:
|
||||||
|
continue
|
||||||
|
if 'SOA' in i and record_type != 'SOA':
|
||||||
|
print('<b>There are not any records for this type')
|
||||||
|
break
|
||||||
|
if ';; SERVER:' in i:
|
||||||
|
i = i[10:-1]
|
||||||
|
print('<br><b>From NS server:</b><br>')
|
||||||
|
i = i.strip()
|
||||||
|
print(i + '<br>')
|
||||||
|
count_string += 1
|
||||||
|
|
||||||
|
if form.getvalue('portscanner_history_server_id'):
|
||||||
|
server_id = form.getvalue('portscanner_history_server_id')
|
||||||
|
enabled = form.getvalue('portscanner_enabled')
|
||||||
|
notify = form.getvalue('portscanner_notify')
|
||||||
|
history = form.getvalue('portscanner_history')
|
||||||
|
|
||||||
|
servers = sql.select_servers(id=server_id)
|
||||||
|
|
||||||
|
for s in servers:
|
||||||
|
user_group_id = s[3]
|
||||||
|
|
||||||
|
if sql.insert_port_scanner_settings(server_id, user_group_id, enabled, notify, history):
|
||||||
|
print('ok')
|
||||||
|
else:
|
||||||
|
if sql.update_port_scanner_settings(server_id, user_group_id, enabled, notify, history):
|
||||||
|
print('ok')
|
||||||
|
|
||||||
if form.getvalue('show_versions'):
|
if form.getvalue('show_versions'):
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('ovw.html')
|
template = env.get_template('ovw.html')
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
print('Content-type: text/html\n')
|
||||||
|
|
||||||
if create_db.check_db():
|
if create_db.check_db():
|
||||||
if create_db.create_table():
|
if create_db.create_table():
|
||||||
create_db.update_all()
|
create_db.update_all()
|
||||||
|
@ -79,6 +80,8 @@ try:
|
||||||
keep_alive, stderr = funct.subprocess_execute(cmd)
|
keep_alive, stderr = funct.subprocess_execute(cmd)
|
||||||
cmd = "systemctl status smon |grep Act |awk '{print $2}'"
|
cmd = "systemctl status smon |grep Act |awk '{print $2}'"
|
||||||
smon, stderr = funct.subprocess_execute(cmd)
|
smon, stderr = funct.subprocess_execute(cmd)
|
||||||
|
cmd = "systemctl status portscanner |grep Act |awk '{print $2}'"
|
||||||
|
port_scanner, stderr = funct.subprocess_execute(cmd)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
role = ''
|
role = ''
|
||||||
|
@ -102,6 +105,7 @@ except Exception as e:
|
||||||
is_metrics_worker = ''
|
is_metrics_worker = ''
|
||||||
token = ''
|
token = ''
|
||||||
|
|
||||||
|
|
||||||
template = template.render(h2=1,
|
template = template.render(h2=1,
|
||||||
autorefresh=1,
|
autorefresh=1,
|
||||||
title="Overview",
|
title="Overview",
|
||||||
|
@ -117,6 +121,7 @@ template = template.render(h2=1,
|
||||||
checker_worker=''.join(checker_worker),
|
checker_worker=''.join(checker_worker),
|
||||||
keep_alive=''.join(keep_alive),
|
keep_alive=''.join(keep_alive),
|
||||||
smon=''.join(smon),
|
smon=''.join(smon),
|
||||||
|
port_scanner=''.join(port_scanner),
|
||||||
grafana=''.join(grafana),
|
grafana=''.join(grafana),
|
||||||
prometheus=''.join(prometheus),
|
prometheus=''.join(prometheus),
|
||||||
haproxy_wi_log_id=funct.haproxy_wi_log(log_id=1, file="haproxy-wi-", with_date=1),
|
haproxy_wi_log_id=funct.haproxy_wi_log(log_id=1, file="haproxy-wi-", with_date=1),
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import funct
|
||||||
|
import sql
|
||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
|
template = env.get_template('portscanner.html')
|
||||||
|
form = funct.form
|
||||||
|
serv = form.getvalue('history')
|
||||||
|
|
||||||
|
print('Content-type: text/html\n')
|
||||||
|
funct.check_login()
|
||||||
|
|
||||||
|
try:
|
||||||
|
user, user_id, role, token, servers = funct.get_users_params(virt=1)
|
||||||
|
except Exception as e:
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
|
if serv:
|
||||||
|
title = 'Port scanner history for ' + serv
|
||||||
|
port_scanner_settings = sql.select_port_scanner_history(serv)
|
||||||
|
history = '1'
|
||||||
|
port_scanner = ''
|
||||||
|
port_scanner_stderr = ''
|
||||||
|
count_ports = ''
|
||||||
|
else:
|
||||||
|
history = ''
|
||||||
|
title = 'Port scanner dashboard'
|
||||||
|
user_group = funct.get_user_group(id=1)
|
||||||
|
port_scanner_settings = sql.select_port_scanner_settings(user_group)
|
||||||
|
if not port_scanner_settings:
|
||||||
|
port_scanner_settings = ''
|
||||||
|
count_ports = ''
|
||||||
|
else:
|
||||||
|
count_ports = list()
|
||||||
|
for s in servers:
|
||||||
|
count_ports_from_sql = sql.select_count_opened_ports(s[2])
|
||||||
|
i = (s[2], count_ports_from_sql)
|
||||||
|
count_ports.append(i)
|
||||||
|
|
||||||
|
cmd = "systemctl status portscanner |grep Act |awk '{print $2}'"
|
||||||
|
port_scanner, port_scanner_stderr = funct.subprocess_execute(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
output_from_parsed_template = template.render(h2=1, autorefresh=0,
|
||||||
|
title=title,
|
||||||
|
role=role,
|
||||||
|
user=user,
|
||||||
|
servers=servers,
|
||||||
|
port_scanner_settings=port_scanner_settings,
|
||||||
|
count_ports=count_ports,
|
||||||
|
history=history,
|
||||||
|
port_scanner=''.join(port_scanner),
|
||||||
|
port_scanner_stderr=port_scanner_stderr,
|
||||||
|
token=token)
|
||||||
|
print(output_from_parsed_template)
|
|
@ -25,7 +25,7 @@ output_from_parsed_template = template.render(title="Servers: ",
|
||||||
user=user,
|
user=user,
|
||||||
users=sql.select_users(group=user_group),
|
users=sql.select_users(group=user_group),
|
||||||
groups=sql.select_groups(),
|
groups=sql.select_groups(),
|
||||||
servers=sql.get_dick_permit(virt=1, disable=0),
|
servers=sql.get_dick_permit(virt=1, disable=0, only_group=1),
|
||||||
roles=sql.select_roles(),
|
roles=sql.select_roles(),
|
||||||
masters=sql.select_servers(get_master_servers=1, uuid=user_id.value),
|
masters=sql.select_servers(get_master_servers=1, uuid=user_id.value),
|
||||||
group=user_group,
|
group=user_group,
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="p_menu">
|
<li class="p_menu">
|
||||||
<a title="Simple monitoring network ports" class="stats">Monitoring</a>
|
<a title="Monitoring tools" class="stats">Monitoring</a>
|
||||||
<ul class="v_menu">
|
<ul class="v_menu">
|
||||||
<li><a href="/app/smon.py?action=view" title="SMON Dashboard" class="overview-link head-submenu">SMON Dashboard</a></li>
|
<li><a href="/app/smon.py?action=view" title="SMON Dashboard" class="overview-link head-submenu">SMON Dashboard</a></li>
|
||||||
<li><a href="/app/smon.py?action=history" title="SMON History" class="lists head-submenu">SMON History</a></li>
|
<li><a href="/app/smon.py?action=history" title="SMON History" class="lists head-submenu">SMON History</a></li>
|
||||||
|
@ -105,6 +105,8 @@
|
||||||
<li><a href="/app/smon.py?action=add" title="SMON admin panel" class="edit head-submenu">SMON Admin panel</a></li>
|
<li><a href="/app/smon.py?action=add" title="SMON admin panel" class="edit head-submenu">SMON Admin panel</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><a href="/app/smon.py?action=checker_history" title="Checker History" class="lists head-submenu">Checker History</a></li>
|
<li><a href="/app/smon.py?action=checker_history" title="Checker History" class="lists head-submenu">Checker History</a></li>
|
||||||
|
<li><a href="/app/portscanner.py" title="Port scanner" class="port-scanner head-submenu">Port scanner</a></li>
|
||||||
|
<li><a href="/app/nettools.py" title="Network tools" class="net-tools head-submenu">Network tools</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{% if role <= 2 %}
|
{% if role <= 2 %}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<link href="/inc/table.css" rel="stylesheet" type="text/css">
|
||||||
|
<script type="text/javascript" charset="utf8" src="/inc/dataTables.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#scan_history').on( 'page.dt' )
|
||||||
|
.DataTable( {
|
||||||
|
"order": [[ "5", "asc" ]],
|
||||||
|
"pageLength": 25,
|
||||||
|
"columnDefs": [
|
||||||
|
{
|
||||||
|
"searchable": false,
|
||||||
|
"orderable": false,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
<table class="overview hover order-column display compact" id="scan_history">
|
||||||
|
<thead>
|
||||||
|
<tr class="overviewHead">
|
||||||
|
<th class="padding10" style="width: 10%; padding-left: 10px;">Status</th>
|
||||||
|
<th>Host</th>
|
||||||
|
<th>Port</th>
|
||||||
|
<th>Possible service name</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Time</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% if port_scanner_settings != '' %}
|
||||||
|
{% for t in port_scanner_settings %}
|
||||||
|
<tr>
|
||||||
|
<td class="padding10" style="width: 10%; padding: 7px 7px 7px 10px;">
|
||||||
|
{% if t.2 == 'opened' %}
|
||||||
|
{% set color = '#5ad05a' %}
|
||||||
|
{% else %}
|
||||||
|
{% set color = '#be2424' %}
|
||||||
|
{% endif %}
|
||||||
|
<span style="color: {{color}};"><b>{{t.2 |upper}}</b></span>
|
||||||
|
</td>
|
||||||
|
<td>{{t.0}}</td>
|
||||||
|
<td>{{t.1}}</td>
|
||||||
|
<td>{{t.3}}</td>
|
||||||
|
<td>{{t.4.split(' ')[0]}}
|
||||||
|
</td>
|
||||||
|
<td>{{t.4.split(' ')[1]}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<span class="alert alert-warning" style="margin-bottom: 0px;">Table is empty</span>
|
||||||
|
{% endif %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -0,0 +1,219 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
{% from 'include/input_macros.html' import input, checkbox, select %}
|
||||||
|
{% if servers|length == 0 %}
|
||||||
|
{% include 'include/getstarted.html' %}
|
||||||
|
{% else %}
|
||||||
|
<style>
|
||||||
|
.ping_pre {
|
||||||
|
display: block;
|
||||||
|
padding: 9.5px;
|
||||||
|
margin: 0 0 10px;
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
color: #333;
|
||||||
|
word-break: break-all;
|
||||||
|
word-wrap: break-word;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<form name="nettools_icmp_form" id="nettools_icmp_form" method="post" action="options.py">
|
||||||
|
<table class="overview">
|
||||||
|
<caption><h3>ICMP</h3></caption>
|
||||||
|
<tr class="overviewHead">
|
||||||
|
<th class="padding10 first-collumn">From server</th>
|
||||||
|
<th class="padding10 first-collumn">To server</th>
|
||||||
|
<th class="padding10 first-collumn"></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
<select autofocus required name="nettools_icmp_server_from" id="nettools_icmp_server_from">
|
||||||
|
<option disabled selected>Choose server</option>
|
||||||
|
<option value="localhost">HAProxy-WI</option>
|
||||||
|
{% for server in servers %}
|
||||||
|
<option value="{{ server.2 }}">{{ server.1 }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
{{ input('nettools_icmp_server_to', title='Enter IP or Name') }}
|
||||||
|
{{ input('token', value=token, type='hidden') }}
|
||||||
|
</td>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
<button type="submit" title="Run Ping" id="nettools_ping" name="nettools_ping" value="nettools_ping">Ping</button>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="submit" title="Run Traceroute" id="nettools_trace" name="nettools_trace" value="nettools_trace">Traceroute</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<form name="nettools_telnet_form" id="nettools_telnet_form" method="post" action="options.py">
|
||||||
|
<table class="overview">
|
||||||
|
<caption><h3>Check port</h3></caption>
|
||||||
|
<tr class="overviewHead">
|
||||||
|
<th class="padding10 first-collumn">From server</th>
|
||||||
|
<th class="padding10 first-collumn">To server</th>
|
||||||
|
<th class="padding10 first-collumn">Port</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
<select autofocus required name="nettools_telnet_server_from" id="nettools_telnet_server_from">
|
||||||
|
<option disabled selected>Choose server</option>
|
||||||
|
<option value="localhost">HAProxy-WI</option>
|
||||||
|
{% for server in servers %}
|
||||||
|
<option value="{{ server.2 }}">{{ server.1 }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
{{ input('nettools_telnet_server_to', title='Enter IP or Name') }}
|
||||||
|
{{ input('token', value=token, type='hidden') }}
|
||||||
|
</td>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
{{ input('nettools_telnet_port_to', title='Enter port', type='number', style='width: 60px;') }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="submit" title="Run Telnet" id="nettools_telnet" name="nettools_telnet" value="nettools_telnet">Connect</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<form name="nettools_nslookup_form" id="nettools_nslookup_form" method="post" action="options.py">
|
||||||
|
<table class="overview">
|
||||||
|
<caption><h3>NSLookup</h3></caption>
|
||||||
|
<tr class="overviewHead">
|
||||||
|
<th class="padding10 first-collumn">From server</th>
|
||||||
|
<th class="padding10 first-collumn">Record type</th>
|
||||||
|
<th class="padding10 first-collumn">DNS name</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
<select autofocus required name="nettools_nslookup_server_from" id="nettools_nslookup_server_from">
|
||||||
|
<option disabled selected>Choose server</option>
|
||||||
|
<option value="localhost">HAProxy-WI</option>
|
||||||
|
{% for server in servers %}
|
||||||
|
<option value="{{ server.2 }}">{{ server.1 }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
{% set values = dict() %}
|
||||||
|
{% set values = {'A':'A','AAA':'AAA', 'CNAME':'CNAME', 'MX':'MX', 'TXT':'TXT', 'PTR':'PTR', 'SRV':'SRV',
|
||||||
|
'SOA':'SOA', 'CAA':'CAA'} %}
|
||||||
|
{{ select('nettools_nslookup_record_type', values=values, selected='A', required='required') }}
|
||||||
|
</td>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
{{ input('nettools_nslookup_name', title='Enter a DNS name') }}
|
||||||
|
{{ input('token', value=token, type='hidden') }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="submit" title="Run Telnet" id="nettools_nslookup" name="nettools_nslookup" value="nettools_nslookup">Check</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<div id="ajax-nettools" style="padding: 20px;"></div>
|
||||||
|
<script>
|
||||||
|
$("#nettools_nslookup_record_type" ).selectmenu({
|
||||||
|
width: 175
|
||||||
|
});
|
||||||
|
$( "#nettools_telnet_form" ).on("click", ":submit", function(e){
|
||||||
|
$('#ajax-nettools').html('');
|
||||||
|
var frm = $('#nettools_telnet_form');
|
||||||
|
if($('#nettools_telnet_server_from option:selected').val() == 'Choose server') {
|
||||||
|
toastr.warning('Choose a server From');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($('#nettools_telnet_server_to').val() == '') {
|
||||||
|
toastr.warning('Choose a server To');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($('#nettools_telnet_port_to').val() == '') {
|
||||||
|
toastr.warning('Enter a port To');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: frm.attr('action'),
|
||||||
|
data: frm.serialize(),
|
||||||
|
type: frm.attr('method'),
|
||||||
|
success: function( data ) {
|
||||||
|
data = data.replace('\n', '<br>');
|
||||||
|
if (data.indexOf('error: ') != '-1' || data.indexOf('Fatal') != '-1' || data.indexOf('Error(s)') != '-1') {
|
||||||
|
$('#ajax-nettools').html('<div class="alert alert-warning">'+data+'</div>');
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
if (data.indexOf('') != '-1') {
|
||||||
|
$('#ajax-nettools').html('<div class="alert alert-success"><b>Connection has been successful</b></div>');
|
||||||
|
} else {
|
||||||
|
$('#ajax-nettools').html('<div class="alert alert-success"><b>Connection has been successful</b>:<br /><br />'+data+'</div>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
$( "#nettools_nslookup_form" ).on("click", ":submit", function(e){
|
||||||
|
$('#ajax-nettools').html('');
|
||||||
|
var frm = $('#nettools_nslookup_form');
|
||||||
|
if($('#nettools_nslookup_server_from option:selected').val() == 'Choose server') {
|
||||||
|
toastr.warning('Choose a server From');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($('#nettools_nslookup_name').val() == '') {
|
||||||
|
toastr.warning('Enter a DNS name');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: frm.attr('action'),
|
||||||
|
data: frm.serialize(),
|
||||||
|
type: frm.attr('method'),
|
||||||
|
success: function( data ) {
|
||||||
|
data = data.replace('\n', '<br>');
|
||||||
|
if (data.indexOf('error: ') != '-1' || data.indexOf('Fatal') != '-1' || data.indexOf('Error(s)') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$('#ajax-nettools').html('<div class="ping_pre">'+data+'</div>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
$( "#nettools_icmp_form" ).on("click", ":submit", function(e){
|
||||||
|
$('#ajax-nettools').html('');
|
||||||
|
var frm = $('#nettools_icmp_form');
|
||||||
|
if($('#nettools_icmp_server_from option:selected').val() == 'Choose server') {
|
||||||
|
toastr.warning('Choose a server From');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($('#nettools_icmp_server_to').val() == '') {
|
||||||
|
toastr.warning('Enter a server To');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: frm.attr('action'),
|
||||||
|
data: frm.serialize() + "&nettools_action=" + $(this).val(),
|
||||||
|
type: frm.attr('method'),
|
||||||
|
success: function( data ) {
|
||||||
|
data = data.replace('\n', '<br>');
|
||||||
|
if (data.indexOf('error: ') != '-1' || data.indexOf('Fatal') != '-1' || data.indexOf('Error(s)') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$('#ajax-nettools').html('<div class="ping_pre">'+data+'</div>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
|
@ -259,6 +259,26 @@
|
||||||
Prometheus
|
Prometheus
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<td>
|
||||||
|
{% if port_scanner == 'active' %}
|
||||||
|
<span class="serverUp server-status" title="Port scanner is started"></span>
|
||||||
|
<a href="/app/portscanner.py" title="Port scanner Dashboard" class="logs_link">
|
||||||
|
Port scanner
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
{% if port_scanner == 'inactive' or port_scanner== 'failed' %}
|
||||||
|
<span class="serverDown server-status" title="Port scanner is stopped"></span>
|
||||||
|
<a href="/app/users.py#services" title="Start Port scanner - HAProxy-WI service" class="logs_link">
|
||||||
|
Port scanner
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<span title="Port scanner is not installed"><span class="serverNone server-status"></span></span>
|
||||||
|
<a href="https://haproxy-wi.org/services.py?service=port_scanner" title="Port scanner" target="_blank" class="logs_link">
|
||||||
|
Port scanner
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{% if role <= 2 %}
|
{% if role <= 2 %}
|
||||||
|
|
|
@ -0,0 +1,243 @@
|
||||||
|
{% 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>
|
||||||
|
{% if history %}
|
||||||
|
{% include 'include/port_scan_history.html' %}
|
||||||
|
{% elif port_scanner_stderr != '' %}
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<br />
|
||||||
|
<h3>You do not have installed Port scanner service. Read <a href="https://haproxy-wi.org/services.py?service=port_scanner"
|
||||||
|
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 %}
|
||||||
|
<div id="div-server-{{s.0}}" class="div-server-hapwi">
|
||||||
|
<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 %}
|
||||||
|
{% if p.0 == s.0 and p.2 == 1 %}
|
||||||
|
{% if port_scanner == 'active' %}
|
||||||
|
<span id="portscanner_enable_status-{{p.0}}" class="serverUp server-status" title="Port scanner is enabled and service is UP"></span>
|
||||||
|
{% else %}
|
||||||
|
<span id="portscanner_enable_status-{{p.0}}" class="serverDown server-status" title="Port scanner is enabled, but service is DOWN"></span>
|
||||||
|
{% endif %}
|
||||||
|
{% elif p.0 == s.0 and p.2 == 0 %}
|
||||||
|
<span id="portscanner_enable_status-{{p.0}}" class="serverNone server-status" title="Port scanner is disabled"></span>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<span id="portscanner_enable_status-{{p.0}}" class="serverNone server-status" title="Port scanner is disabled"></span>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if s.0 not in port_scanner_settings|map(attribute=0) %}
|
||||||
|
<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 %}
|
||||||
|
{% if p.0 == s.0 %}
|
||||||
|
{% set disabled = 'false' %}
|
||||||
|
{% if p.2 == 0 %}
|
||||||
|
{% set disabled = 'true' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if p.2 == 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.3 == 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.4 == 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=0) %}
|
||||||
|
{{ 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%">
|
||||||
|
Read about Port scanner service in this <a href="https://haproxy-wi.org/services.py?service=port_scanner" title="The Port scanner service description" target="_blank">article</a>
|
||||||
|
</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>
|
||||||
|
{% endblock %}
|
|
@ -311,3 +311,13 @@
|
||||||
.note-symbol .question-circle {
|
.note-symbol .question-circle {
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
.port-scanner::before {
|
||||||
|
display: none;
|
||||||
|
font-family: "Font Awesome 5 Solid";
|
||||||
|
content: "\f796";
|
||||||
|
}
|
||||||
|
.net-tools::before {
|
||||||
|
display: none;
|
||||||
|
font-family: "Font Awesome 5 Solid";
|
||||||
|
content: "\f7d9";
|
||||||
|
}
|
|
@ -622,6 +622,7 @@ function viewLogs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$( function() {
|
$( function() {
|
||||||
|
NProgress.configure({showSpinner: false});
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
|
@ -648,6 +649,7 @@ $( function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
NProgress.configure({showSpinner: true});
|
||||||
$('a').click(function(e) {
|
$('a').click(function(e) {
|
||||||
try {
|
try {
|
||||||
var cur_path = window.location.pathname;
|
var cur_path = window.location.pathname;
|
||||||
|
|
Loading…
Reference in New Issue