Maintaining

Changing the layout of maintenance page, fixing some bugs, add a function to disable the network scan (just for fun), update the readme
This commit is contained in:
leiweibau
2022-06-24 22:46:16 +02:00
parent 5ea6764f40
commit cbf55ca58b
8 changed files with 382 additions and 266 deletions

View File

@@ -34,6 +34,7 @@ import csv
#===============================================================================
PIALERT_BACK_PATH = os.path.dirname(os.path.abspath(__file__))
PIALERT_PATH = PIALERT_BACK_PATH + "/.."
STOPARPSCAN = PIALERT_PATH + "/db/setting_stoparpscan"
if (sys.version_info > (3,0)):
exec(open(PIALERT_PATH + "/config/version.conf").read())
@@ -81,8 +82,10 @@ def main ():
res = update_devices_MAC_vendors()
elif cycle == 'update_vendors_silent':
res = update_devices_MAC_vendors('-s')
else :
elif os.path.exists(STOPARPSCAN) == False :
res = scan_network()
elif os.path.exists(STOPARPSCAN) == True :
res = 0
# Check error
if res != 0 :
@@ -457,7 +460,6 @@ def execute_arpscan (pRetries):
# Default arp-scan
# arpscan_args = ['sudo', 'arp-scan', SCAN_SUBNETS, '--ignoredups', '--retry=' + str(pRetries)]
# print (arpscan_args)
# TESTING - Fast Scan

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 209 KiB

View File

@@ -664,3 +664,19 @@ input[type="password"]::-webkit-caps-lock-indicator {
.db_info_table_cell:nth-child(1) {background: #272c30}
.db_info_table_cell:nth-child(2) {background: #272c30}
.db_tools_table_cell_a:nth-child(1) {background: #272c30}
.db_tools_table_cell_a:nth-child(2) {background: #272c30}
.db_tools_table_cell_b:nth-child(1) {background: #272c30}
.db_tools_table_cell_b:nth-child(2) {background: #272c30}
.db_info_table {
display: table;
border-spacing: 0em;
font-weight: 400;
font-size: 15px;
width: 95%;
margin: auto;
margin-top: 40px;
margin-bottom: 40px;
border: solid 1px #606060;
}

View File

@@ -11,50 +11,49 @@
Global Variables
----------------------------------------------------------------------------- */
:root {
--color-aqua: #00c0ef;
--color-green: #00a65a;
--color-aqua: #00c0ef;
--color-green: #00a65a;
--color-yellow: #f39c12;
--color-red: #dd4b39;
--color-red: #dd4b39;
}
/* -----------------------------------------------------------------------------
Text Classes
----------------------------------------------------------------------------- */
.text-center {
text-align: center;
text-align: center;
}
.text-right {
text-align: right;
text-align: right;
}
.text-white {
color: white;
color: white;
}
.text-gray50 {
color: #808080;
color: #808080;
}
.text-gray-20 {
color: rgba(192,192,192,20%);
color: rgba(192, 192, 192, 20%);
}
.text-aqua-20 {
color: rgba(0,192,239,20%);
color: rgba(0, 192, 239, 20%);
}
.text-green-20 {
color: rgba(0,166,90,20%);
color: rgba(0, 166, 90, 20%);
}
.text-yellow-20 {
color: rgba(243,156,18,20%);
color: rgba(243, 156, 18, 20%);
}
.text-red-20 {
color: rgba(221,75,57,20%);
color: rgba(221, 75, 57, 20%);
}
.no-border {
@@ -65,94 +64,82 @@
Main Sections
----------------------------------------------------------------------------- */
.content-header {
padding-top: 5px;
padding-top: 5px;
}
.content-header > .breadcrumb {
background: transparent;
.content-header>.breadcrumb {
background: transparent;
}
.content {
padding-bottom: 0px;
padding-bottom: 0px;
}
.box-body {
padding-top: 0px;
padding-bottom: 0px;
padding-top: 0px;
padding-bottom: 0px;
}
.main-footer {
padding: 5px;
color: gray;
padding: 5px;
color: gray;
}
/* -----------------------------------------------------------------------------
Customized Main Menu
----------------------------------------------------------------------------- */
.main-header .logo {
width: 150px;
width: 150px;
}
.main-header > .navbar {
margin-left: 150px;
.main-header>.navbar {
margin-left: 150px;
}
.main-sidebar, .left-side {
width: 150px;
.main-sidebar,
.left-side {
width: 150px;
}
.content-wrapper, .right-side, .main-footer {
margin-left: 150px;
.content-wrapper,
.right-side,
.main-footer {
margin-left: 150px;
}
@media (max-width: 767px) {
.main-header .logo {
width: 100%;
}
.main-header .logo {
width: 100%;
}
.main-header .navbar {
margin: 0;
}
.content-wrapper, .main-footer {
margin-left: 0px;
}
.fix_maintain_section {
min-height: 650px;
}
.main-header .navbar {
margin: 0;
}
.content-wrapper,
.main-footer {
margin-left: 0px;
}
}
@media (max-width: 520px) {
.fix_maintain_section {
min-height: 900px;
}
}
.sidebar-open .content-wrapper, .sidebar-open .main-footer {
.sidebar-open .content-wrapper,
.sidebar-open .main-footer {
-webkit-transform: translate(150px, 0);
-ms-transform: translate(150px, 0);
-o-transform: translate(150px, 0);
transform: translate(150px, 0)
}
.skin-yellow-light .sidebar-menu > li > a:hover {
.skin-yellow-light .sidebar-menu>li>a:hover {
background: #f0f0f0;
border-left-color: rgb(243, 156, 18);
}
.skin-yellow-light .sidebar-menu > li.active > a {
.skin-yellow-light .sidebar-menu>li.active>a {
background: #e0e0e0;
border-left-color: rgb(243, 156, 18);
}
/* -----------------------------------------------------------------------------
Customized Boxes
----------------------------------------------------------------------------- */
@@ -163,185 +150,183 @@
}
.pa-small-box-2 .inner h3 {
margin-left: 0em;
margin-bottom: 1.3em;
margin-left: 0em;
margin-bottom: 1.3em;
}
.pa-small-box-footer {
color: white !important;
font-size: 18px;
color: white !important;
font-size: 18px;
}
/* -------------------------------------------------------------------------- */
.pa-small-box-aqua {
border-top: 3px solid #00c0ef;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
border-top: 3px solid #00c0ef;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
}
.pa-small-box-aqua .inner {
color: #00c0ef;
background-color:#FFFFFF;
color: #00c0ef;
background-color: #FFFFFF;
}
.pa-small-box-aqua .inner h3 {
margin-left: 0.5em;
margin-left: 0.5em;
}
.pa-small-box-aqua .icon {
color: #00c0ef;
color: #00c0ef;
}
/* -------------------------------------------------------------------------- */
.pa-small-box-green {
border-top: 3px solid #00a65a;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
border-top: 3px solid #00a65a;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
}
.pa-small-box-green .inner {
color: #00a65a;
background-color:#FFFFFF;
color: #00a65a;
background-color: #FFFFFF;
}
.pa-small-box-green .inner h3 {
margin-left: 0.5em;
margin-left: 0.5em;
}
.pa-small-box-green .icon {
color: #00a65a;
color: #00a65a;
}
/* -------------------------------------------------------------------------- */
.pa-small-box-yellow {
border-top: 3px solid #f39c12;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
.pa-small-box-yellow {
border-top: 3px solid #f39c12;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
}
.pa-small-box-yellow .inner {
color: #f39c12;
background-color:#FFFFFF;
color: #f39c12;
background-color: #FFFFFF;
}
.pa-small-box-yellow .inner h3 {
margin-left: 0.5em;
margin-left: 0.5em;
}
.pa-small-box-yellow .icon {
color: #f39c12;
color: #f39c12;
}
/* -------------------------------------------------------------------------- */
.pa-small-box-red {
border-top: 3px solid #dd4b39;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
border-top: 3px solid #dd4b39;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
}
.pa-small-box-red .inner {
color: #dd4b39;
background-color:#FFFFFF;
color: #dd4b39;
background-color: #FFFFFF;
}
.pa-small-box-red .inner h3 {
margin-left: 0.5em;
margin-left: 0.5em;
}
.pa-small-box-red .icon {
color: #dd4b39;
color: #dd4b39;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
.pa-small-box-gray {
border-top: 3px solid #a0a0a0;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
border-top: 3px solid #a0a0a0;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
}
.pa-small-box-gray .inner {
color: #a0a0a0;
background-color:#FFFFFF;
color: #a0a0a0;
background-color: #FFFFFF;
}
.pa-small-box-gray .inner h3 {
margin-left: 0.5em;
margin-left: 0.5em;
}
.pa-small-box-gray .icon {
color: #a0a0a0;
color: #a0a0a0;
}
/* -----------------------------------------------------------------------------
Customized Box Borders
----------------------------------------------------------------------------- */
.box.box-aqua {
border-top-color: #00c0ef;
border-top-color: #00c0ef;
}
.box.box-green {
border-top-color: #00a65a;
border-top-color: #00a65a;
}
.box.box-yellow {
border-top-color: #f39c12;
border-top-color: #f39c12;
}
.box.box-red {
border-top-color: #dd4b39;
border-top-color: #dd4b39;
}
/* -----------------------------------------------------------------------------
Custom Border
----------------------------------------------------------------------------- */
.bottom-border-aqua {
border-bottom-color: #00c0ef;
border-bottom-style: solid;
border-bottom-width: 3px
border-bottom-color: #00c0ef;
border-bottom-style: solid;
border-bottom-width: 3px
}
.bottom-border-primary {
border-bottom-color: #3c8dbc;
border-bottom-style: solid;
border-bottom-width: 3px
border-bottom-color: #3c8dbc;
border-bottom-style: solid;
border-bottom-width: 3px
}
/* -----------------------------------------------------------------------------
Customized Tabs
----------------------------------------------------------------------------- */
.nav-tabs-custom {
background: transparent;
background: transparent;
}
.nav > li > a {
.nav>li>a {
position: relative;
display: block;
padding: 10px 10px;
}
/* -----------------------------------------------------------------------------
Customized Menu dropdown
----------------------------------------------------------------------------- */
.dropdown-menu {
max-height: 250px;
overflow-x: hidden;
box-shadow: 0px 3px 20px rgba(0,0,0,0.2);
box-shadow: 0px 3px 20px rgba(0, 0, 0, 0.2);
}
/* -----------------------------------------------------------------------------
Default Table config
----------------------------------------------------------------------------- */
.table > tbody > tr > td {
padding:4px;
.table>tbody>tr>td {
padding: 4px;
}
.table-hover tbody tr:hover td, .table-hover tbody tr:hover th {
background-color: #FFFFD0;
.table-hover tbody tr:hover td,
.table-hover tbody tr:hover th {
background-color: #FFFFD0;
}
.dataTables_info, .dataTables_paginate, .dataTables_length, .dataTables_filter {
color: #B0B0B0;
.dataTables_info,
.dataTables_paginate,
.dataTables_length,
.dataTables_filter {
color: #B0B0B0;
}
/* -----------------------------------------------------------------------------
@@ -353,27 +338,29 @@
}
.pa-btn-delete {
border-color:#ffb060;
background-color:#ffd080;
border-color: #ffb060;
background-color: #ffd080;
}
.pa-btn-delete:hover {
border-color:#ffb060;
background-color:#ffb060;
border-color: #ffb060;
background-color: #ffb060;
}
.pa-btn-records, .pa-btn-records:hover, .pa-btn-records:focus, .pa-btn-records:active {
border-color:#ddd;
background-color:#f4f4f4;
.pa-btn-records,
.pa-btn-records:hover,
.pa-btn-records:focus,
.pa-btn-records:active {
border-color: #ddd;
background-color: #f4f4f4;
cursor: default;
}
/* -----------------------------------------------------------------------------
Customized Full Calendar
----------------------------------------------------------------------------- */
.fc h2 {
font-size: 20px;
font-size: 20px;
}
.fc-weekend {
@@ -392,7 +379,9 @@
background-color: #FFF0E0;
}
.fc-resized-row { height: 26px !important; }
.fc-resized-row {
height: 26px !important;
}
.fc-transparent-border {
border-Color: transparent !important;
@@ -407,82 +396,131 @@
border-right: 5px solid #606060;
}
/* -----------------------------------------------------------------------------
Spin
----------------------------------------------------------------------------- */
.pa_semitransparent-panel {
position: absolute;
width: 100%; //calc (100% -40px);
height: 100%;
width: 100%; //calc (100% -40px);
height: 100%;
left: 0;
top: 0;
display: block;
display: block;
opacity: 0.8;
opacity: 0.8;
background-color: #fff;
z-index: 99;
z-index: 99;
}
.pa_spinner {
position: absolute;
left: 0;
right: 0;
top: 20px;
margin-left: auto;
position: absolute;
left: 0;
right: 0;
top: 20px;
margin-left: auto;
margin-right: auto;
padding: 15px;
width: 200px;
padding: 15px;
width: 200px;
background-color: #fff;
z-index: 100;
z-index: 100;
}
/* -----------------------------------------------------------------------------
Notification float banner
----------------------------------------------------------------------------- */
.pa_alert_notification {
text-align: center;
font-size: large;
font-weight: bold;
color: #258744;
text-align: center;
font-size: large;
font-weight: bold;
color: #258744;
background-color: #d4edda;
border-color: #c3e6cb;
border-radius: 5px;
border-color: #c3e6cb;
border-radius: 5px;
max-width: 1000px; /* 80% wrapper 1250px */
width: 80%;
z-index: 9999;
max-width: 1000px;
/* 80% wrapper 1250px */
width: 80%;
z-index: 9999;
position: fixed;
top: 30px;
margin: auto;
transform: translate(0,0);
position: fixed;
top: 30px;
margin: auto;
transform: translate(0, 0);
display: none;
display: none;
}
.dbtools-button {
margin: 5px; display: inline-block; width: 140px; height: 100px; white-space: normal; word-wrap: break-word; font-size: 16px; border-radius: 10px; margin-bottom: 25px;
display: inline-block;
width: 160px;
height: 60px;
white-space: normal;
word-wrap: break-word;
font-size: 16px;
border-radius: 10px;
padding: 4px;
}
.db_info_table_cell:nth-child(1) {background: white}
.db_info_table_cell:nth-child(2) {background: white}
.db_info_table {
display: table;
border-spacing: 0em;
font-weight: 400;
font-size: 15px;
width: 95%;
margin: auto;
margin-top: 40px;
margin-bottom: 40px;
border: solid 1px #ddd;
.db_info_table_cell:nth-child(1) {
background: white
}
.db_info_table_row {display: table-row; padding: 3px; }
.db_info_table_cell {display: table-cell; padding: 3px; padding-left: 10px;}
.db_info_table_cell:nth-child(2) {
background: white
}
.db_tools_table_cell_a:nth-child(1) {
background: white
}
.db_tools_table_cell_a:nth-child(2) {
background: white
}
.db_tools_table_cell_b:nth-child(1) {
background: white
}
.db_tools_table_cell_b:nth-child(2) {
background: white
}
.db_info_table {
display: table;
border-spacing: 0em;
font-weight: 400;
font-size: 15px;
width: 95%;
margin: auto;
margin-top: 40px;
margin-bottom: 40px;
border: solid 1px #ddd;
}
.db_info_table_row {
display: table-row;
padding: 3px;
}
.db_info_table_cell {
display: table-cell;
padding: 3px;
padding-left: 10px;
}
.db_tools_table_cell_a {
display: table-cell;
text-align: center;
padding: 10px;
min-width: 180px;
width: 20%;
vertical-align: middle;
}
.db_tools_table_cell_b {
display: table-cell;
text-align: justify;
font-size: 16px;
vertical-align: middle;
padding: 10px;
padding-right: 15px;
}

View File

@@ -28,7 +28,7 @@
</section>
<!-- Main content ---------------------------------------------------------- -->
<section class="content fix_maintain_section" style="height: 100%;">
<section class="content">
<?php
@@ -39,13 +39,15 @@ $pia_db_size = number_format(filesize($pia_db),0,",",".") . ' Byte';
//echo $pia_db_size;
$pia_db_mod = date ("F d Y H:i:s", filemtime($pia_db));
$execstring = 'ps -f -u root | grep "sudo arp-scan" 2>&1';
$pia_arpscans = "";
exec($execstring, $pia_arpscans);
$execstring = 'ps -f -u pi | grep "nmap" 2>&1';
$pia_nmapscans = "";
exec($execstring, $pia_nmapscans);
if (!file_exists('../db/setting_stoparpscan')) {
$execstring = 'ps -f -u root | grep "sudo arp-scan" 2>&1';
$pia_arpscans = "";
exec($execstring, $pia_arpscans);
$pia_arpscans_result = sizeof($pia_arpscans).' scan(s) currently running';
} else {
$pia_arpscans_result = '<span style="color:red;">arp-scan is currently disabled</span>';
}
$Pia_Archive_Path = str_replace('front', 'db', getcwd()).'/';
$Pia_Archive_count = 0;
@@ -91,77 +93,121 @@ if (submit) {
?>
<div class="db_info_table">
<div class="db_info_table_row">
<div class="db_info_table_cell">Database-Path</div>
<div class="db_info_table_cell"><?php echo $pia_db;?></div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">Database-Size</div>
<div class="db_info_table_cell"><?php echo $pia_db_size;?></div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">last Modification</div>
<div class="db_info_table_cell"><?php echo $pia_db_mod;?></div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">DB Backup</div>
<div class="db_info_table_cell"><?php echo $Pia_Archive_count.' Backups where found';?></div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">Scan Status (arp)</div>
<div class="db_info_table_cell"><?php echo sizeof($pia_arpscans);?> scan(s) currently running</div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">Scan Status (nmap)</div>
<div class="db_info_table_cell"><?php echo sizeof($pia_nmapscans);?> scan(s) currently running</div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">Database-Path</div>
<div class="db_info_table_cell">
<?php echo $pia_db;?>
</div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">Database-Size</div>
<div class="db_info_table_cell">
<?php echo $pia_db_size;?>
</div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">last Modification</div>
<div class="db_info_table_cell">
<?php echo $pia_db_mod;?>
</div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">DB Backup</div>
<div class="db_info_table_cell">
<?php echo $Pia_Archive_count.' backups where found';?>
</div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell">Scan Status (arp)</div>
<div class="db_info_table_cell">
<?php echo $pia_arpscans_result;?></div>
</div>
</div>
<form method="post" action="maintenance.php">
<div class="db_info_table">
<div class="db_info_table_row">
<div class="db_info_table_cell" style="height:50px; text-align:center; vertical-align: middle;">
<div style="display: inline-block; margin-right: 10px;">Theme Selection:</div>
<div style="display: inline-block;">
<select name="skinselector">
<option value="">--Choose a theme--</option>
<option value="skin-black-light">black light</option>
<option value="skin-black">black</option>
<option value="skin-blue-light">blue light</option>
<option value="skin-blue">blue</option>
<option value="skin-green-light">green light</option>
<option value="skin-green">green</option>
<option value="skin-purple-light">purple light</option>
<option value="skin-purple">purple</option>
<option value="skin-red-light">red light</option>
<option value="skin-red">red</option>
<option value="skin-yellow-light">yellow light</option>
<option value="skin-yellow">yellow</option>
</select></div>
<div style="display: inline-block;"><input type="submit" value="Set"><?php echo $pia_skin_test; ?></div>
</div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell" style="height:50px; text-align:center; vertical-align: middle;">
<div style="display: inline-block; margin-right: 10px;">Theme Selection:</div>
<div style="display: inline-block;">
<select name="skinselector">
<option value="">--Choose a theme--</option>
<option value="skin-black-light">black light</option>
<option value="skin-black">black</option>
<option value="skin-blue-light">blue light</option>
<option value="skin-blue">blue</option>
<option value="skin-green-light">green light</option>
<option value="skin-green">green</option>
<option value="skin-purple-light">purple light</option>
<option value="skin-purple">purple</option>
<option value="skin-red-light">red light</option>
<option value="skin-red">red</option>
<option value="skin-yellow-light">yellow light</option>
<option value="skin-yellow">yellow</option>
</select></div>
<div style="display: inline-block;"><input type="submit" value="Set">
<?php echo $pia_skin_test; ?>
</div>
</div>
</div>
</div>
</form>
<div class="col-xs-12" style="text-align:center; padding-top: 10px;">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-green dbtools-button" id="btnPiaEnableDarkmode" style="border-top: solid 3px #00a65a;" onclick="askPiaEnableDarkmode()">Switch Modes (Dark/Light)</button>
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnDeleteMAC" style="border-top: solid 3px #dd4b39;" onclick="askDeleteDevicesWithEmptyMACs()">Delete Devices with empty MACs</button>
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnDeleteMAC" style="border-top: solid 3px #dd4b39;" onclick="askDeleteAllDevices()">Delete All Devices</button>
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnDeleteUnknown" style="border-top: solid 3px #dd4b39;" onclick="askDeleteUnknown()">Delete (unknown) Devices</button>
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnDeleteEvents" style="border-top: solid 3px #dd4b39;" onclick="askDeleteEvents()">Delete all Events (Reset Presence)</button>
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnPiaBackupDBtoArchive" style="border-top: solid 3px #dd4b39;" onclick="askPiaBackupDBtoArchive()">DB Backup</button>
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnPiaRestoreDBfromArchive" style="border-top: solid 3px #dd4b39;" onclick="askPiaRestoreDBfromArchive()">DB Restore<br><?php echo $latestbackup_date;?></button>
<div class="db_info_table">
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-green dbtools-button" id="btnPiaEnableDarkmode" style="border-top: solid 3px #00a65a;" onclick="askPiaEnableDarkmode()">Toggle Modes (Dark/Light)</button>
</div>
<div class="db_tools_table_cell_b" style="">Toggle between dark mode and light mode. If the switch does not work properly, try to clear the browser cache.</div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-yellow dbtools-button" id="btnPiaToggleArpScan" style="border-top: solid 3px #ffd080;" onclick="askPiaToggleArpScan()">Toggle arp-Scan (on/off)</button>
</div>
<div class="db_tools_table_cell_b" style="">Switching the arp-scan on or off. When the scan has been switched off it remains off until it is activated again. Active scans are not canceled.</div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnDeleteMAC" style="border-top: solid 3px #dd4b39;" onclick="askDeleteDevicesWithEmptyMACs()">Delete Devices with empty MACs</button>
</div>
<div class="db_tools_table_cell_b">Before using this function, please make a backup. The deletion cannot be undone. All devices without MAC will be deleted from the database.</div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnDeleteMAC" style="border-top: solid 3px #dd4b39;" onclick="askDeleteAllDevices()">Delete all Devices</button>
</div>
<div class="db_tools_table_cell_b">Before using this function, please make a backup. The deletion cannot be undone. All devices will be deleted from the database.</div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnDeleteUnknown" style="border-top: solid 3px #dd4b39;" onclick="askDeleteUnknown()">Delete (unknown) Devices</button>
</div>
<div class="db_tools_table_cell_b">Before using this function, please make a backup. The deletion cannot be undone. All devices named (unknown) will be deleted from the database.</div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnDeleteEvents" style="border-top: solid 3px #dd4b39;" onclick="askDeleteEvents()">Delete all Events (Reset Presence)</button>
</div>
<div class="db_tools_table_cell_b">Before using this function, please make a backup. The deletion cannot be undone. All events in the database will be deleted. At that moment the presence of all devices will be reset. This can lead to invalid sessions.
This means that devices are displayed as "present" although they are offline. A scan while the device in question is online solves the problem.</div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnPiaBackupDBtoArchive" style="border-top: solid 3px #dd4b39;" onclick="askPiaBackupDBtoArchive()">DB Backup</button>
</div>
<div class="db_tools_table_cell_b">The database backups are located in the database directory as a zip-archive, named with the creation date. There is no maximum number of backups.</div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnPiaRestoreDBfromArchive" style="border-top: solid 3px #dd4b39;" onclick="askPiaRestoreDBfromArchive()">DB Restore<br><?php echo $latestbackup_date;?></button>
</div>
<div class="db_tools_table_cell_b">The latest backup can be restored via the button, but older backups can only be restored manually. After the restore, make an integrity check on
the database for safety, in case the db was currently in write access when the backup was created.</div>
</div>
</div>
<div style="width: 100%; height: 20px;"></div>
<!-- ----------------------------------------------------------------------- -->
</section>
@@ -170,7 +216,6 @@ if (submit) {
</div>
<!-- /.content-wrapper -->
<!-- ----------------------------------------------------------------------- -->
<?php
require 'php/templates/footer.php';
@@ -180,14 +225,11 @@ if (submit) {
<script>
// delete devices with emty macs
function askDeleteDevicesWithEmptyMACs () {
// Ask
showModalWarning('Delete Devices', 'Are you sure you want to delete all devices with empty MAC addresses?<br>(maybe you prefer to archive it)',
'Cancel', 'Delete', 'deleteDevicesWithEmptyMACs');
}
function deleteDevicesWithEmptyMACs()
{
// Delete device
@@ -202,8 +244,6 @@ function askDeleteAllDevices () {
showModalWarning('Delete Devices', 'Are you sure you want to delete all devices?',
'Cancel', 'Delete', 'deleteAllDevices');
}
function deleteAllDevices()
{
// Delete device
@@ -218,8 +258,6 @@ function askDeleteUnknown () {
showModalWarning('Delete (unknown) Devices', 'Are you sure you want to delete all (unknown) devices?',
'Cancel', 'Delete', 'deleteUnknownDevices');
}
function deleteUnknownDevices()
{
// Execute
@@ -234,8 +272,6 @@ function askDeleteEvents () {
showModalWarning('Delete Events', 'Are you sure you want to delete all Events?',
'Cancel', 'Delete', 'deleteEvents');
}
function deleteEvents()
{
// Execute
@@ -251,8 +287,6 @@ function askPiaBackupDBtoArchive () {
showModalWarning('DB Backup', 'Are you sure you want to exectute the the DB Backup? Be sure that no scan is currently running.',
'Cancel', 'Run Backup', 'PiaBackupDBtoArchive');
}
function PiaBackupDBtoArchive()
{
// Execute
@@ -268,8 +302,6 @@ function askPiaRestoreDBfromArchive () {
showModalWarning('DB Restore', 'Are you sure you want to exectute the the DB Restore? Be sure that no scan is currently running.',
'Cancel', 'Run Restore', 'PiaRestoreDBfromArchive');
}
function PiaRestoreDBfromArchive()
{
// Execute
@@ -284,8 +316,6 @@ function askPiaEnableDarkmode () {
showModalWarning('Switch Theme', 'After the theme switch, the page tries to reload itself to activate the change. If necessary, the cache must be cleared.',
'Cancel', 'Switch', 'PiaEnableDarkmode');
}
function PiaEnableDarkmode()
{
// Execute
@@ -294,6 +324,20 @@ function PiaEnableDarkmode()
});
}
// Toggle the Arp-Scans
function askPiaToggleArpScan () {
// Ask
showModalWarning('Toggle arp-Scan on or off', 'When the scan has been switched off it remains off until it is activated again.',
'Cancel', 'Switch', 'PiaToggleArpScan');
}
function PiaToggleArpScan()
{
// Execute
$.get('php/server/devices.php?action=PiaToggleArpScan', function(msg) {
showMessage (msg);
});
}
</script>

View File

@@ -42,6 +42,7 @@
case 'PiaBackupDBtoArchive': PiaBackupDBtoArchive(); break;
case 'PiaRestoreDBfromArchive': PiaRestoreDBfromArchive(); break;
case 'PiaEnableDarkmode': PiaEnableDarkmode(); break;
case 'PiaToggleArpScan': PiaToggleArpScan(); break;
case 'getDevicesTotals': getDevicesTotals(); break;
case 'getDevicesList': getDevicesList(); break;
@@ -318,10 +319,10 @@ function PiaRestoreDBfromArchive() {
}
//------------------------------------------------------------------------------
// Switch Themes
// Toggle Dark/Light Themes
//------------------------------------------------------------------------------
function PiaEnableDarkmode() {
$file = '../../../db/darkmode';
$file = '../../../db/setting_darkmode';
if (file_exists($file)) {
echo 'Darkmode Disabled';
@@ -335,6 +336,22 @@ function PiaEnableDarkmode() {
}
//------------------------------------------------------------------------------
// Toggle on/off Arp-Scans
//------------------------------------------------------------------------------
function PiaToggleArpScan() {
$file = '../../../db/setting_stoparpscan';
if (file_exists($file)) {
echo 'Arp-Scan Enabled';
unlink($file);
echo("<meta http-equiv='refresh' content='1'>");
} else {
echo 'Arp-Scan Disabled';
$startarpscan = fopen($file, 'w');
echo("<meta http-equiv='refresh' content='1'>");
}
}
//------------------------------------------------------------------------------
// Query total numbers of Devices by status

View File

@@ -17,7 +17,6 @@
$conf_data = parse_ini_file($conf_file);
echo '<span style="display:inline-block; transform: rotate(180deg)">&copy;</span> '. $conf_data['VERSION_YEAR'] .' Puche';
?>
<!-- To the right -->
<div class="pull-right no-hidden-xs">

View File

@@ -9,7 +9,7 @@
<?php
if (file_exists('../db/darkmode')) {
if (file_exists('../db/setting_darkmode')) {
$ENABLED_DARKMODE = True;
}
foreach (glob("../db/skin*") as $filename) {
@@ -66,7 +66,7 @@ if (strlen($pia_skin_selected) == 0) {$pia_skin_selected = 'skin-blue';}
<!-- For better UX on Mobile Devices using the Shortcut on the Homescreen -->
<link rel="manifest" href="img/manifest.json">
<link rel="apple-touch-icon" href="https://net-dev.de/pialert_homescreen.png">
<!-- Dark-Mode Patch -->
<?php
if ($ENABLED_DARKMODE === True) {