From a0e1d1a404159bc352668eb706b18b01211a30b4 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sat, 3 Feb 2024 23:24:41 +1100 Subject: [PATCH] =?UTF-8?q?NEWDEV=20IP=20filter=20+=20dark=20pach=20for=20?= =?UTF-8?q?overlay=20#539=20=F0=9F=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/css/dark-patch.css | 3 +++ front/plugins/newdev_template/config.json | 22 +++++++++++++++++++++- pialert/device.py | 5 ++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/front/css/dark-patch.css b/front/css/dark-patch.css index 0c9ed484..84546d62 100755 --- a/front/css/dark-patch.css +++ b/front/css/dark-patch.css @@ -723,3 +723,6 @@ input[type="password"]::-webkit-caps-lock-indicator { top: 0.01em; font-size: 3.25em; } +.pa_semitransparent-panel{ + background-color: #000 !important; +} \ No newline at end of file diff --git a/front/plugins/newdev_template/config.json b/front/plugins/newdev_template/config.json index 893718e4..10e18e10 100755 --- a/front/plugins/newdev_template/config.json +++ b/front/plugins/newdev_template/config.json @@ -38,7 +38,27 @@ "description": [ { "language_code": "en_us", - "string": "List of MACs to ignore. Use % as a wildcard.

For example 02:42:ac:% to filter out docker containers." + "string": "List of MACs to ignore. Use % as a wildcard. Ignored devices will not be shown anywhere in the UI or notifications.

For example 02:42:ac:% to filter out docker containers." + } + ] + }, + { + "function": "ignored_IPs", + "type": "list", + "default_value": [ + ], + "options": [], + "localized": ["name", "description"], + "name": [ + { + "language_code": "en_us", + "string": "Ignored IPs" + } + ], + "description": [ + { + "language_code": "en_us", + "string": "List of IPs to ignore. Use % as a wildcard. Ignored devices will not be shown anywhere in the UI or notifications.

For example 192.168.3.% to filter out a subnet." } ] }, diff --git a/pialert/device.py b/pialert/device.py index 2dba3f16..5f293444 100755 --- a/pialert/device.py +++ b/pialert/device.py @@ -135,6 +135,7 @@ def create_new_devices (db): WHERE NOT EXISTS (SELECT 1 FROM Devices WHERE dev_MAC = cur_MAC) {list_to_where('OR', 'cur_MAC', 'NOT LIKE', get_setting_value('NEWDEV_ignored_MACs'))} + {list_to_where('OR', 'cur_IP', 'NOT LIKE', get_setting_value('NEWDEV_ignored_IPs'))} """ @@ -143,7 +144,7 @@ def create_new_devices (db): sql.execute(query) mylog('debug',f'[New Devices] Insert Connection into session table') - + sql.execute (f"""INSERT INTO Sessions (ses_MAC, ses_IP, ses_EventTypeConnection, ses_DateTimeConnection, ses_EventTypeDisconnection, ses_DateTimeDisconnection, ses_StillConnected, ses_AdditionalInfo) SELECT cur_MAC, cur_IP,'Connected','{startTime}', NULL , NULL ,1, cur_Vendor @@ -151,6 +152,7 @@ def create_new_devices (db): WHERE NOT EXISTS (SELECT 1 FROM Sessions WHERE ses_MAC = cur_MAC) {list_to_where('OR', 'cur_MAC', 'NOT LIKE', get_setting_value('NEWDEV_ignored_MACs'))} + {list_to_where('OR', 'cur_IP', 'NOT LIKE', get_setting_value('NEWDEV_ignored_IPs'))} """) # Create new devices from CurrentScan @@ -203,6 +205,7 @@ def create_new_devices (db): FROM CurrentScan WHERE 1=1 {list_to_where('OR', 'cur_MAC', 'NOT LIKE', get_setting_value('NEWDEV_ignored_MACs'))} + {list_to_where('OR', 'cur_IP', 'NOT LIKE', get_setting_value('NEWDEV_ignored_IPs'))} """