Compare commits

...

8 Commits

Author SHA1 Message Date
jokob-sk
3d51b1cd15 Merge branch 'main' of https://github.com/jokob-sk/NetAlertX
Some checks are pending
docker / docker_dev (push) Waiting to run
2024-10-12 12:30:17 +11:00
jokob-sk
158ed324c2 docs + css 2024-10-12 12:30:00 +11:00
Hosted Weblate
d36486ef6d Merge branch 'origin/main' into Weblate. 2024-10-12 03:05:05 +02:00
Massimo Pissarello
1767776dd9 Translated using Weblate (Italian)
Currently translated at 100.0% (702 of 702 strings)

Translation: NetAlertX/core
Translate-URL: https://hosted.weblate.org/projects/pialert/core/it/
2024-10-12 03:05:05 +02:00
jokob-sk
507e0469d6 Strings cleanup 2024-10-12 12:04:42 +11:00
jokob-sk
ae14229ca7 Merge branch 'main' of https://github.com/jokob-sk/NetAlertX 2024-10-12 11:00:42 +11:00
jokob-sk
dcfeb51aa1 Ignored IPs not applied #836 2024-10-12 10:49:29 +11:00
jokob-sk
d6164a005b UNIFIMP CMD set to readonly 2024-10-11 20:19:46 +11:00
26 changed files with 179 additions and 65 deletions

View File

@@ -22,3 +22,10 @@ The database cleanup plugin. Check details and related setting in the [DB Cleanu
### Maintenance (MAINT)
The maintenance plugin. Check details and related setting in the [Maintenance plugin docs](/front/plugins/maintenance/README.md). Make sure the plugin is not failing by checking the logs. Try changing the schedule `MAINT_RUN_SCHD` and the timeout `MAINT_RUN_TIMEOUT` (increase) if the plugin is failing to execute.
## Scan frequency and coverage
The more often you scan the networks the more resources, traffic and DB read/write cycles are executed. Especially on busy networks and lower end hardware, consider increasing scan intervals (`<PLUGIN>_RUN_SCHD`) and timeouts (`<PLUGIN>_RUN_TIMEOUT`).
Also consider decreasing the scanned subnet, e.g. from `/16` to `/24` if need be.

View File

@@ -124,6 +124,21 @@
border: none;
}
@media (min-width: 768px) {
.hideOnBigScreen{
display: none;
}
}
@media (max-width: 767px) { /* on mobile */
.hideOnMobile{
display: none;
}
}
/* -----------------------------------------------------------------------------
Main Sections
----------------------------------------------------------------------------- */
@@ -781,20 +796,20 @@ height: 50px;
/* settings */
/* --------------------------------------------------------- */
@media (max-width: 767px) {
@media (max-width: 767px) { /* on mobile */
/* hide on mobile */
.setting_description {
/* color: red; */
display: none;
}
.setting_input{
/* .setting_input{
width:70%;
/* background-color: red; */
}
.setting_name
{
width:30%;
}
} */
}
@media (min-width: 768px) {
@@ -802,14 +817,14 @@ height: 50px;
/* color: green; */
display: block;
}
.setting_input{
/* .setting_input{
width:40%;
/* background-color: green; */
}
.setting_name
{
width:19%;
}
} */
}
.settingswrap
@@ -874,10 +889,10 @@ height: 50px;
}
.table_row {
#settingsPage .table_row {
padding: 3px;
width:100%;
display: flex;
/* width:100%; */
/* display: flex; */
border-bottom-width: 1px;
border-bottom-style: solid;
border-color: #606060;
@@ -897,10 +912,6 @@ height: 50px;
font-weight: 300;
}
.setting_description
{
width:40%;
}
.myhidden
{
@@ -1125,7 +1136,6 @@ input[readonly] {
height: 200px; */
background-color: #f3f3f3;
border: 1px solid #ccc;
margin: 20px;
z-index: 10;
}

View File

@@ -512,6 +512,17 @@ function toggleMetadata(element) {
$(`#${id}`).toggle();
}
// -----------------------------------------------------------------------------
// Show setting description in a modal on smaller screens
// -----------------------------------------------------------------------------
function showDescription(element) {
const id = $(element).attr("my-to-show");
description = $(`${id}`)[0].innerHTML
console.log(description);
showModalOK(getString("Gen_Description"), description);
}
// ---------------------------------------------------------
// Helper methods
// ---------------------------------------------------------

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "",
"Gen_Delete": "",
"Gen_DeleteAll": "",
"Gen_Description": "",
"Gen_Error": "",
"Gen_Filter": "",
"Gen_LockedDB": "",
@@ -567,6 +568,7 @@
"Setting_Override": "",
"Setting_Override_Description": "",
"Settings_Metadata_Toggle": "",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "",
"Settings_device_Scanners_desync_popup": "",
"Speedtest_Results": "",

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "",
"Gen_Delete": "",
"Gen_DeleteAll": "",
"Gen_Description": "",
"Gen_Error": "",
"Gen_Filter": "",
"Gen_LockedDB": "",
@@ -567,6 +568,7 @@
"Setting_Override": "",
"Setting_Override_Description": "",
"Settings_Metadata_Toggle": "",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "",
"Settings_device_Scanners_desync_popup": "",
"Speedtest_Results": "",

View File

@@ -293,6 +293,7 @@
"Gen_DataUpdatedUITakesTime": "OK Es kann einen Moment dauern, bis die Benutzeroberfläche aktualisiert wird, während ein Scan ausgeführt wird.",
"Gen_Delete": "Löschen",
"Gen_DeleteAll": "Delete all",
"Gen_Description": "",
"Gen_Error": "Fehler",
"Gen_Filter": "Filter",
"Gen_LockedDB": "ERROR - DB eventuell gesperrt - Nutze die Konsole in den Entwickler Werkzeugen (F12) zur Überprüfung oder probiere es später erneut.",
@@ -636,6 +637,7 @@
"Setting_Override": "Override value",
"Setting_Override_Description": "Enabling this option will override an App supplied default value with the value specified above.",
"Settings_Metadata_Toggle": "Show/hide metadata for the given setting.",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "⚠ Die Zeitpläne des Gerätescanners sind nicht synchronisiert.",
"Settings_device_Scanners_desync_popup": "",
"Speedtest_Results": "Ergebnisse des Geschwindigkeitstests",

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "OK - It may take a while for the UI to update if a scan is running.",
"Gen_Delete": "Delete",
"Gen_DeleteAll": "Delete all",
"Gen_Description": "Description",
"Gen_Error": "Error",
"Gen_Filter": "Filter",
"Gen_LockedDB": "ERROR - DB might be locked - Check F12 Dev tools -> Console or try later.",
@@ -567,6 +568,7 @@
"Setting_Override": "Override value",
"Setting_Override_Description": "Enabling this option will override an App supplied default value with the value specified above.",
"Settings_Metadata_Toggle": "Show/hide metadata for the given setting.",
"Settings_Show_Description": "Show setting description.",
"Settings_device_Scanners_desync": "⚠ Device scanner schedules are out-of-sync.",
"Settings_device_Scanners_desync_popup": "Schedules of devices scanners (<code>*_RUN_SCHD</code>) are not the same. This will result into inconsistent device online/offline notifications. Unless this is intended, please use the same schedule for all enabled <b>🔍Device scanners</b>.",
"Speedtest_Results": "Speedtest Results",
@@ -653,11 +655,11 @@
"UI_ICONS_name": "Pre-defined icons",
"UI_LANG_description": "Select the preferred UI language. Help translating or suggest languages in the online portal of <a href=\"https://hosted.weblate.org/projects/pialert/core/\" target=\"_blank\">Weblate</a>.",
"UI_LANG_name": "UI Language",
"UI_MY_DEVICES_description": "Devices of which statuses should be shown in the default <b>My Devices</b> view. (<code>CTRL + Click</code> to select/deselect)",
"UI_MY_DEVICES_description": "Devices of which statuses should be shown in the default <b>My Devices</b> view.",
"UI_MY_DEVICES_name": "Show in My Devices view",
"UI_NOT_RANDOM_MAC_description": "Mac prefixes which shouldn't be marked as Random devices. Enter for example <code>52</code> to exclude devices starting with <code>52:xx:xx:xx:xx:xx</code> from being marked as devices with a random MAC address.",
"UI_NOT_RANDOM_MAC_name": "Don't mark as Random",
"UI_PRESENCE_description": "Select what statuses should be shown in the <b>Device presence</b> chart in the <a href=\"/devices.php\" target=\"_blank\">Devices</a> page. (<code>CTRL + Click</code> to select/deselect)",
"UI_PRESENCE_description": "Select what statuses should be shown in the <b>Device presence</b> chart in the <a href=\"/devices.php\" target=\"_blank\">Devices</a> page.",
"UI_PRESENCE_name": "Show in presence chart",
"UI_REFRESH_description": "Enter number of seconds after which the UI reloads. Set to <code>0</code> to disable.",
"UI_REFRESH_name": "Auto-refresh UI",

View File

@@ -291,6 +291,7 @@
"Gen_DataUpdatedUITakesTime": "Correcto - La interfaz puede tardar en actualizarse si se está ejecutando un escaneo.",
"Gen_Delete": "Eliminar",
"Gen_DeleteAll": "Eliminar todo",
"Gen_Description": "",
"Gen_Error": "Error",
"Gen_Filter": "Filtro",
"Gen_LockedDB": "Fallo - La base de datos puede estar bloqueada - Pulsa F1 -> Ajustes de desarrolladores -> Consola o prueba más tarde.",
@@ -634,6 +635,7 @@
"Setting_Override": "Sobreescribir el valor",
"Setting_Override_Description": "Habilitar esta opción anulará un valor predeterminado proporcionado por la aplicación con el valor especificado anteriormente.",
"Settings_Metadata_Toggle": "Mostrar/ocultar los metadatos de la configuración.",
"Settings_Show_Description": "",
"Settings_Title": "<i class=\"fa fa-cog\"> Configuración</i>",
"Settings_device_Scanners_desync": "⚠ Los horarios del escáner de los dispositivos no están sincronizados.",
"Settings_device_Scanners_desync_popup": "Los horarios de escáneres de dispositivos (<code> *_RUN_SCHD</code> ) no son lo mismo. Esto resultará en notificaciones inconsistentes del dispositivo en línea/fuera de línea. A menos que sea así, utilice el mismo horario para todos los habilitados.<b> 🔍Escáneres de dispositivos</b> .",

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "OK - cela peut prendre du temps à l'interface pour se mettre à jour si un scan est en cours.",
"Gen_Delete": "Supprimer",
"Gen_DeleteAll": "Supprimer tous",
"Gen_Description": "",
"Gen_Error": "Erreur",
"Gen_Filter": "Filtrer",
"Gen_LockedDB": "Erreur - La base de données est peut-être verrouillée - Vérifier avec les outils de dév via F12 -> Console ou essayer plus tard.",
@@ -567,6 +568,7 @@
"Setting_Override": "Remplacer la valeur",
"Setting_Override_Description": "Activer cette option va remplacer la valeur fournie par défaut par une application par la valeur renseignée au-dessus.",
"Settings_Metadata_Toggle": "Afficher/masquer les méta données pour le paramètre sélectionné.",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "⚠ La planification des différents scanners d'appareils est désynchronisée.",
"Settings_device_Scanners_desync_popup": "La planification des scanners (<code>*_RUN_SCHD</code>) n'est pas identique entre scanners. Cela va entraîner des notifications en ligne/hors-ligne non cohérentes. À moins que cela soit attendu, utilisez la même planification pour tous les <b>🔍scanners d'appareils</b> activés.",
"Speedtest_Results": "Résultats du test de débit",

4
front/php/templates/language/it_it.json Executable file → Normal file
View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "OK: l'aggiornamento dell'interfaccia utente potrebbe richiedere del tempo se è in esecuzione una scansione.",
"Gen_Delete": "Elimina",
"Gen_DeleteAll": "Elimina tutti",
"Gen_Description": "Descrizione",
"Gen_Error": "Errore",
"Gen_Filter": "Filtro",
"Gen_LockedDB": "ERRORE: il DB potrebbe essere bloccato, controlla F12 Strumenti di sviluppo -> Console o riprova più tardi.",
@@ -567,6 +568,7 @@
"Setting_Override": "Sovrascrivi valore",
"Setting_Override_Description": "L'abilitazione di questa opzione sovrascriverà il valore predefinito fornito dall'app con il valore specificato sopra.",
"Settings_Metadata_Toggle": "Mostra/nascondi i metadati per l'impostazione specificata.",
"Settings_Show_Description": "Mostra descrizione dell'impostazione.",
"Settings_device_Scanners_desync": "⚠ Le pianificazioni dello scanner del dispositivo non sono sincronizzate.",
"Settings_device_Scanners_desync_popup": "Gli orari degli scanner dei dispositivi (<code>*_RUN_SCHD</code>) non sono gli stessi. Questo comporterà notifiche online/offline incoerenti del dispositivo. A meno che ciò non sia previsto, utilizza la stessa pianificazione per tutti gli <b>🔍Scanner dispositivi</b> abilitati.",
"Speedtest_Results": "Risultati test di velocità",
@@ -699,4 +701,4 @@
"settings_update_item_warning": "Aggiorna il valore qui sotto. Fai attenzione a seguire il formato precedente. <b>La convalida non viene eseguita.</b>",
"test_event_icon": "fa-vial-circle-check",
"test_event_tooltip": "Salva le modifiche prima di provare le nuove impostazioni."
}
}

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "OK - Det kan ta litt tid før brukergrensesnittet oppdateres hvis en skanning kjøres.",
"Gen_Delete": "Slett",
"Gen_DeleteAll": "Slett alle",
"Gen_Description": "",
"Gen_Error": "Feil",
"Gen_Filter": "Filter",
"Gen_LockedDB": "FEIL - DB kan være låst - Sjekk F12 Dev tools -> Konsoll eller prøv senere.",
@@ -567,6 +568,7 @@
"Setting_Override": "Overstyr verdi",
"Setting_Override_Description": "Aktivering av dette alternativet vil overstyre en App som leveres standard-verdi med verdien som er spesifisert ovenfor.",
"Settings_Metadata_Toggle": "Vis/skjul metadata for den gitte innstillingen.",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "⚠ Enhetsskanning tidsplan er ikke synkronisert lenger.",
"Settings_device_Scanners_desync_popup": "Tidsplanene for enhetsskanning (<code>*_RUN_SCHD</code>) er ikke de samme. Dette vil føre til inkonsekvent enhet på online/offline varsler. Med mindre dette er ment, kan du bruke den samme tidsplanen for alle aktiverte <b> 🔍Enhets-skannere</b>.",
"Speedtest_Results": "Speedtest resultater",

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "OK - Aktualizacja UI może chwile potrwać jeżeli wykonywany jest skan.",
"Gen_Delete": "Usuń",
"Gen_DeleteAll": "Usuń wszystko",
"Gen_Description": "",
"Gen_Error": "Błąd",
"Gen_Filter": "Filtr",
"Gen_LockedDB": "BŁĄD - BAZA DANYCH może być zablokowana - Sprawdź F12 narzędzia dewelopera -> Konsola lub spróbuj ponownie później.",
@@ -567,6 +568,7 @@
"Setting_Override": "Nadpisz wartość",
"Setting_Override_Description": "Włączanie tej opcji nadpisze podstawową wartość na wartość podaną powyżej.",
"Settings_Metadata_Toggle": "Pokaż/Ukryj metadane dla podanego ustawienia.",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "⚠ Harmonogramy skanowania urządzeń są niesynchronizowane.",
"Settings_device_Scanners_desync_popup": "Harmonogramy skanowania urządzeń (<code>*_RUN_SCHD</code>) nie są takie same. Powodować to będzie nierównomierne powiadomienia o urządzeniach włączynych/wyłączonych. Jeżeli nie jest to zamierzone to proszę włączyć ten sam harmonogram dla wszyskich <b>🔍Skanerów Urządzeń</b>.",
"Speedtest_Results": "Wyniki Testu Prędkości",

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "OK - Pode levar um tempo para a interface do usuário ser atualizada se uma verificação estiver em execução.",
"Gen_Delete": "Excluir",
"Gen_DeleteAll": "Excluir todos",
"Gen_Description": "",
"Gen_Error": "Erro",
"Gen_Filter": "Filtro",
"Gen_LockedDB": "ERRO - O banco de dados pode estar bloqueado - Verifique F12 Ferramentas de desenvolvimento -> Console ou tente mais tarde.",
@@ -567,6 +568,7 @@
"Setting_Override": "",
"Setting_Override_Description": "",
"Settings_Metadata_Toggle": "",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "",
"Settings_device_Scanners_desync_popup": "",
"Speedtest_Results": "",

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "ОК - Обновление UI может занять некоторое время, если сканирование выполняется.",
"Gen_Delete": "Удалить",
"Gen_DeleteAll": "Удалить все",
"Gen_Description": "",
"Gen_Error": "Ошибка",
"Gen_Filter": "Фильтр",
"Gen_LockedDB": "ОШИБКА - Возможно, база данных заблокирована. Проверьте инструменты разработчика F12 -> Консоль или повторите попытку позже.",
@@ -567,6 +568,7 @@
"Setting_Override": "Переопределить значение",
"Setting_Override_Description": "Включение этой опции приведет к переопределению значения по умолчанию, предоставленного приложением, на значение, указанное выше.",
"Settings_Metadata_Toggle": "Показать/скрыть метаданные для данного параметра.",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "⚠ Расписания сканера устройств не синхронизированы.",
"Settings_device_Scanners_desync_popup": "Расписания сканеров устройств (<code>*_RUN_SCHD</code>) не совпадают. Это приведет к несогласованным онлайн/оффлайн уведомлениям устройства. Если это не предусмотрено, используйте одно и то же расписание для всех включенных <b>🔍Сканеров устройств</b>.",
"Speedtest_Results": "Результаты теста скорости",

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "TAMAM - Eğer bir tarama çalışıyorsa arayüzün güncellenmesi biraz zaman alabilir",
"Gen_Delete": "Sil",
"Gen_DeleteAll": "Tümünü sil",
"Gen_Description": "",
"Gen_Error": "Hata",
"Gen_Filter": "Filtre",
"Gen_LockedDB": "",
@@ -567,6 +568,7 @@
"Setting_Override": "",
"Setting_Override_Description": "",
"Settings_Metadata_Toggle": "",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "",
"Settings_device_Scanners_desync_popup": "",
"Speedtest_Results": "",

View File

@@ -281,6 +281,7 @@
"Gen_DataUpdatedUITakesTime": "好的 - 如果扫描正在运行UI 可能需要一段时间才能更新。",
"Gen_Delete": "删除",
"Gen_DeleteAll": "全部删除",
"Gen_Description": "",
"Gen_Error": "错误",
"Gen_Filter": "筛选",
"Gen_LockedDB": "错误 - DB 可能被锁定 - 检查 F12 开发工具 -> 控制台或稍后重试。",
@@ -567,6 +568,7 @@
"Setting_Override": "覆盖值",
"Setting_Override_Description": "启用此选项将用上面指定的值覆盖应用程序提供的默认值。",
"Settings_Metadata_Toggle": "显示/隐藏给定设置的元数据。",
"Settings_Show_Description": "",
"Settings_device_Scanners_desync": "⚠ 设备扫描计划不同步。",
"Settings_device_Scanners_desync_popup": "设备扫描 (<code>*_RUN_SCHD</code>) 的时间表并不相同。这将导致设备在线/离线通知不一致。除非有意为之,否则请对所有启用的 <b>🔍设备扫描</b> 使用相同的时间表。",
"Speedtest_Results": "Speedtest 结果",

View File

@@ -8,7 +8,7 @@ NetAlertX supports additional plugins to extend its functionality, each with its
## ⚡ Quick start
> [!TIP]
> You can load additional Plugins via the General -> `LOADED_PLUGINS` setting. Use `Ctrl + Click` to select/deselect.
> You can load additional Plugins via the General -> `LOADED_PLUGINS` setting.
1. Pick your `🔍 dev scanner` plugin (e.g. `ARPSCAN` or `NMAPDEV`), or import devices into the application with an `📥 importer` plugin. (See **✅Enabling plugins** below)
2. Pick a `▶️ publisher` plugin, if you want to send notifications. If you don't see a publisher you'd like to use, look at the [📚_publisher_apprise](/front/plugins/_publisher_apprise/) plugin which is a proxy for over 80 notification services.

View File

@@ -259,9 +259,13 @@
"function": "CMD",
"type": {
"dataType": "string",
"element": "input",
"elementOptions": ["readonly"],
"transformers": []
"elements": [
{
"elementType": "input",
"elementOptions": [{ "readonly": "true" }],
"transformers": []
}
]
},
"default_value": "python3 /app/front/plugins/<plugin folder>/rename_me.py",
"options": [],

View File

@@ -2,7 +2,7 @@
"code_name": "dhcp_servers",
"unique_prefix": "DHCPSRVS",
"plugin_type": "other",
"execution_order" : "Layer_3",
"execution_order": "Layer_3",
"enabled": true,
"data_source": "script",
"show_ui": true,
@@ -349,7 +349,11 @@
"type": {
"dataType": "string",
"elements": [
{ "elementType": "input", "elementOptions": [], "transformers": [] }
{
"elementType": "input",
"elementOptions": [{ "readonly": "true" }],
"transformers": []
}
]
},
"default_value": "python3 /app/front/plugins/dhcp_servers/script.py",

View File

@@ -65,15 +65,15 @@
"description": [
{
"language_code": "en_us",
"string": "Specifies which events trigger notifications. Remove the event type(s) you do not want to get notified on. This setting overrides device-specific settings in the UI. (<code>CTRL + Click</code> to select/deselect)."
"string": "Specifies which events trigger notifications. Remove the event type(s) you do not want to get notified on. This setting overrides device-specific settings in the UI."
},
{
"language_code": "de_de",
"string": "Spezifiziert, bei welchen Events Benachrichtigungen versendet werden. Entfernen Sie die Eventtypen, bei welchen Sie nicht benachrichtigt werden wollen. Diese Einstellung überschreibt gerätespezifische Einstellungen im UI. (<code>STRG + klicken</code> zum aus-/abwählen)."
"string": "Spezifiziert, bei welchen Events Benachrichtigungen versendet werden. Entfernen Sie die Eventtypen, bei welchen Sie nicht benachrichtigt werden wollen. Diese Einstellung überschreibt gerätespezifische Einstellungen im UI."
},
{
"language_code": "es_es",
"string": "Especifica que eventos envían notificaciones. Elimina los tipos de eventos de los que no quieras recibir notificaciones. Este ajuste sobreescribe los ajustes específicos de los dispositivos en la interfaz. (<code>CTRL + Clic</code> para seleccionar / deseleccionar)."
"string": "Especifica que eventos envían notificaciones. Elimina los tipos de eventos de los que no quieras recibir notificaciones. Este ajuste sobreescribe los ajustes específicos de los dispositivos en la interfaz."
}
]
},
@@ -125,7 +125,7 @@
"description": [
{
"language_code": "en_us",
"string": "You can specify a SQL where condition to filter out New Devices from notifications. For example <code>AND dev_LastIP NOT LIKE '192.168.3.%'</code> will always exlude New Device notifications for all devices with the IP starting with <code>192.168.3.%</code>."
"string": "You can specify a SQL where condition to filter out New Devices from notifications. For example <code>AND dev_LastIP NOT LIKE '192.168.3.%'</code> will always exclude New Device notifications for all devices with the IP starting with <code>192.168.3.%</code>."
}
]
},
@@ -149,7 +149,7 @@
"description": [
{
"language_code": "en_us",
"string": "You can specify a SQL where condition to filter out Events from notifications. For example <code>AND dev_LastIP NOT LIKE '192.168.3.%'</code> will always exlude New Device notifications for all devices with the IP starting with <code>192.168.3.%</code>."
"string": "You can specify a SQL where condition to filter out Events from notifications. For example <code>AND dev_LastIP NOT LIKE '192.168.3.%'</code> will always exclude New Device notifications for all devices with the IP starting with <code>192.168.3.%</code>."
}
]
}

View File

@@ -3,7 +3,7 @@
"show_ui": true,
"unique_prefix": "UNFIMP",
"plugin_type": "device_scanner",
"execution_order" : "Layer_1",
"execution_order": "Layer_1",
"data_source": "script",
"localized": ["display_name", "description", "icon"],
"display_name": [
@@ -560,7 +560,11 @@
"type": {
"dataType": "string",
"elements": [
{ "elementType": "input", "elementOptions": [], "transformers": [] }
{
"elementType": "input",
"elementOptions": [{ "readonly": "true" }],
"transformers": []
}
]
}
},

View File

@@ -238,7 +238,7 @@ def get_ip(*ips: str) -> str:
for ip in ips:
if ip and ip != 'null':
return ip
return '0:0:0:0'
return '0.0.0.0'
# -----------------------------------------------------------------------------

View File

@@ -398,26 +398,32 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
{
// hide metadata by default by assigning it a special class
isMetadata ? metadataClass = 'metadata' : metadataClass = '';
isMetadata ? infoIcon = '' : infoIcon = `<i
isMetadata ? showMetadata = '' : showMetadata = `<i
my-to-toggle="row_${codeName}__metadata"
title="${getString("Settings_Metadata_Toggle")}"
class="fa fa-circle-question pointer"
class="fa fa-circle-question pointer hideOnMobile"
onclick="toggleMetadata(this)">
</i>` ;
infoIcon = `<i my-to-show="#row_${codeName} .setting_description"
title="${getString("Settings_Show_Description")}"
class="fa fa-circle-info pointer hideOnBigScreen"
onclick="showDescription(this)">
</i>` ;
// NAME & DESCRIPTION columns
setHtml += `
<div class="row table_row ${metadataClass}" id="row_${codeName}">
<div class="table_cell setting_name bold">
<div class="row table_row ${metadataClass} " id="row_${codeName}">
<div class="table_cell setting_name bold col-sm-2">
<label>${getString(codeName + '_name', set['Display_Name'])}</label>
<div class="small text-overflow-hidden">
<code>${codeName}</code>${infoIcon}
<code>${codeName}</code>${showMetadata}${infoIcon}
</div>
</div>
<div class="table_cell setting_description">
<div class="table_cell setting_description col-sm-4">
${getString(codeName + '_description', set['Description'])}
</div>
<div class="table_cell input-group setting_input ${overriddenByEnv ? "setting_overriden_by_env" : ""} input-group col-sm-12">
<div class="table_cell input-group setting_input ${overriddenByEnv ? "setting_overriden_by_env" : ""} input-group col-xs-12 col-sm-6">
`;
// OVERRIDE

View File

@@ -41,6 +41,39 @@ class Device_obj:
return result[column_name] if result else None
#-------------------------------------------------------------------------------
# Removing devices from the CurrentScan DB table which the user chose to ignore by MAC or IP
def exclude_ignored_devices(db):
sql = db.sql # Database interface for executing queries
mac_condition = list_to_where('OR', 'cur_MAC', 'LIKE', get_setting_value('NEWDEV_ignored_MACs'))
ip_condition = list_to_where('OR', 'cur_IP', 'LIKE', get_setting_value('NEWDEV_ignored_IPs'))
# Only delete if either the MAC or IP matches an ignored condition
conditions = []
if mac_condition:
conditions.append(mac_condition)
if ip_condition:
conditions.append(ip_condition)
# Join conditions and prepare the query
conditions_str = " OR ".join(conditions)
if conditions_str:
query = f"""DELETE FROM CurrentScan WHERE
1=1
AND (
{conditions_str}
)
"""
else:
query = "DELETE FROM CurrentScan WHERE 1=1 AND 1=0" # No valid conditions, prevent deletion
mylog('debug', f'[New Devices] Excluding Ignored Devices Query: {query}')
sql.execute(query)
#-------------------------------------------------------------------------------
def save_scanned_devices (db):
sql = db.sql #TO-DO
@@ -145,13 +178,11 @@ def create_new_devices (db):
SELECT cur_MAC, cur_IP, '{startTime}', 'New Device', cur_Vendor, 1
FROM CurrentScan
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'))}
WHERE dev_MAC = cur_MAC)
"""
mylog('debug',f'[New Devices] Query: {query}')
mylog('debug',f'[New Devices] Log Events Query: {query}')
sql.execute(query)
@@ -163,27 +194,25 @@ def create_new_devices (db):
FROM CurrentScan
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
mylog('debug','[New Devices] 2 Create devices')
# default New Device values preparation
newDevColumns = """dev_AlertEvents,
dev_AlertDeviceDown,
dev_PresentLastScan,
dev_Archived,
dev_NewDevice,
dev_SkipRepeated,
dev_ScanCycle,
dev_Owner,
dev_Favorite,
dev_Group,
dev_Comments,
dev_LogEvents,
dev_Location"""
newDevColumns = """dev_AlertEvents,
dev_AlertDeviceDown,
dev_PresentLastScan,
dev_Archived,
dev_NewDevice,
dev_SkipRepeated,
dev_ScanCycle,
dev_Owner,
dev_Favorite,
dev_Group,
dev_Comments,
dev_LogEvents,
dev_Location"""
newDevDefaults = f"""{get_setting_value('NEWDEV_dev_AlertEvents')},
{get_setting_value('NEWDEV_dev_AlertDeviceDown')},
@@ -199,8 +228,13 @@ def create_new_devices (db):
{get_setting_value('NEWDEV_dev_LogEvents')},
'{sanitize_SQL_input(get_setting_value('NEWDEV_dev_Location'))}'"""
# Fetch data from CurrentScan
current_scan_data = sql.execute("SELECT cur_MAC, cur_Name, cur_Vendor, cur_IP, cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, cur_NetworkSite, cur_SSID, cur_Type FROM CurrentScan").fetchall()
# Fetch data from CurrentScan skipping ignored devices by IP and MAC
query = f"""SELECT cur_MAC, cur_Name, cur_Vendor, cur_IP, cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, cur_NetworkSite, cur_SSID, cur_Type
FROM CurrentScan """
mylog('debug',f'[New Devices] Collecting New Devices Query: {query}')
current_scan_data = sql.execute(query).fetchall()
for row in current_scan_data:
cur_MAC, cur_Name, cur_Vendor, cur_IP, cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, cur_NetworkSite, cur_SSID, cur_Type = row

View File

@@ -462,19 +462,23 @@ def list_to_where(logical_operator, column_name, condition_operator, values_list
- A string representing the WHERE condition.
"""
# If the list is empty, return an empty string
if not values_list:
return " AND 1=1 " # Return a conditioneitehr way if the list is empty to avoid breaking the SQL condition.
return ""
# Replace {s-quote} with single quote in values_list
values_list = [value.replace("{s-quote}", "'") for value in values_list]
# Build the WHERE condition
# Build the WHERE condition for the first value
condition = f"{column_name} {condition_operator} '{values_list[0]}'"
# Add the rest of the values using the logical operator
for value in values_list[1:]:
condition += f" {logical_operator} {column_name} {condition_operator} '{value}'"
return f' AND ({condition}) '
return f'({condition})'

View File

@@ -3,7 +3,7 @@
import conf
from device import create_new_devices, print_scan_stats, save_scanned_devices, update_devices_data_from_scan
from device import create_new_devices, print_scan_stats, save_scanned_devices, update_devices_data_from_scan, exclude_ignored_devices
from helper import timeNowTZ
from logger import mylog
from reporting import skip_repeated_notifications
@@ -16,7 +16,11 @@ from reporting import skip_repeated_notifications
def process_scan (db):
# Load current scan data
# Apply exclusions
mylog('verbose','[Process Scan] Exclude ignored devices')
exclude_ignored_devices (db)
# Load current scan data
mylog('verbose','[Process Scan] Processing scan results')
save_scanned_devices (db)