From 27ae11c1bc22452c62b815a9994abe872e818fe9 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Mon, 11 Mar 2024 07:57:49 +1100 Subject: [PATCH] cleanup + log fixes --- front/maintenance.php | 26 +++++++++++------------ front/plugins/newdev_template/config.json | 2 +- front/plugins/nslookup_scan/nslookup.py | 9 ++++++-- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/front/maintenance.php b/front/maintenance.php index 067a011d..2f6747ae 100755 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -787,23 +787,23 @@ function scrollDown() { setTimeout(() => { - var anchor = getUrlAnchor() + var elementToCheck = $("#tab_Logging_id"); - console.log(anchor) - - if (anchor == "tab_Logging") + // Check if the parent
  • is active + if (elementToCheck.parent().hasClass("active")) { { - var areaIDs = ['pialert_log', 'pialert_front_log', 'IP_changes_log', 'stdout_log', 'stderr_log', 'pialert_pholus_log', 'pialert_pholus_lastrun_log', 'pialert_php_log']; - - for (let i = 0; i < areaIDs.length; i++) { + var areaIDs = ['pialert_log', 'pialert_front_log', 'IP_changes_log', 'stdout_log', 'stderr_log', 'pialert_pholus_log', 'pialert_pholus_lastrun_log', 'pialert_php_log']; + + for (let i = 0; i < areaIDs.length; i++) { + + var tempArea = $('#' + areaIDs[i]); + + if (tempArea.length > 0) + { + $(tempArea[0]).scrollTop(tempArea[0].scrollHeight); + } - var tempArea = $('#' + areaIDs[i]); - - if (tempArea.length > 0) - { - $(tempArea[0]).scrollTop(tempArea[0].scrollHeight); } - } } diff --git a/front/plugins/newdev_template/config.json b/front/plugins/newdev_template/config.json index 5bccc890..1bcb2600 100755 --- a/front/plugins/newdev_template/config.json +++ b/front/plugins/newdev_template/config.json @@ -132,7 +132,7 @@ { "name" : "value", "type" : "sql", - "value" : "SELECT DISTINCT dev_DeviceType as id, dev_DeviceType as name FROM Devices " + "value" : "SELECT '' as id, '' as name UNION SELECT dev_DeviceType as id, dev_DeviceType as name FROM (SELECT dev_DeviceType FROM Devices UNION SELECT 'Smartphone' UNION SELECT 'Tablet' UNION SELECT 'Laptop' UNION SELECT 'PC' UNION SELECT 'Printer' UNION SELECT 'Server' UNION SELECT 'NAS' UNION SELECT 'Domotic' UNION SELECT 'Game Console' UNION SELECT 'SmartTV' UNION SELECT 'Clock' UNION SELECT 'House Appliance' UNION SELECT 'Phone' UNION SELECT 'AP' UNION SELECT 'Gateway' UNION SELECT 'Firewall' UNION SELECT 'Switch' UNION SELECT 'WLAN' UNION SELECT 'Router' UNION SELECT 'Other') AS all_devices ORDER BY id;" }, { "name" : "uilang", diff --git a/front/plugins/nslookup_scan/nslookup.py b/front/plugins/nslookup_scan/nslookup.py index c38ab7da..9f6853fe 100755 --- a/front/plugins/nslookup_scan/nslookup.py +++ b/front/plugins/nslookup_scan/nslookup.py @@ -116,9 +116,14 @@ def execute_nslookup (ip, timeout): return domain_name, dns_server except subprocess.CalledProcessError as e: - # An error occured, handle it - mylog('verbose', [f'[{pluginName}]', e.output]) + # An error occurred, handle it + if "NXDOMAIN" in e.output.decode(): + mylog('verbose', [f'[{pluginName}]', f"No PTR record found for IP: {ip}"]) + else: + mylog('verbose', [f'[{pluginName}]', e.output]) + # Handle other errors here # mylog('verbose', [f'[{pluginName}] ⚠ ERROR - check logs']) + except subprocess.TimeoutExpired as timeErr: mylog('verbose', [f'[{pluginName}] TIMEOUT - the process forcefully terminated as timeout reached'])