mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
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:
@@ -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>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user