diff --git a/front/js/pialert_common.js b/front/js/pialert_common.js index 52c4ffa9..908cc1e8 100755 --- a/front/js/pialert_common.js +++ b/front/js/pialert_common.js @@ -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) }); } diff --git a/front/plugins/newdev_template/config.json b/front/plugins/newdev_template/config.json index e437dd60..5bccc890 100755 --- a/front/plugins/newdev_template/config.json +++ b/front/plugins/newdev_template/config.json @@ -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", diff --git a/front/plugins/nslookup_scan/nslookup.py b/front/plugins/nslookup_scan/nslookup.py index 4af6720c..c38ab7da 100755 --- a/front/plugins/nslookup_scan/nslookup.py +++ b/front/plugins/nslookup_scan/nslookup.py @@ -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'])