📃More logging + updated default plugins to load
This commit is contained in:
@@ -3,13 +3,12 @@
|
|||||||
# Generated: 2022-12-30_22-19-40 #
|
# Generated: 2022-12-30_22-19-40 #
|
||||||
# #
|
# #
|
||||||
# Config file for the LAN intruder detection app: #
|
# Config file for the LAN intruder detection app: #
|
||||||
# https://github.com/jokob-sk/NetAlertX #
|
# https://github.com/jokob-sk/NetAlertX #
|
||||||
# #
|
# #
|
||||||
#-----------------AUTOGENERATED FILE-----------------#
|
#-----------------AUTOGENERATED FILE-----------------#
|
||||||
|
|
||||||
# 🔺 Use the Settings UI - only edit when necessary 🔺
|
# 🔺 Use the Settings UI - only edit when necessary 🔺
|
||||||
|
|
||||||
|
|
||||||
# General
|
# General
|
||||||
#---------------------------
|
#---------------------------
|
||||||
# Scan using interface eth0
|
# Scan using interface eth0
|
||||||
@@ -19,15 +18,18 @@
|
|||||||
# SCAN_SUBNETS = [ '192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0' ]
|
# SCAN_SUBNETS = [ '192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0' ]
|
||||||
|
|
||||||
SCAN_SUBNETS=['192.168.1.0/24 --interface=eth1']
|
SCAN_SUBNETS=['192.168.1.0/24 --interface=eth1']
|
||||||
|
|
||||||
TIMEZONE='Europe/Berlin'
|
TIMEZONE='Europe/Berlin'
|
||||||
|
LOADED_PLUGINS = ['ARPSCAN','CSVBCKP','DBCLNP', 'INTRNT','MAINT','NEWDEV','NSLOOKUP','NTFPRCS', 'PHOLUS','SETPWD','SMTP', 'SYNC', 'VNDRPDT', 'WORKFLOWS']
|
||||||
|
|
||||||
DAYS_TO_KEEP_EVENTS=90
|
DAYS_TO_KEEP_EVENTS=90
|
||||||
# Used for generating links in emails. Make sure not to add a trailing slash!
|
# Used for generating links in emails. Make sure not to add a trailing slash!
|
||||||
REPORT_DASHBOARD_URL='http://netalertx'
|
REPORT_DASHBOARD_URL='http://netalertx'
|
||||||
|
|
||||||
|
|
||||||
# Email
|
# Email
|
||||||
#---------------------------
|
#-------------------------------------
|
||||||
|
# (add SMTP to LOADED_PLUGINS to load)
|
||||||
|
#-------------------------------------
|
||||||
SMTP_RUN='disabled' # use 'on_notification' to enable
|
SMTP_RUN='disabled' # use 'on_notification' to enable
|
||||||
SMTP_SERVER='smtp.gmail.com'
|
SMTP_SERVER='smtp.gmail.com'
|
||||||
SMTP_PORT=587
|
SMTP_PORT=587
|
||||||
@@ -39,8 +41,10 @@ SMTP_PASS='password'
|
|||||||
SMTP_SKIP_TLS=False
|
SMTP_SKIP_TLS=False
|
||||||
|
|
||||||
|
|
||||||
# Webhooks
|
# Webhook
|
||||||
#---------------------------
|
#-------------------------------------
|
||||||
|
# (add WEBHOOK to LOADED_PLUGINS to load)
|
||||||
|
#-------------------------------------
|
||||||
WEBHOOK_RUN='disabled' # use 'on_notification' to enable
|
WEBHOOK_RUN='disabled' # use 'on_notification' to enable
|
||||||
WEBHOOK_URL='http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa'
|
WEBHOOK_URL='http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa'
|
||||||
WEBHOOK_PAYLOAD='json' # webhook payload data format for the "body > attachements > text" attribute
|
WEBHOOK_PAYLOAD='json' # webhook payload data format for the "body > attachements > text" attribute
|
||||||
@@ -51,14 +55,18 @@ WEBHOOK_REQUEST_METHOD='GET'
|
|||||||
|
|
||||||
|
|
||||||
# Apprise
|
# Apprise
|
||||||
#---------------------------
|
#-------------------------------------
|
||||||
|
# (add APPRISE to LOADED_PLUGINS to load)
|
||||||
|
#-------------------------------------
|
||||||
APPRISE_RUN='disabled' # use 'on_notification' to enable
|
APPRISE_RUN='disabled' # use 'on_notification' to enable
|
||||||
APPRISE_HOST='http://localhost:8000/notify'
|
APPRISE_HOST='http://localhost:8000/notify'
|
||||||
APPRISE_URL='mailto://smtp-relay.sendinblue.com:587?from=user@gmail.com&name=apprise&user=user@gmail.com&pass=password&to=user@gmail.com'
|
APPRISE_URL='mailto://smtp-relay.sendinblue.com:587?from=user@gmail.com&name=apprise&user=user@gmail.com&pass=password&to=user@gmail.com'
|
||||||
|
|
||||||
|
|
||||||
# NTFY
|
# NTFY
|
||||||
#---------------------------
|
#-------------------------------------
|
||||||
|
# (add NTFY to LOADED_PLUGINS to load)
|
||||||
|
#-------------------------------------
|
||||||
NTFY_RUN='disabled' # use 'on_notification' to enable
|
NTFY_RUN='disabled' # use 'on_notification' to enable
|
||||||
NTFY_HOST='https://ntfy.sh'
|
NTFY_HOST='https://ntfy.sh'
|
||||||
NTFY_TOPIC='replace_my_secure_topicname_91h889f28'
|
NTFY_TOPIC='replace_my_secure_topicname_91h889f28'
|
||||||
@@ -67,13 +75,17 @@ NTFY_PASSWORD='passw0rd'
|
|||||||
|
|
||||||
|
|
||||||
# PUSHSAFER
|
# PUSHSAFER
|
||||||
#---------------------------
|
#-------------------------------------
|
||||||
|
# (add PUSHSAFER to LOADED_PLUGINS to load)
|
||||||
|
#-------------------------------------
|
||||||
PUSHSAFER_RUN='disabled' # use 'on_notification' to enable
|
PUSHSAFER_RUN='disabled' # use 'on_notification' to enable
|
||||||
PUSHSAFER_TOKEN='ApiKey'
|
PUSHSAFER_TOKEN='ApiKey'
|
||||||
|
|
||||||
|
|
||||||
# MQTT
|
# MQTT
|
||||||
#---------------------------
|
#-------------------------------------
|
||||||
|
# (add MQTT to LOADED_PLUGINS to load)
|
||||||
|
#-------------------------------------
|
||||||
MQTT_RUN='disabled' # use 'on_notification' to enable
|
MQTT_RUN='disabled' # use 'on_notification' to enable
|
||||||
MQTT_BROKER='192.168.1.2'
|
MQTT_BROKER='192.168.1.2'
|
||||||
MQTT_PORT=1883
|
MQTT_PORT=1883
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ const phpEndpoint = 'php/server/utilNotification.php';
|
|||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Write a notification
|
// Write a notification
|
||||||
function writeNotification(content, level) {
|
function write_notification(content, level) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: phpEndpoint, // Change this to the path of your PHP script
|
url: phpEndpoint, // Change this to the path of your PHP script
|
||||||
|
|||||||
@@ -454,7 +454,6 @@ $db->close();
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var emptyArr = ['undefined', "", undefined, null];
|
var emptyArr = ['undefined', "", undefined, null];
|
||||||
@@ -475,6 +474,7 @@ function deleteDevicesWithEmptyMACs()
|
|||||||
// Delete device
|
// Delete device
|
||||||
$.get('php/server/devices.php?action=deleteAllWithEmptyMACs', function(msg) {
|
$.get('php/server/devices.php?action=deleteAllWithEmptyMACs', function(msg) {
|
||||||
showMessage (msg);
|
showMessage (msg);
|
||||||
|
write_notification(`[Maintenance] All devices witout a Mac manually deleted`, 'info')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,6 +491,7 @@ function deleteAllDevices()
|
|||||||
// Delete device
|
// Delete device
|
||||||
$.get('php/server/devices.php?action=deleteAllDevices', function(msg) {
|
$.get('php/server/devices.php?action=deleteAllDevices', function(msg) {
|
||||||
showMessage (msg);
|
showMessage (msg);
|
||||||
|
write_notification(`[Maintenance] All devices manually deleted`, 'info')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,6 +508,7 @@ function deleteUnknownDevices()
|
|||||||
// Execute
|
// Execute
|
||||||
$.get('php/server/devices.php?action=deleteUnknownDevices', function(msg) {
|
$.get('php/server/devices.php?action=deleteUnknownDevices', function(msg) {
|
||||||
showMessage (msg);
|
showMessage (msg);
|
||||||
|
write_notification(`[Maintenance] Unknown devices manually deleted`, 'info')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,6 +525,7 @@ function deleteEvents()
|
|||||||
// Execute
|
// Execute
|
||||||
$.get('php/server/devices.php?action=deleteEvents', function(msg) {
|
$.get('php/server/devices.php?action=deleteEvents', function(msg) {
|
||||||
showMessage (msg);
|
showMessage (msg);
|
||||||
|
write_notification(`[Maintenance] Events manually deleted (all)`, 'info')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,6 +542,7 @@ function deleteEvents30()
|
|||||||
// Execute
|
// Execute
|
||||||
$.get('php/server/devices.php?action=deleteEvents30', function(msg) {
|
$.get('php/server/devices.php?action=deleteEvents30', function(msg) {
|
||||||
showMessage (msg);
|
showMessage (msg);
|
||||||
|
write_notification(`[Maintenance] Events manually deleted (last 30 days kep)`, 'info')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,6 +632,8 @@ function restartBackend() {
|
|||||||
showModalOk(getString("general_event_title"), `${getString("general_event_description")} <br/> <br/> <code id='${modalEventStatusId}'></code>`);
|
showModalOk(getString("general_event_title"), `${getString("general_event_description")} <br/> <br/> <code id='${modalEventStatusId}'></code>`);
|
||||||
|
|
||||||
updateModalState()
|
updateModalState()
|
||||||
|
|
||||||
|
write_notification('[Maintenance] App manually restarted', 'info')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -657,6 +663,7 @@ function ImportCSV()
|
|||||||
// Execute
|
// Execute
|
||||||
$.get('php/server/devices.php?action=ImportCSV', function(msg) {
|
$.get('php/server/devices.php?action=ImportCSV', function(msg) {
|
||||||
showMessage (msg);
|
showMessage (msg);
|
||||||
|
write_notification(`[Maintenance] Devices imported from CSV file`, 'info')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,6 +733,7 @@ function performLogManage() {
|
|||||||
data: { function: logFileAction, settings: targetLogFile },
|
data: { function: logFileAction, settings: targetLogFile },
|
||||||
success: function(data, textStatus) {
|
success: function(data, textStatus) {
|
||||||
showModalOk ('Result', data );
|
showModalOk ('Result', data );
|
||||||
|
write_notification(`[Maintenance] Log file "${targetLogFile}" manually purged`, 'info')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ function executeAction(action, whereColumnName, key, targetColumns, newTargetCol
|
|||||||
// update API endpoints to refresh the UI
|
// update API endpoints to refresh the UI
|
||||||
updateApi()
|
updateApi()
|
||||||
|
|
||||||
writeNotification(`[Multi edit] Executed "${action}" on Columns "${targetColumns}" matching "${key}"`, 'info')
|
write_notification(`[Multi edit] Executed "${action}" on Columns "${targetColumns}" matching "${key}"`, 'info')
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
showMessage(getString('Gen_LockedDB'));
|
showMessage(getString('Gen_LockedDB'));
|
||||||
@@ -317,7 +317,7 @@ function deleteSelectedDevices()
|
|||||||
{
|
{
|
||||||
macs_tmp = selectorMacs()
|
macs_tmp = selectorMacs()
|
||||||
executeAction('delete', 'dev_MAC', macs_tmp )
|
executeAction('delete', 'dev_MAC', macs_tmp )
|
||||||
writeNotification('[Multi edit] Manually deleted devices with MACs:' + macs_tmp, 'info')
|
write_notification('[Multi edit] Manually deleted devices with MACs:' + macs_tmp, 'info')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,46 +10,54 @@ function renderLogArea($params) {
|
|||||||
$buttons = isset($params['buttons']) ? $params['buttons'] : [];
|
$buttons = isset($params['buttons']) ? $params['buttons'] : [];
|
||||||
$content = "";
|
$content = "";
|
||||||
|
|
||||||
if(filesize($filePath) > 2000000) {
|
if (filesize($filePath) > 2000000) {
|
||||||
$content = file_get_contents($filePath, false, null, -2000000);
|
$content = file_get_contents($filePath, false, null, -2000000);
|
||||||
} else {
|
} else {
|
||||||
$content = file_get_contents($filePath);
|
$content = file_get_contents($filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepare the download button HTML if filePath starts with /app/front
|
||||||
|
$downloadButtonHtml = '';
|
||||||
|
if (strpos($filePath, '/app/front') === 0) {
|
||||||
|
$downloadButtonHtml = '
|
||||||
|
<span class="span-padding">
|
||||||
|
<a href="' . htmlspecialchars(str_replace('/app/front', '', $filePath)) . '" target="_blank">
|
||||||
|
<i class="fa fa-download"></i>
|
||||||
|
</a>
|
||||||
|
</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare buttons HTML
|
||||||
|
$buttonsHtml = '';
|
||||||
|
foreach ($buttons as $button) {
|
||||||
|
$labelStringCode = isset($button['labelStringCode']) ? $button['labelStringCode'] : '';
|
||||||
|
$event = isset($button['event']) ? $button['event'] : '';
|
||||||
|
|
||||||
|
$buttonsHtml .= '
|
||||||
|
<div class="col-sm-6 col-xs-6">
|
||||||
|
<button class="btn btn-primary" onclick="' . htmlspecialchars($event) . '">' . lang($labelStringCode) . '</button>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
// Render the log area HTML
|
// Render the log area HTML
|
||||||
$html = '
|
$html = '
|
||||||
<div class="log-area box box-solid box-primary">
|
<div class="log-area box box-solid box-primary">
|
||||||
<div class="row logs-row col-sm-12 col-xs-12">
|
<div class="row logs-row col-sm-12 col-xs-12">
|
||||||
<textarea id="app_log" class="' . $textAreaCssClass . '" cols="70" rows="10" wrap="off" readonly>'
|
<textarea id="app_log" class="' . htmlspecialchars($textAreaCssClass) . '" cols="70" rows="10" wrap="off" readonly>'
|
||||||
.$content.
|
. htmlspecialchars($content) .
|
||||||
'</textarea>
|
'</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="row logs-row">
|
<div class="row logs-row">
|
||||||
<div class="log-file col-sm-8 col-xs-12">' . $fileName . '
|
<div class="log-file col-sm-8 col-xs-12">' . htmlspecialchars($fileName) . '
|
||||||
<div class="logs-size">' . number_format((filesize($filePath) / 1000000), 2, ",", ".") . ' MB
|
<div class="logs-size">' . number_format((filesize($filePath) / 1000000), 2, ",", ".") . ' MB'
|
||||||
<span class="span-padding"><a href="' . $filePath . '" target="_blank"><i class="fa fa-download"></i></a></span>
|
. $downloadButtonHtml .
|
||||||
</div>
|
'</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 col-xs-12">
|
<div class="col-sm-4 col-xs-12">'
|
||||||
';
|
. $buttonsHtml .
|
||||||
|
'</div>
|
||||||
// Render each button
|
|
||||||
foreach ($buttons as $button) {
|
|
||||||
$labelStringCode = isset($button['labelStringCode']) ? $button['labelStringCode'] : '';
|
|
||||||
$event = isset($button['event']) ? $button['event'] : '';
|
|
||||||
|
|
||||||
$html .= '
|
|
||||||
<div class="col-sm-6 col-xs-6">
|
|
||||||
<button class="btn btn-primary" onclick="' . $event . '">' . lang($labelStringCode) . '</button>
|
|
||||||
</div>
|
</div>
|
||||||
';
|
</div>';
|
||||||
}
|
|
||||||
|
|
||||||
$html .= '
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
';
|
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -729,11 +729,11 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
|||||||
setTimeout("clearCache()", 5000);
|
setTimeout("clearCache()", 5000);
|
||||||
} else{
|
} else{
|
||||||
// something went wrong
|
// something went wrong
|
||||||
// writeNotification(data, 'interrupt')
|
// write_notification(data, 'interrupt')
|
||||||
writeNotification("Please screenshot the next popup (or check Monitoring > Notifications), dev console (F12) and submit it as a new issue here: https://github.com/jokob-sk/NetAlertX/issues", 'interrupt')
|
write_notification("Please screenshot the next popup (or check Monitoring > Notifications), dev console (F12) and submit it as a new issue here: https://github.com/jokob-sk/NetAlertX/issues", 'interrupt')
|
||||||
console.log(settingsArray);
|
console.log(settingsArray);
|
||||||
console.log(JSON.stringify(settingsArray));
|
console.log(JSON.stringify(settingsArray));
|
||||||
writeNotification(JSON.stringify(settingsArray), 'interrupt')
|
write_notification(JSON.stringify(settingsArray), 'interrupt')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user