cleanup + fixes

This commit is contained in:
Jokob-sk
2024-03-10 22:21:43 +11:00
parent e38d2f9055
commit 78352f77b7
3 changed files with 17 additions and 7 deletions

View File

@@ -796,7 +796,7 @@ function getDeviceDataByMacAddress(macAddress, dbColumn) {
const sessionDataKey = 'devicesListAll_JSON';
const sessionData = sessionStorage.getItem(sessionDataKey);
if (!sessionData) {
if (!sessionData || sessionData == "") {
console.log(`Session variable "${sessionDataKey}" not found.`);
return "Unknown";
}
@@ -824,7 +824,16 @@ function initDeviceListAll_JSON()
devicesListAll_JSON = data["data"]
setCache('devicesListAll_JSON', JSON.stringify(devicesListAll_JSON))
devicesListAll_JSON_str = JSON.stringify(devicesListAll_JSON)
if(devicesListAll_JSON_str == "")
{
setTimeout(() => {
initDeviceListAll_JSON()
}, 1000);
}
setCache('devicesListAll_JSON', devicesListAll_JSON_str)
});
}

View File

@@ -511,7 +511,7 @@
{
"name" : "value",
"type" : "sql",
"value" : "SELECT Dev_Name as name, dev_MAC as id FROM Devices WHERE EXISTS (SELECT 1 FROM Settings WHERE Code_Name = 'NETWORK_DEVICE_TYPES' AND LOWER(value) LIKE '%' || LOWER(dev_DeviceType) || '%' AND dev_DeviceType <> '')"
"value" : "SELECT '' as name, '' as id UNION SELECT Dev_Name as name, dev_MAC as id FROM Devices WHERE EXISTS (SELECT 1 FROM Settings WHERE Code_Name = 'NETWORK_DEVICE_TYPES' AND LOWER(value) LIKE '%' || LOWER(dev_DeviceType) || '%' AND dev_DeviceType <> '')"
},
{
"name" : "target_macs",

View File

@@ -95,7 +95,7 @@ def execute_nslookup (ip, timeout):
domain_name = ''
dns_server = ''
mylog('verbose', [f'[{pluginName}] DEBUG OUTPUT : {output}'])
# mylog('verbose', [f'[{pluginName}] DEBUG OUTPUT : {output}'])
# Parse output using case-insensitive regular expressions
domain_pattern = re.compile(r'name\s*=\s*([^\s]+)', re.IGNORECASE)
@@ -118,12 +118,13 @@ def execute_nslookup (ip, timeout):
except subprocess.CalledProcessError as e:
# An error occured, handle it
mylog('verbose', [f'[{pluginName}]', e.output])
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - check logs'])
# mylog('verbose', [f'[{pluginName}] ⚠ ERROR - check logs'])
except subprocess.TimeoutExpired as timeErr:
mylog('verbose', [f'[{pluginName}] TIMEOUT - the process forcefully terminated as timeout reached'])
if output == "": # check if the subprocess failed
mylog('verbose', [f'[{pluginName}] Scan: FAIL - check logs'])
if output == "": # check if the subprocess failed
tmp = 1 # can't have empty
# mylog('verbose', [f'[{pluginName}] Scan: FAIL - check logs'])
else:
mylog('verbose', [f'[{pluginName}] Scan: SUCCESS'])