diff --git a/front/php/templates/language/ca_ca.json b/front/php/templates/language/ca_ca.json
index 061fe19c..277ea0d3 100755
--- a/front/php/templates/language/ca_ca.json
+++ b/front/php/templates/language/ca_ca.json
@@ -29,7 +29,7 @@
"BackDevDetail_Actions_Ask_Run": "Vol executar aquesta comanda?",
"BackDevDetail_Actions_Not_Registered": "Comanda no registrada: ",
"BackDevDetail_Actions_Title_Run": "Executar la comanda",
- "BackDevDetail_Copy_Ask": "Copiar detalls del dispositius des de la llista desplegable? Tot el d'aquesta pàgina es sobre-escriurà",
+ "BackDevDetail_Copy_Ask": "Copiar detalls del dispositius des de la llista desplegable (Tot el d'aquesta pàgina es sobre-escriurà) ?",
"BackDevDetail_Copy_Title": "Copiar detalls",
"BackDevDetail_Tools_WOL_error": "La comanda NO s'ha executat.",
"BackDevDetail_Tools_WOL_okay": "La comanda s'ha executat.",
@@ -64,7 +64,7 @@
"DAYS_TO_KEEP_EVENTS_name": "Esborrar esdeveniments més vells de",
"DevDetail_Copy_Device_Title": " Copiar detalls des del dispositiu",
"DevDetail_Copy_Device_Tooltip": "Copiar detalls del dispositius des de la llista desplegable. Tot el d'aquesta pàgina es sobre-escriurà",
- "DevDetail_DisplayFields_Title": "",
+ "DevDetail_DisplayFields_Title": "Pantalla",
"DevDetail_EveandAl_AlertAllEvents": "Alertes",
"DevDetail_EveandAl_AlertDown": "Cancel·lar alerta",
"DevDetail_EveandAl_Archived": "Arxivat",
@@ -134,7 +134,7 @@
"DevDetail_Shortcut_Presence": "Presència",
"DevDetail_Shortcut_Sessions": "Sessions",
"DevDetail_Tab_Details": " Detalls",
- "DevDetail_Tab_Events": "Esdeveniments",
+ "DevDetail_Tab_Events": " Esdeveniments",
"DevDetail_Tab_EventsTableDate": "Data",
"DevDetail_Tab_EventsTableEvent": "Tipus d'esdeveniment",
"DevDetail_Tab_EventsTableIP": "IP",
@@ -185,7 +185,7 @@
"DevDetail_button_OverwriteIcons_Warning": "Estàs segur que vols sobreescriure totes les icones de tots els dispositius amb el mateix tipus de dispositiu que el tipus de dispositiu actual?",
"DevDetail_button_Reset": "Restablir canvis",
"DevDetail_button_Save": "Guardar",
- "DeviceEdit_ValidMacIp": "",
+ "DeviceEdit_ValidMacIp": "Entra una adreça IP i Mac vàlides.",
"Device_MultiEdit": "Multi-edició",
"Device_MultiEdit_Backup": "Atenció, entrar valors incorrectes a continuació trencarà la configuració. Si us plau, abans feu còpia de seguretat la vostra base de dades o configuració de Dispositius (clic per descarregar ). Llegiu com per recuperar Dispositius des d'aquest fitxer al documentació de Còpies de seguretat.",
"Device_MultiEdit_Fields": "Editar camps:",
@@ -280,7 +280,7 @@
"GRAPHQL_PORT_name": "Port GraphQL",
"Gen_Action": "Acció",
"Gen_Add": "Afegir",
- "Gen_AddDevice": "",
+ "Gen_AddDevice": "Afegir dispositiu",
"Gen_Add_All": "Afegeix tot",
"Gen_All_Devices": "Tots els dispositius",
"Gen_AreYouSure": "Estàs segur?",
@@ -298,7 +298,7 @@
"Gen_LockedDB": "ERROR - DB podria estar bloquejada - Fes servir F12 Eines desenvolupament -> Consola o provar-ho més tard.",
"Gen_Offline": "Fora de línia",
"Gen_Okay": "Ok",
- "Gen_Online": "",
+ "Gen_Online": "En línia",
"Gen_Purge": "Elimina",
"Gen_ReadDocs": "Llegit més dins el docs.",
"Gen_Remove_All": "Esborra tot",
@@ -317,7 +317,7 @@
"Gen_Update_Value": "Actualitzar Valor",
"Gen_Warning": "Advertència",
"Gen_Work_In_Progress": "Work in progress, un bon moment per retroalimentació a https://github.com/jokob-sk/NetAlertX/issues",
- "Gen_create_new_device": "",
+ "Gen_create_new_device": "Crear un dispositiu simulat",
"General_display_name": "General",
"General_icon": "",
"HRS_TO_KEEP_NEWDEV_description": "Això és un paràmetre de manteniment ELIMINANT dispositius. Si s'activa (0 està desactivat), els dispositius marcats com Dispositiu Nou seran eliminats si el temps de Primera Sessió es més vell que les hores especificades en aquest paràmetre. Faci servir aquest paràmetre si vol auto-eliminar Nous Dispositius després de X hores.",
@@ -581,7 +581,7 @@
"REPORT_MAIL_description": "Si està activat s'envia un correu electrònic amb una llista de canvis als quals s'ha subscrit. Si us plau, ompli tots els paràmetres restants relacionats amb la configuració SMTP. Si té problemes, configuri LOG_LEVEL i debug comprovi el registre d'errors.",
"REPORT_MAIL_name": "Activa el correu electrònic",
"REPORT_TITLE": "Informe",
- "RandomMAC_hover": "Auto detectat - indica que el dispositiu aleatoritza l'adreça MAC.",
+ "RandomMAC_hover": "Auto detectat - indica que el dispositiu aleatoritza l'adreça MAC. Pots excloure MACs específiques amb la configuració UI_NOT_RANDOM_MAC. Fes click per saber més.",
"Reports_Sent_Log": "Registre d'informes enviats",
"SCAN_SUBNETS_description": "La majoria dels escàners en xarxa (ARP-SCAN, NMAP, NSLOOKUP, DIG) es basen en l'exploració d'interfícies de xarxa específiques i subxarxes. Comproveu la documentació de subxarxes per ajudar en aquesta configuració, especialment VLANs, i quines VLANs són compatibles, o com esbrinar la màscara de xarxa i la seva interfície.
Una alternativa als escàners en xarxa és activar alguns altres escàners / importadors de dispositius que no requereixin NetAlertX per tenir accés a la xarxa (UNIFI, dhcp. leases, PiHole, etc.).
Nota: El temps d'exploració en si mateix depèn del nombre d'adreces IP per verificar, així que s'ha establir amb cura amb la màscara i la interfície de xarxa adequats.",
"SCAN_SUBNETS_name": "Xarxes per escanejar",
@@ -597,7 +597,7 @@
"Systeminfo_CPU_Cores": "Nuclis de CPU:",
"Systeminfo_CPU_Name": "Nom de CPU:",
"Systeminfo_CPU_Speed": "Velocitat de CPU:",
- "Systeminfo_CPU_Temp": "CPU Temp:",
+ "Systeminfo_CPU_Temp": "Temp CPU:",
"Systeminfo_CPU_Vendor": "Venedor de CPU:",
"Systeminfo_Client_Resolution": "Resolució del navegador:",
"Systeminfo_Client_User_Agent": "Agent d'usuari:",
@@ -722,5 +722,13 @@
"settings_system_label": "Sistema",
"settings_update_item_warning": "Actualitza el valor sota. Sigues curós de seguir el format anterior. No hi ha validació.",
"test_event_icon": "fa-vial-circle-check",
- "test_event_tooltip": "Deseu els canvis primer abans de comprovar la configuració."
+ "test_event_tooltip": "Deseu els canvis primer abans de comprovar la configuració.",
+ "add_icon_event_tooltip": "Afegir nova icona",
+ "add_option_event_icon": "fa-square-plus",
+ "copy_icons_event_icon": "fa-copy",
+ "go_to_node_event_icon": "fa-square-up-right",
+ "go_to_node_event_tooltip": "Navegació a la pàgina de la Xarxa del node donat",
+ "add_icon_event_icon": "fa-square-plus",
+ "add_option_event_tooltip": "Afegir nou valor",
+ "copy_icons_event_tooltip": "Sobreescriure icones de tots els dispositius amb el mateix tipus de dispositiu"
}
diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json
index d690bccc..ed9c4f39 100755
--- a/front/php/templates/language/de_de.json
+++ b/front/php/templates/language/de_de.json
@@ -1,8 +1,8 @@
{
"API_CUSTOM_SQL_description": "Benutzerdefinierte SQL-Abfrage, welche eine JSON-Datei generiert und diese mit dem Dateiendpunkt table_custom_endpoint.json zur Verfügung stellt.",
"API_CUSTOM_SQL_name": "Benutzerdefinierte SQL-Abfrage",
- "API_TOKEN_description": "",
- "API_TOKEN_name": "",
+ "API_TOKEN_description": "API-Token zur Absicherung der Kommunikation – Sie können einen generieren oder einen beliebigen Wert eingeben. Er wird im Anfrage-Header übermittelt. Wird im SYNC-Plugin und GraphQL-Server verwendet.",
+ "API_TOKEN_name": "API-Schlüssel",
"API_display_name": "API",
"API_icon": "",
"APPRISE_HOST_description": "Apprise host URL starting with http:// or https://. (do not forget to include /notify at the end)",
@@ -70,28 +70,28 @@
"BackDevices_Restore_okay": "Die Wiederherstellung wurde erfolgreich ausgeführt.",
"BackDevices_darkmode_disabled": "Heller Modus aktiviert",
"BackDevices_darkmode_enabled": "Dunkler Modus aktiviert",
- "CLEAR_NEW_FLAG_description": "",
+ "CLEAR_NEW_FLAG_description": "Wenn aktiviert (0 bedeutet deaktiviert), werden Geräte, die als Neues Gerät gekennzeichnet sind, wieder freigegeben, wenn das Zeitlimit (in Stunden) die Zeit ihrer Ersten Sitzung überschreitet.",
"CLEAR_NEW_FLAG_name": "Neues Flag löschen",
"DAYS_TO_KEEP_EVENTS_description": "Dies ist eine Wartungseinstellung. Spezifiziert wie viele Tage Events gespeichert bleiben. Alle älteren Events werden periodisch gelöscht. Wird auch auf die Plugins History angewendet.",
- "DAYS_TO_KEEP_EVENTS_name": "Lösche Events älter als",
- "DevDetail_Copy_Device_Title": " Details von Gerät kopieren",
+ "DAYS_TO_KEEP_EVENTS_name": "Ereignisse löschen, die älter sind als",
+ "DevDetail_Copy_Device_Title": "Details von Gerät kopieren",
"DevDetail_Copy_Device_Tooltip": "Details vom Gerät aus der Dropdown-Liste kopieren. Alles auf dieser Seite wird überschrieben",
- "DevDetail_DisplayFields_Title": "",
- "DevDetail_EveandAl_AlertAllEvents": "Melde alle Ereignisse",
+ "DevDetail_DisplayFields_Title": "Anzeige",
+ "DevDetail_EveandAl_AlertAllEvents": "Alarmereignisse",
"DevDetail_EveandAl_AlertDown": "Melde Down",
- "DevDetail_EveandAl_Archived": "Archivierung",
+ "DevDetail_EveandAl_Archived": "Archiviert",
"DevDetail_EveandAl_NewDevice": "Neues Gerät",
- "DevDetail_EveandAl_NewDevice_Tooltip": "",
+ "DevDetail_EveandAl_NewDevice_Tooltip": "Zeigt den Status „Neu“ für das Gerät an und nimmt es in Listen auf, wenn der Filter „Neue Geräte“ aktiv ist. Hat keine Auswirkungen auf Benachrichtigungen.",
"DevDetail_EveandAl_RandomMAC": "Zufällige MAC",
"DevDetail_EveandAl_ScanCycle": "Scan Abstand",
"DevDetail_EveandAl_ScanCycle_a": "Gerät scannen",
"DevDetail_EveandAl_ScanCycle_z": "Gerät nicht scannen",
"DevDetail_EveandAl_Skip": "pausiere wiederhol. Meldungen für",
- "DevDetail_EveandAl_Title": "Ereignisse & Alarme einstellen",
+ "DevDetail_EveandAl_Title": "Konfiguration der Benachrichtigungen",
"DevDetail_Events_CheckBox": "Blende Verbindungs-Ereignisse aus",
"DevDetail_GoToNetworkNode": "Zur Netzwerkseite des angegebenen Knotens navigieren.",
"DevDetail_Icon": "Icon",
- "DevDetail_Icon_Descr": "",
+ "DevDetail_Icon_Descr": "Geben Sie einen Font Awesome Icon-Namen ohne das Präfix „fa-“ ein oder die vollständige Klasse, z. B.: fa fa-brands fa-apple.",
"DevDetail_Loading": "Laden ...",
"DevDetail_MainInfo_Comments": "Notiz",
"DevDetail_MainInfo_Favorite": "Favorit",
@@ -197,7 +197,7 @@
"DevDetail_button_OverwriteIcons_Warning": "Bist du sicher, dass du alle Symbole aller Geräte mit dem gleichen Gerätetyp wie dem aktuellen Gerätetyp überschreiben willst?",
"DevDetail_button_Reset": "Verwerfen",
"DevDetail_button_Save": "Speichern",
- "DeviceEdit_ValidMacIp": "",
+ "DeviceEdit_ValidMacIp": "Gib eine gültige MAC- und IP-Adresse ein.",
"Device_MultiEdit": "Mehrfach-bearbeiten",
"Device_MultiEdit_Backup": "",
"Device_MultiEdit_Fields": "Felder bearbeiten:",
@@ -231,7 +231,7 @@
"Device_TableHead_Owner": "Eigentümer",
"Device_TableHead_Parent_MAC": "Übergeordnete MAC",
"Device_TableHead_Port": "Port",
- "Device_TableHead_PresentLastScan": "",
+ "Device_TableHead_PresentLastScan": "Anwesenheit",
"Device_TableHead_RowID": "Zeilen ID",
"Device_TableHead_Rowid": "Zeilennummer",
"Device_TableHead_SSID": "SSID",
@@ -288,11 +288,11 @@
"Events_Tablelenght": "Zeige _MENU_ Einträge",
"Events_Tablelenght_all": "Alle",
"Events_Title": "Ereignisse",
- "GRAPHQL_PORT_description": "",
- "GRAPHQL_PORT_name": "",
+ "GRAPHQL_PORT_description": "Die Portnummer des GraphQL-Servers.",
+ "GRAPHQL_PORT_name": "GraphQL-Port",
"Gen_Action": "Action",
"Gen_Add": "Hinzufügen",
- "Gen_AddDevice": "",
+ "Gen_AddDevice": "Gerät hinzufügen",
"Gen_Add_All": "Alle hinzufügen",
"Gen_All_Devices": "Alle Geräte",
"Gen_AreYouSure": "Sind Sie sich sicher?",
@@ -306,11 +306,11 @@
"Gen_Description": "Beschreibung",
"Gen_Error": "Fehler",
"Gen_Filter": "Filter",
- "Gen_Generate": "",
+ "Gen_Generate": "Generieren",
"Gen_LockedDB": "ERROR - DB eventuell gesperrt - Nutze die Konsole in den Entwickler Werkzeugen (F12) zur Überprüfung oder probiere es später erneut.",
"Gen_Offline": "Offline",
"Gen_Okay": "Ok",
- "Gen_Online": "",
+ "Gen_Online": "Online",
"Gen_Purge": "Aufräumen",
"Gen_ReadDocs": "Mehr in der Dokumentation.",
"Gen_Remove_All": "Alle entfernen",
@@ -335,7 +335,7 @@
"HRS_TO_KEEP_NEWDEV_description": "Dies ist eine Wartungseinstellung DELETING devices. Wenn aktiviert (0 bedeutet deaktiviert), werden als \"Neues Gerät\" markierte Geräte gelöscht, wenn ihre erste Sitzung länger her ist als in dieser Einstellung angegeben. Verwenden Sie diese Einstellung, wenn Sie Neue Geräte nach X Stunden automatisch löschen wollen.",
"HRS_TO_KEEP_NEWDEV_name": "Neue Geräte löschen nach",
"HRS_TO_KEEP_OFFDEV_description": "",
- "HRS_TO_KEEP_OFFDEV_name": "",
+ "HRS_TO_KEEP_OFFDEV_name": "Offline-Geräte löschen nach",
"HelpFAQ_Cat_Detail": "Detailansicht",
"HelpFAQ_Cat_Detail_300_head": "Was bedeutet ",
"HelpFAQ_Cat_Detail_300_text_a": "meint ein Netzwerkgerät (ein Gerät vom Typ AP, Gateway, Firewall, Hypervisor, Powerline, Switch, WLAN, PLC, Router, USB-LAN-Adapter oder Internet). Benutzerdefinierte Typen können über die NETWORK_DEVICE_TYPES Einstellung hinzugefügt werden.",
@@ -601,7 +601,7 @@
"Presence_CalHead_week": "Woche",
"Presence_CalHead_year": "Jahr",
"Presence_CallHead_Devices": "Geräte",
- "Presence_Key_OnlineNow": "",
+ "Presence_Key_OnlineNow": "Jetzt online",
"Presence_Key_OnlineNow_desc": "",
"Presence_Key_OnlinePast": "",
"Presence_Key_OnlinePastMiss": "",
@@ -772,7 +772,7 @@
"add_option_event_icon": "",
"add_option_event_tooltip": "",
"copy_icons_event_icon": "",
- "copy_icons_event_tooltip": "",
+ "copy_icons_event_tooltip": "Icons aller Geräte mit demselben Gerätetyp überschreiben",
"devices_old": "Aktualisiert...",
"general_event_description": "Das Ereignis, das Sie ausgelöst haben, könnte eine Weile dauern, bis Hintergrundprozesse abgeschlossen sind. Die Ausführung endet, wenn die unten ausgeführte Warteschlangen abgearbeitet ist. (Siehe error log, wenn Probleme auftreten.)
Ausführungsschlange:",
"general_event_title": "",
diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json
index 85a751a3..23cb9348 100755
--- a/front/php/templates/language/es_es.json
+++ b/front/php/templates/language/es_es.json
@@ -72,9 +72,9 @@
"CLEAR_NEW_FLAG_name": "Eliminar la nueva bandera",
"DAYS_TO_KEEP_EVENTS_description": "Esta es una configuración de mantenimiento. Esto especifica el número de días de entradas de eventos que se guardarán. Todos los eventos anteriores se eliminarán periódicamente.",
"DAYS_TO_KEEP_EVENTS_name": "Eliminar eventos anteriores a",
- "DevDetail_Copy_Device_Title": " Copiar detalles del dispositivo",
+ "DevDetail_Copy_Device_Title": "Copiar detalles del dispositivo",
"DevDetail_Copy_Device_Tooltip": "Copiar detalles del dispositivo de la lista desplegable. Todo en esta página se sobrescribirá",
- "DevDetail_DisplayFields_Title": "",
+ "DevDetail_DisplayFields_Title": "Mostrar",
"DevDetail_EveandAl_AlertAllEvents": "Notificaciones de eventos",
"DevDetail_EveandAl_AlertDown": "Alerta de caída",
"DevDetail_EveandAl_Archived": "Archivada",
@@ -195,7 +195,7 @@
"DevDetail_button_OverwriteIcons_Warning": "¿Sobreescribir todos los iconos de todos los dispositivos con el mismo tipo que el dispositivo actual?",
"DevDetail_button_Reset": "Restablecer cambios",
"DevDetail_button_Save": "Guardar",
- "DeviceEdit_ValidMacIp": "",
+ "DeviceEdit_ValidMacIp": "Introduzca una dirección Mac y una dirección IP válidas .",
"Device_MultiEdit": "Edición múltiple",
"Device_MultiEdit_Backup": "Tenga cuidado, ingresar valores incorrectos o romperá su configuración. Por favor, haga una copia de seguridad de su base de datos o de la configuración de los dispositivos primero (haga clic para descargar ). Lea cómo recuperar dispositivos de este archivo en la documentación de Copia de seguridad.",
"Device_MultiEdit_Fields": "Editar campos:",
@@ -290,7 +290,7 @@
"GRAPHQL_PORT_name": "Puerto GraphQL",
"Gen_Action": "Acción",
"Gen_Add": "Añadir",
- "Gen_AddDevice": "",
+ "Gen_AddDevice": "Añadir dispositivo",
"Gen_Add_All": "Añadir todo",
"Gen_All_Devices": "Todo los dispositivos",
"Gen_AreYouSure": "¿Estás seguro?",
@@ -308,7 +308,7 @@
"Gen_LockedDB": "Fallo - La base de datos puede estar bloqueada - Pulsa F1 -> Ajustes de desarrolladores -> Consola o prueba más tarde.",
"Gen_Offline": "Desconectado",
"Gen_Okay": "Aceptar",
- "Gen_Online": "",
+ "Gen_Online": "En linea",
"Gen_Purge": "Purgar",
"Gen_ReadDocs": "Lee más en los documentos.",
"Gen_Remove_All": "Quitar todo",
@@ -327,7 +327,7 @@
"Gen_Update_Value": "Actualizar valor",
"Gen_Warning": "Advertencia",
"Gen_Work_In_Progress": "Trabajo en curso, un buen momento para hacer comentarios en https://github.com/jokob-sk/NetAlertX/issues",
- "Gen_create_new_device": "",
+ "Gen_create_new_device": "Crear un dispositivo ficticio",
"General_display_name": "General",
"General_icon": "",
"HRS_TO_KEEP_NEWDEV_description": "Se trata de una configuración de mantenimiento BORRAR dispositivos. Si está activado (0 está desactivado), los dispositivos marcados como Nuevo dispositivo se eliminarán si su fecha de primera sesión es anterior a las horas especificadas en este ajuste. Use este ajuste si desea eliminar automáticamente Nuevos dispositivos después de X horas.",
@@ -634,7 +634,7 @@
"REPORT_TO_name": "Enviar el email a",
"REPORT_WEBHOOK_description": "Habilite webhooks para notificaciones. Los webhooks lo ayudan a conectarse a muchas herramientas de terceros, como IFTTT, Zapier o n8n, por nombrar algunas. Consulte esta sencilla guía de n8n aquí para obtener comenzó. Si está habilitado, configure los ajustes relacionados a continuación.",
"REPORT_WEBHOOK_name": "Habilitar webhooks",
- "RandomMAC_hover": "Autodetectado - indica si el dispositivo aleatoriza su dirección MAC.",
+ "RandomMAC_hover": "Autodetectado: indica si el dispositivo aleatoriza su dirección MAC. Puede excluir direcciones MAC específicas con la configuración UI_NOT_RANDOM_MAC. Haga clic para obtener más información.",
"Reports_Sent_Log": "Registro de informes enviados",
"SCAN_SUBNETS_description": "La mayoría de los escáneres en red (ARP-SCAN, NMAP, NSLOOKUP, DIG) se basan en el escaneo de interfaces de red y subredes específicas. Consulte la documentación sobre subredes para obtener ayuda sobre esta configuración, especialmente VLANs, qué VLANs son compatibles, o cómo averiguar la máscara de red y su interfaz.
Una alternativa a los escáneres en red es habilitar algunos otros escáneres/importadores de dispositivos que no dependen de que NetAlertX tenga acceso a la red (UNIFI, dhcp.leases, PiHole, etc.).
Nota: El tiempo de escaneo en sí depende del número de direcciones IP a comprobar, así que configure esto cuidadosamente con la máscara de red y la interfaz adecuadas.",
"SCAN_SUBNETS_name": "Subredes para escanear",
@@ -765,17 +765,17 @@
"Webhooks_display_name": "Webhooks",
"Webhooks_icon": "",
"Webhooks_settings_group": " Webhooks",
- "add_icon_event_icon": "",
- "add_icon_event_tooltip": "",
- "add_option_event_icon": "",
- "add_option_event_tooltip": "",
- "copy_icons_event_icon": "",
- "copy_icons_event_tooltip": "",
+ "add_icon_event_icon": "fa-square-plus",
+ "add_icon_event_tooltip": "Agregar nuevo icono",
+ "add_option_event_icon": "fa-square-plus",
+ "add_option_event_tooltip": "Añadir nuevo valor",
+ "copy_icons_event_icon": "fa-copy",
+ "copy_icons_event_tooltip": "Sobrescribir los iconos de todos los dispositivos con el mismo tipo de dispositivo",
"devices_old": "Volviendo a actualizar....",
"general_event_description": "El evento que ha activado puede tardar un poco hasta que finalicen los procesos en segundo plano. La ejecución finalizó una vez que se vacía la cola de ejecución a continuación (consulte el registro de errores si encuentra problemas).
Cola de ejecución:",
"general_event_title": "Ejecutar un evento ad-hoc",
- "go_to_node_event_icon": "",
- "go_to_node_event_tooltip": "",
+ "go_to_node_event_icon": "fa-square-up-right",
+ "go_to_node_event_tooltip": "Vaya a la página de Red del nodo indicado",
"report_guid": "Guía de las notificaciones:",
"report_guid_missing": "No se ha encontrado la notificación vinculada. Hay un pequeño retraso entre las notificaciones enviadas recientemente y su disponibilidad. Actualiza tu página y la caché después de unos segundos. También es posible que la notificación seleccionada se haya eliminado durante el mantenimiento, tal y como se especifica en la configuración de DBCLNP_NOTIFI_HIST.
En su lugar, se muestra la notificación más reciente. La notificación que falta tiene el siguiente GUID:",
"report_select_format": "Selecciona el formato:",
diff --git a/front/php/templates/language/fr_fr.json b/front/php/templates/language/fr_fr.json
index eabbc4f5..c71d35d9 100755
--- a/front/php/templates/language/fr_fr.json
+++ b/front/php/templates/language/fr_fr.json
@@ -29,7 +29,7 @@
"BackDevDetail_Actions_Ask_Run": "Voulez-vous exécuter cette action ?",
"BackDevDetail_Actions_Not_Registered": "Action non enregistrée : ",
"BackDevDetail_Actions_Title_Run": "Lancer l'action",
- "BackDevDetail_Copy_Ask": "Copier les détails des objets sélectionnés dans la liste (tout ce qui est présent sur cette page sera remplacé) ?",
+ "BackDevDetail_Copy_Ask": "Copier les détails de l'appareil depuis la liste (tout ce qui est présent sur cette page sera remplacé) ?",
"BackDevDetail_Copy_Title": "Copier les détails",
"BackDevDetail_Tools_WOL_error": "Cette commande N'A PAS été exécutée.",
"BackDevDetail_Tools_WOL_okay": "Commande exécutée.",
@@ -62,9 +62,9 @@
"CLEAR_NEW_FLAG_name": "Supprime le nouveau drapeau",
"DAYS_TO_KEEP_EVENTS_description": "Il s'agit d'un paramètre de maintenance. Il indique le nombre de jours pendant lesquels les entrées d'événements seront conservées. Tous les événements plus anciens seront supprimés périodiquement. S'applique également à l'historique des événements du plugin.",
"DAYS_TO_KEEP_EVENTS_name": "Supprimer les événements plus anciens que",
- "DevDetail_Copy_Device_Title": " Copier les détails de l'appareil",
+ "DevDetail_Copy_Device_Title": "Copier les détails de l'appareil",
"DevDetail_Copy_Device_Tooltip": "Copier les détails de l'appareil dans la liste déroulante. Tout ce qui se trouve sur cette page sera remplacé",
- "DevDetail_DisplayFields_Title": "",
+ "DevDetail_DisplayFields_Title": "Afficher",
"DevDetail_EveandAl_AlertAllEvents": "Alerter les événements",
"DevDetail_EveandAl_AlertDown": "Alerte de panne",
"DevDetail_EveandAl_Archived": "Archivés",
@@ -185,7 +185,7 @@
"DevDetail_button_OverwriteIcons_Warning": "Êtes-vous sûr de vouloir remplacer toutes les icônes de tous les appareils du même type que l'appareil actuel ?",
"DevDetail_button_Reset": "Réinitialiser les modifications",
"DevDetail_button_Save": "Enregistrer",
- "DeviceEdit_ValidMacIp": "",
+ "DeviceEdit_ValidMacIp": "Renseigner une adresse Mac et une adresse IP valides.",
"Device_MultiEdit": "Édition multiple",
"Device_MultiEdit_Backup": "Attention, renseigner des valeurs non cohérentes ci-dessous peut bloquer votre paramétrage. Veillez à faire une sauvegarde de votre base de données ou de la configuration de vos appareils en premier lieu (clisuer ici pour la télécharger ). Renseignez-vous sur comment remettre les appareils depuis ce fichier via la documentation des sauvegardes.",
"Device_MultiEdit_Fields": "Champs modifiables :",
@@ -280,7 +280,7 @@
"GRAPHQL_PORT_name": "Port GraphQL",
"Gen_Action": "Action",
"Gen_Add": "Ajouter",
- "Gen_AddDevice": "",
+ "Gen_AddDevice": "Ajouter un appareil",
"Gen_Add_All": "Ajouter tous",
"Gen_All_Devices": "Tous les appareils",
"Gen_AreYouSure": "Êtes-vous sûr ?",
@@ -298,7 +298,7 @@
"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.",
"Gen_Offline": "Hors ligne",
"Gen_Okay": "OK",
- "Gen_Online": "",
+ "Gen_Online": "En ligne",
"Gen_Purge": "Purger",
"Gen_ReadDocs": "Plus d'infos dans la documentation.",
"Gen_Remove_All": "Enlever tous",
@@ -317,7 +317,7 @@
"Gen_Update_Value": "Valeur à mettre à jour",
"Gen_Warning": "Avertissement",
"Gen_Work_In_Progress": "Travaux en cours, c'est le bon moment pour faire un retour via la liste d'anomalies sur Github https://github.com/jokob-sk/NetAlertX/issues",
- "Gen_create_new_device": "",
+ "Gen_create_new_device": "Créer un appareil fictif",
"General_display_name": "Général",
"General_icon": "",
"HRS_TO_KEEP_NEWDEV_description": "Paramètre de maintenance. S'il est activé (0 s'il est désactivé), les appareils marqués comme Nouvel appareil seront supprimés si leur durée depuis la première session est plus ancienne que le nombre d'heures paramétré. Utilisez ce paramétrage si vous voulez supprimer automatiquement les Nouveaux appareils après X heures.",
@@ -581,7 +581,7 @@
"REPORT_MAIL_description": "Si activé, un courriel est envoyé, avec la liste des changements pour lesquels on a souscrit. Cela nécessite de renseigner les paramètres associés au paramétrage SMTP plus bas. Si vous rencontrez des problèmes, positionnez le LOG_LEVEL au niveau debug et vérifiez les journaux d'erreurs.",
"REPORT_MAIL_name": "Activer les courriels",
"REPORT_TITLE": "Rapport",
- "RandomMAC_hover": "Détecté automatiquement - indique si l'appareil dispose d'une adresse MAC générée aléatoirement.",
+ "RandomMAC_hover": "Détecté automatiquement - indique si l'appareil dispose d'une adresse MAC générée aléatoirement. Vous pouvez exclure des adresses MAC spécifiques via le paramètre UI_NOT_RANDOM_MAC. Cliquez pour plus d'informations.",
"Reports_Sent_Log": "Rapports de log transmis",
"SCAN_SUBNETS_description": "La plupart des scanners sur le réseau (scan ARP, NMAP, Nslookup, DIG) se base sur le scan d'une partie spécifique des interfaces réseau ou de sous-réseau. Consulter la documentation des sous-réseaux pour plus d'aide sur ce paramètre, notamment pour des VLAN, lesquels sont supportés ou sur comment identifier le masque réseau et votre interface réseau.
Une alternative à ces scanner sur le réseau et d'activer d'autres scanners d'appareils ou des importe, qui ne dépendent pas du fait de laisser NetAlertX accéder au réseau (Unifié, baux DHCP, Pi-hole, etc.).
Remarque : la durée du scan en lui-même dépend du nombre d'adresses IP à scanner, renseignez donc soigneusement avec le bon masque réseau et la bonne interface réseau.",
"SCAN_SUBNETS_name": "Réseaux à scanner",
@@ -686,17 +686,17 @@
"UI_REFRESH_name": "Rafraîchir automatiquement l'interface graphique",
"VERSION_description": "Valeur de la version ou du timestamp d'aide à vérifier si l'application a été mise à jour.",
"VERSION_name": "Version ou Timestamp",
- "add_icon_event_icon": "",
- "add_icon_event_tooltip": "",
- "add_option_event_icon": "",
- "add_option_event_tooltip": "",
- "copy_icons_event_icon": "",
- "copy_icons_event_tooltip": "",
+ "add_icon_event_icon": "fa-square-plus",
+ "add_icon_event_tooltip": "Ajouter une nouvelle icône",
+ "add_option_event_icon": "fa-square-plus",
+ "add_option_event_tooltip": "Ajouter une nouvelle valeur",
+ "copy_icons_event_icon": "fa-copy",
+ "copy_icons_event_tooltip": "Remplace les icônes de tous les appareils du même type",
"devices_old": "Rafraichissement...",
"general_event_description": "L'événement que vous avez lancé peut prendre du temps avant que les tâches de fond ne soit terminées. La durée d'exécution finira une fois que la file d'exécution ci-dessous sera vide (consulter les journaux d'erreur si vous rencontrez des erreurs).
File d'exécution :",
"general_event_title": "Lancement d'un événement sur mesure",
- "go_to_node_event_icon": "",
- "go_to_node_event_tooltip": "",
+ "go_to_node_event_icon": "fa-square-up-right",
+ "go_to_node_event_tooltip": "Aller vers la page Réseau du nœud concerné",
"report_guid": "GUID de la notification :",
"report_guid_missing": "La notification associée n'a pas été trouvée. Un petit délai existe entre l'envoi d'une notification et sa disponibilité réelle pour affichage. Rafraichissez la page et votre cache après quelques secondes. Il est aussi possible que la notification sélectionnée ait été supprimée durant une opération de maintenance, comme renseigné dans le paramètre DBCLNP_NOTIFI_HIST.
La dernière notification est affichée à sa place. La notification manquante dispose du GUID suivant :",
"report_select_format": "Sélectionner un format :",
diff --git a/front/php/templates/language/it_it.json b/front/php/templates/language/it_it.json
index 616c833e..a916b4ab 100755
--- a/front/php/templates/language/it_it.json
+++ b/front/php/templates/language/it_it.json
@@ -62,9 +62,9 @@
"CLEAR_NEW_FLAG_name": "Cancella nuova bandiera",
"DAYS_TO_KEEP_EVENTS_description": "Questa è un'impostazione di manutenzione. Specifica il numero di giorni delle voci degli eventi che verranno conservati. Tutti gli eventi più vecchi verranno eliminati periodicamente. Si applica anche alla cronologia degli eventi del plugin (Plugin Events History).",
"DAYS_TO_KEEP_EVENTS_name": "Elimina eventi più vecchi di",
- "DevDetail_Copy_Device_Title": " Copia dettagli dal dispositivo",
+ "DevDetail_Copy_Device_Title": "Copia dettagli dal dispositivo",
"DevDetail_Copy_Device_Tooltip": "Copia i dettagli dal dispositivo dall'elenco a discesa. Tutto in questa pagina verrà sovrascritto",
- "DevDetail_DisplayFields_Title": "",
+ "DevDetail_DisplayFields_Title": "Visualizza",
"DevDetail_EveandAl_AlertAllEvents": "Notifica eventi",
"DevDetail_EveandAl_AlertDown": "Avviso disconnessione",
"DevDetail_EveandAl_Archived": "Archiviato",
@@ -185,7 +185,7 @@
"DevDetail_button_OverwriteIcons_Warning": "Sei sicuro di voler sovrascrivere tutte le icone di tutti i dispositivi con lo stesso tipo di dispositivo come l'attuale tipo di dispositivo?",
"DevDetail_button_Reset": "Reimposta modifiche",
"DevDetail_button_Save": "Salva",
- "DeviceEdit_ValidMacIp": "",
+ "DeviceEdit_ValidMacIp": "Inserisci un indirizzo Mac e un indirizzo IP validi.",
"Device_MultiEdit": "Modifica multipla",
"Device_MultiEdit_Backup": "Attento, l'inserimento di valori errati di seguito interromperà la configurazione. Effettua prima il backup del database o della configurazione dei dispositivi (fai clic per scaricare ). Leggi come ripristinare i dispositivi da questo file nella Documentazione di backup.",
"Device_MultiEdit_Fields": "Modifica campi:",
@@ -280,7 +280,7 @@
"GRAPHQL_PORT_name": "Porta GraphQL",
"Gen_Action": "Azione",
"Gen_Add": "Aggiungi",
- "Gen_AddDevice": "",
+ "Gen_AddDevice": "Aggiungi dispositivo",
"Gen_Add_All": "Aggiungi tutti",
"Gen_All_Devices": "Tutti i dispositivi",
"Gen_AreYouSure": "Sei sicuro?",
@@ -298,7 +298,7 @@
"Gen_LockedDB": "ERRORE: il DB potrebbe essere bloccato, controlla F12 Strumenti di sviluppo -> Console o riprova più tardi.",
"Gen_Offline": "Offline",
"Gen_Okay": "Ok",
- "Gen_Online": "",
+ "Gen_Online": "Online",
"Gen_Purge": "Svuota",
"Gen_ReadDocs": "Maggiori informazioni nella documentazione.",
"Gen_Remove_All": "Rimuovi tutti",
@@ -317,7 +317,7 @@
"Gen_Update_Value": "Aggiorna valore",
"Gen_Warning": "Avviso",
"Gen_Work_In_Progress": "Lavori in corso, è quindi un buon momento per un feedback su https://github.com/jokob-sk/NetAlertX/issues",
- "Gen_create_new_device": "",
+ "Gen_create_new_device": "Crea dispositivo fittizio",
"General_display_name": "Generale",
"General_icon": "",
"HRS_TO_KEEP_NEWDEV_description": "Questa è un'impostazione di manutenzione ELIMINAZIONE dispositivi. Se abilitata (0 è disabilitata), tutti i dispositivi marcati con Nuovo dispositivo verranno eliminati se l'orario della Prima sessione è precedente all'orario di questa impostazione. Usa questa impostazione se vuoi eliminare automaticamente i Nuovi dispositivi dopo X ore.",
@@ -581,7 +581,7 @@
"REPORT_MAIL_description": "Se abilitato, viene inviata un'e-mail con un elenco delle modifiche a cui sei iscritto. Compila anche tutte le restanti impostazioni relative alla configurazione SMTP. In caso di problemi, imposta LOG_LEVEL su debug e controlla il log degli errori.",
"REPORT_MAIL_name": "Abilita e-mail",
"REPORT_TITLE": "Rapporto",
- "RandomMAC_hover": "Rilevato automaticamente: indica se il dispositivo genera il suo indirizzo MAC casualmente.",
+ "RandomMAC_hover": "Rilevato automaticamente: indica se il dispositivo genera casualmente il suo indirizzo MAC. Puoi escludere MAC specifici con l'impostazione UI_NOT_RANDOM_MAC. Fai clic per saperne di più.",
"Reports_Sent_Log": "Log rapporti inviati",
"SCAN_SUBNETS_description": "La maggior parte degli scanner di rete (ARP-SCAN, NMAP, NSLOOKUP, DIG) si basano sulla scansione di interfacce di rete e sottoreti specifiche. Consulta la documentazione sulle sottoreti per assistenza su questa impostazione, in particolare VLAN, quali VLAN sono supportate o come individuare la maschera di rete e l'interfaccia.
Un'alternativa agli scanner in rete è abilitare altri scanner/importatori di dispositivi che non si affidano a NetAlertX che hanno accesso alla rete (UNIFI, dhcp.leases , PiHole, ecc.).
Nota: il tempo di scansione stesso dipende dal numero di indirizzi IP da controllare, quindi impostalo attentamente con la maschera di rete e l'interfaccia appropriate.",
"SCAN_SUBNETS_name": "Reti da scansionare",
@@ -686,17 +686,17 @@
"UI_REFRESH_name": "Aggiorna automaticamente la UI",
"VERSION_description": "Valore di supporto della versione o della marca temporale per verificare se l'app è stata aggiornata.",
"VERSION_name": "Versione o marca temporale",
- "add_icon_event_icon": "",
- "add_icon_event_tooltip": "",
- "add_option_event_icon": "",
- "add_option_event_tooltip": "",
- "copy_icons_event_icon": "",
- "copy_icons_event_tooltip": "",
+ "add_icon_event_icon": "fa-square-plus",
+ "add_icon_event_tooltip": "Aggiungi nuova icona",
+ "add_option_event_icon": "fa-square-plus",
+ "add_option_event_tooltip": "Aggiungi nuovo valore",
+ "copy_icons_event_icon": "fa-copy",
+ "copy_icons_event_tooltip": "Sovrascrivi le icone di tutti i dispositivi con lo stesso tipo di dispositivo",
"devices_old": "Aggiornamento...",
"general_event_description": "L'evento che hai attivato potrebbe richiedere del tempo prima che i processi in background vengano completati. L'esecuzione è terminata una volta che la coda di esecuzione sottostante si è svuotata (controlla il log degli errori se riscontri problemi).
Coda di esecuzione:",
"general_event_title": "Esecuzione di un evento ad-hoc",
- "go_to_node_event_icon": "",
- "go_to_node_event_tooltip": "",
+ "go_to_node_event_icon": "fa-square-up-right",
+ "go_to_node_event_tooltip": "Passa alla pagina Rete del nodo specificato",
"report_guid": "GUID notifica:",
"report_guid_missing": "Notifica collegata non trovata. C'è un piccolo ritardo tra la disponibilità delle notifiche inviate di recente e la loro disponibilità. Aggiorna la pagina e la cache dopo alcuni secondi. È anche possibile che la notifica selezionata sia stata eliminata durante la manutenzione come specificato nell'impostazione DBCLNP_NOTIFI_HIST.
Viene invece visualizzata l'ultima notifica. La notifica mancante ha il seguente GUID:",
"report_select_format": "Seleziona formato:",
diff --git a/front/plugins/omada_sdn_imp/omada_sdn.py b/front/plugins/omada_sdn_imp/omada_sdn.py
index 0f3cc94e..e786208d 100755
--- a/front/plugins/omada_sdn_imp/omada_sdn.py
+++ b/front/plugins/omada_sdn_imp/omada_sdn.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
__author__ = "ffsb"
-__version__ = "0.1" #initial
+__version__ = "0.1" # initial
__version__ = "0.2" # added logic to retry omada api call once as it seems to sometimes fail for some reasons, and error handling logic...
__version__ = "0.3" # split devices API calls to allow multithreading but had to stop due to concurency issues.
__version__ = "0.6" # found issue with multithreading - my omada calls redirect stdout which gets clubbered by normal stdout... not sure how to fix for now...
@@ -8,11 +8,12 @@ __version__ = "0.7" # avoid updating omada sdn client name when it is the MAC,
__version__ = "1.0" # fixed the timzone mylog issue by resetting the tz value at the begining of the script... I suspect it doesn't inherit the tz from the main.
__version__ = "1.1" # added logic to handle gracefully a failure of omada devices so it won't try to populate uplinks on non-existent switches and AP.
__version__ = "1.2" # finally got multiprocessing to work to parse devices AND to update names! yeah!
+__version__ = "1.3" # fix detection of the default gateway IP address that would pick loopback address instead of the actual gateway.
# query OMADA SDN to populate NetAlertX witch omada switches, access points, clients.
# try to identify and populate their connections by switch/accesspoints and ports/SSID
-# try to differentiate root bridges from accessory
+# try to differentiate root bridges from accessory
#
@@ -29,12 +30,13 @@ import importlib.util
import time
import io
import re
-#import concurrent.futures
+
+# import concurrent.futures
import subprocess
import multiprocessing
-
-#import netifaces
+
+# import netifaces
# Define the installation path and extend the system path for plugin imports
INSTALL_PATH = "/app"
@@ -44,85 +46,99 @@ from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from plugin_utils import get_plugins_configs
from logger import mylog
from const import pluginsPath, fullDbPath
-from helper import timeNowTZ, get_setting_value
+from helper import timeNowTZ, get_setting_value
from notification import write_notification
from pytz import timezone
import conf
-conf.tz = timezone(get_setting_value('TIMEZONE'))
+
+conf.tz = timezone(get_setting_value("TIMEZONE"))
PARALLELISM = 4
# Define the current path and log file paths
CUR_PATH = str(pathlib.Path(__file__).parent.resolve())
-LOG_FILE = os.path.join(CUR_PATH, 'script.log')
-RESULT_FILE = os.path.join(CUR_PATH, 'last_result.log')
-OMADA_API_RETURN_FILE = os.path.join(CUR_PATH, 'omada_api_return')
+LOG_FILE = os.path.join(CUR_PATH, "script.log")
+RESULT_FILE = os.path.join(CUR_PATH, "last_result.log")
+OMADA_API_RETURN_FILE = os.path.join(CUR_PATH, "omada_api_return")
# Initialize the Plugin obj output file
plugin_objects = Plugin_Objects(RESULT_FILE)
#
# sample target output:
-# 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID, 5 TYPE
-#17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', '17', '40-AE-30-A5-A7-50, 'Switch']"
-
+# 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID, 5 TYPE
+# 17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', '17', '40-AE-30-A5-A7-50, 'Switch']"
+
# Constants for array indices
MAC, IP, NAME, SWITCH_AP, PORT_SSID, TYPE = range(6)
# sample omada devices input format:
-#
+#
# 0.MAC 1.IP 2.type 3.status 4.name 5.model
-#40-AE-30-A5-A7-50 192.168.0.11 ap CONNECTED office_Access_point EAP773(US) v1.0
-#B0-95-75-46-0C-39 192.168.0.4 switch CONNECTED pantry12 T1600G-52PS v4.0
-dMAC, dIP, dTYPE, dSTATUS, dNAME, dMODEL = range(6)
+# 40-AE-30-A5-A7-50 192.168.0.11 ap CONNECTED office_Access_point EAP773(US) v1.0
+# B0-95-75-46-0C-39 192.168.0.4 switch CONNECTED pantry12 T1600G-52PS v4.0
+dMAC, dIP, dTYPE, dSTATUS, dNAME, dMODEL = range(6)
# sample omada clients input format:
-# 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID,
-#17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', 'myssid_name2', '(office_Access_point)']"
-#17:27:10 [] token: "['1A-2B-3C-4D-5E-01', '192.168.0.153', 'frontyard_ESP_29E753', 'pantry12', '(48)']"
-#17:27:10 [] token: "['1A-2B-3C-4D-5E-02', '192.168.0.1', 'bastion', 'office24', '(23)']"
-#17:27:10 [] token: "['1A-2B-3C-4D-5E-03', '192.168.0.226', 'brick', 'myssid_name3', '(office_Access_point)']"
+# 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID,
+# 17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', 'myssid_name2', '(office_Access_point)']"
+# 17:27:10 [] token: "['1A-2B-3C-4D-5E-01', '192.168.0.153', 'frontyard_ESP_29E753', 'pantry12', '(48)']"
+# 17:27:10 [] token: "['1A-2B-3C-4D-5E-02', '192.168.0.1', 'bastion', 'office24', '(23)']"
+# 17:27:10 [] token: "['1A-2B-3C-4D-5E-03', '192.168.0.226', 'brick', 'myssid_name3', '(office_Access_point)']"
cMAC, cIP, cNAME, cSWITCH_AP, cPORT_SSID = range(5)
-OMDLOGLEVEL = 'debug'
-pluginName = 'OMDSDN'
+OMDLOGLEVEL = "debug"
+pluginName = "OMDSDN"
+
+
#
# translate MAC address from standard ieee model to ietf draft
# AA-BB-CC-DD-EE-FF to aa:bb:cc:dd:ee:ff
# tplink adheres to ieee, Nax adheres to ietf
def ieee2ietf_mac_formater(inputmac):
- return(inputmac.lower().replace('-',':'))
+ return inputmac.lower().replace("-", ":")
+
def ietf2ieee_mac_formater(inputmac):
- return(inputmac.upper().replace(':','-'))
+ if not inputmac or not isinstance(inputmac, str):
+ mylog(
+ "minimal",
+ [
+ f"[{pluginName}] ietf2ieee_mac_formater ERROR: inputmac is not a string: {inputmac}"
+ ],
+ )
+ return None
+ return inputmac.upper().replace(":", "-")
+
def get_mac_from_IP(target_IP):
from scapy.all import ARP, Ether, srp
+
try:
arp_request = ARP(pdst=target_IP)
ether = Ether(dst="ff:ff:ff:ff:ff:ff")
- packet = ether/arp_request
+ packet = ether / arp_request
result = srp(packet, timeout=3, verbose=0)[0]
if result:
return result[0][1].hwsrc
else:
return None
except Exception as e:
- mylog('minimal', [f'[{pluginName}] get_mac_from_IP ERROR:{e}'])
+ mylog("minimal", [f"[{pluginName}] get_mac_from_IP ERROR:{e}"])
return None
-
-
+
#
-# wrapper to call the omada python library's own wrapper
-# it returns the output as a multiline python string
+# wrapper to call the omada python library's own wrapper
+# it returns the output as a multiline python string
#
def callomada(myargs):
- arguments=" ".join(myargs)
- mylog('verbose', [f'[{pluginName}] callomada:{arguments}'])
- from tplink_omada_client.cli import main as omada
+ arguments = " ".join(myargs)
+ mylog("verbose", [f"[{pluginName}] callomada:{arguments}"])
+ from tplink_omada_client.cli import main as omada
from contextlib import redirect_stdout
- omada_output = ''
+
+ omada_output = ""
retries = 2
- while omada_output == '' and retries > 1:
+ while omada_output == "" and retries > 1:
retries = retries - 1
try:
mf = io.StringIO()
@@ -130,47 +146,73 @@ def callomada(myargs):
bar = omada(myargs)
omada_output = mf.getvalue()
except Exception as e:
- mylog('minimal', [f'[{pluginName}] ERROR WHILE CALLING callomada:{arguments}\n {mf}'])
- omada_output= ''
- return(omada_output)
+ mylog(
+ "minimal",
+ [f"[{pluginName}] ERROR WHILE CALLING callomada:{arguments}\n {mf}"],
+ )
+ omada_output = ""
+ return omada_output
+
#
# extract all the mac addresses from a multilines text...
-# return a list of MAC as 'string'
+# return a list of MAC as 'string'
#
def extract_mac_addresses(text):
mac_pattern = r"([0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2})"
mac_addresses = re.findall(mac_pattern, text)
return ["".join(parts) for parts in mac_addresses]
-def find_default_gateway_ip ():
- #import netifaces
- #gw = netifaces.gateways()
- #return(gw['default'][netifaces.AF_INET][0])
+
+def find_default_gateway_ip():
+ # Get the routing table
from scapy.all import conf, Route, sr1, IP, ICMP
- default_route = conf.route.route("0.0.0.0")
- return default_route[2] if default_route[2] else None
+
+ routing_table = conf.route.routes
+ for route in routing_table:
+ # Each route is a tuple: (destination, netmask, gateway, iface, output_ip, metric)
+ destination, netmask, gateway, iface, output_ip, metric = route
+ # Look for the default route (destination and netmask are both 0.0.0.0)
+ if destination == 0 and netmask == 0 and gateway != "0.0.0.0":
+ mylog("verbose", [f"[DEBUG] Default Gateway IP: {gateway}"])
+ return gateway # Found the default gateway
+
+ return None # Default gateway not found
- #return('192.168.0.1')
-
-
-def add_uplink (uplink_mac, switch_mac, device_data_bymac, sadevices_linksbymac,port_byswitchmac_byclientmac):
- #mylog(OMDLOGLEVEL, [f'[{pluginName}] trying to add uplink="{uplink_mac}" to switch="{switch_mac}"'])
- #mylog(OMDLOGLEVEL, [f'[{pluginName}] before adding:"{device_data_bymac[switch_mac]}"'])
- if device_data_bymac[switch_mac][SWITCH_AP] == 'null':
+def add_uplink(
+ uplink_mac,
+ switch_mac,
+ device_data_bymac,
+ sadevices_linksbymac,
+ port_byswitchmac_byclientmac,
+):
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}] trying to add uplink="{uplink_mac}" to switch="{switch_mac}"'])
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}] before adding:"{device_data_bymac[switch_mac]}"'])
+ if device_data_bymac[switch_mac][SWITCH_AP] == "null":
device_data_bymac[switch_mac][SWITCH_AP] = uplink_mac
- if device_data_bymac[switch_mac][TYPE] == 'Switch' and device_data_bymac[uplink_mac][TYPE] == 'Switch':
- port_to_uplink = port_byswitchmac_byclientmac[switch_mac][uplink_mac]
- #find_port_of_uplink_switch(switch_mac, uplink_mac)
+ if (
+ device_data_bymac[switch_mac][TYPE] == "Switch"
+ and device_data_bymac[uplink_mac][TYPE] == "Switch"
+ ):
+ port_to_uplink = port_byswitchmac_byclientmac[switch_mac][uplink_mac]
+ # find_port_of_uplink_switch(switch_mac, uplink_mac)
else:
- port_to_uplink=device_data_bymac[uplink_mac][PORT_SSID]
+ port_to_uplink = device_data_bymac[uplink_mac][PORT_SSID]
device_data_bymac[switch_mac][PORT_SSID] = port_to_uplink
- # mylog(OMDLOGLEVEL, [f'[{pluginName}] after adding:"{device_data_bymac[switch_mac]}"'])
- for link in sadevices_linksbymac[switch_mac]:
- if device_data_bymac[link][SWITCH_AP] == 'null' and device_data_bymac[switch_mac][TYPE] == 'Switch':
- add_uplink(switch_mac, link, device_data_bymac, sadevices_linksbymac,port_byswitchmac_byclientmac)
-
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}] after adding:"{device_data_bymac[switch_mac]}"'])
+ for link in sadevices_linksbymac[switch_mac]:
+ if (
+ device_data_bymac[link][SWITCH_AP] == "null"
+ and device_data_bymac[switch_mac][TYPE] == "Switch"
+ ):
+ add_uplink(
+ switch_mac,
+ link,
+ device_data_bymac,
+ sadevices_linksbymac,
+ port_byswitchmac_byclientmac,
+ )
# ----------------------------------------------
@@ -178,51 +220,69 @@ def add_uplink (uplink_mac, switch_mac, device_data_bymac, sadevices_linksbymac,
def main():
start_time = time.time()
- mylog('verbose', [f'[{pluginName}] starting execution'])
+ mylog("verbose", [f"[{pluginName}] starting execution"])
from database import DB
from device import Device_obj
+
db = DB() # instance of class DB
db.open()
- # Create a Device_obj instance
+ # Create a Device_obj instance
device_handler = Device_obj(db)
# Retrieve configuration settings
# these should be self-explanatory
- omada_sites = []
- omada_username = get_setting_value('OMDSDN_username')
- omada_password = get_setting_value('OMDSDN_password')
- omada_sites = get_setting_value('OMDSDN_sites')
+ omada_sites = []
+ omada_username = get_setting_value("OMDSDN_username")
+ omada_password = get_setting_value("OMDSDN_password")
+ omada_sites = get_setting_value("OMDSDN_sites")
omada_site = omada_sites[0]
- omada_url = get_setting_value('OMDSDN_url')
-
- omada_login = callomada(['-t','myomada','target','--url',omada_url,'--user',omada_username,
- '--password',omada_password,'--site',omada_site,'--set-default'])
- mylog('verbose', [f'[{pluginName}] login to omada result is: {omada_login}'])
-
- clients_list = callomada(['-t','myomada','clients'])
- mylog('verbose', [f'[{pluginName}] clients found:"{clients_list.count("\n")}"\n{clients_list}'])
+ omada_url = get_setting_value("OMDSDN_url")
- switches_and_aps = callomada(['-t','myomada','devices'])
- mylog('verbose', [f'[{pluginName}] omada devices (switches, access points) found:"{switches_and_aps.count("\n")}" \n {switches_and_aps}'])
-
+ omada_login = callomada(
+ [
+ "-t",
+ "myomada",
+ "target",
+ "--url",
+ omada_url,
+ "--user",
+ omada_username,
+ "--password",
+ omada_password,
+ "--site",
+ omada_site,
+ "--set-default",
+ ]
+ )
+ mylog("verbose", [f"[{pluginName}] login to omada result is: {omada_login}"])
- #some_setting = get_setting_value('OMDSDN_url')
-
- #mylog(OMDLOGLEVEL, [f'[{pluginName}] some_setting value {some_setting}'])
- mylog(OMDLOGLEVEL, [f'[{pluginName}] ffsb'])
+ clients_list = callomada(["-t", "myomada", "clients"])
+ mylog(
+ "verbose",
+ [f'[{pluginName}] clients found:"{clients_list.count("\n")}"\n{clients_list}'],
+ )
+ switches_and_aps = callomada(["-t", "myomada", "devices"])
+ mylog(
+ "verbose",
+ [
+ f'[{pluginName}] omada devices (switches, access points) found:"{switches_and_aps.count("\n")}" \n {switches_and_aps}'
+ ],
+ )
+ # some_setting = get_setting_value('OMDSDN_url')
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}] some_setting value {some_setting}'])
+ mylog(OMDLOGLEVEL, [f"[{pluginName}] ffsb"])
# retrieve data
device_data = get_device_data(clients_list, switches_and_aps, device_handler)
# Process the data into native application tables
- mylog('verbose', [f'[{pluginName}] New entries to create: "{len(device_data)}"'])
+ mylog("verbose", [f'[{pluginName}] New entries to create: "{len(device_data)}"'])
if len(device_data) > 0:
-
- # insert devices into the lats_result.log
- # make sure the below mapping is mapped in config.json, for example:
- #"database_column_definitions": [
+ # insert devices into the lats_result.log
+ # make sure the below mapping is mapped in config.json, for example:
+ # "database_column_definitions": [
# {
# "column": "Object_PrimaryID", <--------- the value I save into primaryId
# "mapped_to_column": "cur_MAC", <--------- gets unserted into the CurrentScan DB table column cur_MAC
@@ -230,91 +290,115 @@ def main():
# figure a way to run my udpate script delayed
for device in device_data:
- mylog(OMDLOGLEVEL, [f'[{pluginName}] main parsing device: "{device}"'])
- myport = device[PORT_SSID] if device[PORT_SSID].isdigit() else ''
- myssid = device[PORT_SSID] if not device[PORT_SSID].isdigit() else ''
- ParentNetworkNode = ieee2ietf_mac_formater(device[SWITCH_AP]) if device[SWITCH_AP] != 'Internet' else 'Internet'
- mymac = ieee2ietf_mac_formater(device[MAC])
- plugin_objects.add_object(
- primaryId = mymac, # MAC
- secondaryId = device[IP], # IP
- watched1 = device[NAME], # NAME/HOSTNAME
- watched2 = ParentNetworkNode, # PARENT NETWORK NODE MAC
- watched3 = myport, # PORT
- watched4 = myssid, # SSID
- extra = device[TYPE],
- #omada_site, # SITENAME (cur_NetworkSite) or VENDOR (cur_Vendor) (PICK one and adjust config.json -> "column": "Extra")
- foreignKey = device[MAC].lower().replace('-',':')) # usually MAC
-
- mylog('verbose', [f'[{pluginName}] New entries: "{mymac:<18}, {device[IP]:<16}, {device[NAME]:<63}, {ParentNetworkNode:<18}, {myport:<4}, {myssid:<32}, {device[TYPE]}"'])
- mylog('verbose', [f'[{pluginName}] New entries: "{len(device_data)}"'])
+ mylog(OMDLOGLEVEL, [f'[{pluginName}] main parsing device: "{device}"'])
+ myport = device[PORT_SSID] if device[PORT_SSID].isdigit() else ""
+ myssid = device[PORT_SSID] if not device[PORT_SSID].isdigit() else ""
+ ParentNetworkNode = (
+ ieee2ietf_mac_formater(device[SWITCH_AP])
+ if device[SWITCH_AP] != "Internet"
+ else "Internet"
+ )
+ mymac = ieee2ietf_mac_formater(device[MAC])
+ plugin_objects.add_object(
+ primaryId=mymac, # MAC
+ secondaryId=device[IP], # IP
+ watched1=device[NAME], # NAME/HOSTNAME
+ watched2=ParentNetworkNode, # PARENT NETWORK NODE MAC
+ watched3=myport, # PORT
+ watched4=myssid, # SSID
+ extra=device[TYPE],
+ # omada_site, # SITENAME (cur_NetworkSite) or VENDOR (cur_Vendor) (PICK one and adjust config.json -> "column": "Extra")
+ foreignKey=device[MAC].lower().replace("-", ":"),
+ ) # usually MAC
+
+ mylog(
+ "verbose",
+ [
+ f'[{pluginName}] New entries: "{mymac:<18}, {device[IP]:<16}, {device[NAME]:<63}, {ParentNetworkNode:<18}, {myport:<4}, {myssid:<32}, {device[TYPE]}"'
+ ],
+ )
+ mylog("verbose", [f'[{pluginName}] New entries: "{len(device_data)}"'])
# log result
plugin_objects.write_result_file()
-
- #mylog(OMDLOGLEVEL, [f'[{pluginName}] TEST name from MAC: {device_handler.getValueWithMac('devName','00:e2:59:00:a0:8e')}'])
- #mylog(OMDLOGLEVEL, [f'[{pluginName}] TEST MAC from IP: {get_mac_from_IP('192.168.0.1')} also {ietf2ieee_mac_formater(get_mac_from_IP('192.168.0.1'))}'])
+
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}] TEST name from MAC: {device_handler.getValueWithMac('devName','00:e2:59:00:a0:8e')}'])
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}] TEST MAC from IP: {get_mac_from_IP('192.168.0.1')} also {ietf2ieee_mac_formater(get_mac_from_IP('192.168.0.1'))}'])
end_time = time.time()
- mylog('verbose', [f'[{pluginName}] execution completed in {end_time - start_time:.2f} seconds'])
-
+ mylog(
+ "verbose",
+ [f"[{pluginName}] execution completed in {end_time - start_time:.2f} seconds"],
+ )
return 0
+
def get_omada_devices_details(msadevice_data):
mthisswitch = msadevice_data[dMAC]
mtype = msadevice_data[dTYPE]
- mswitch_detail = ''
- mswitch_dump = ''
- if mtype == 'ap':
- mswitch_detail = callomada(['access-point', mthisswitch])
- elif mtype == 'switch':
- mswitch_detail = callomada(['switch', mthisswitch])
- mswitch_dump = callomada(['-t','myomada','switch','-d',mthisswitch])
+ mswitch_detail = ""
+ mswitch_dump = ""
+ if mtype == "ap":
+ mswitch_detail = callomada(["access-point", mthisswitch])
+ elif mtype == "switch":
+ mswitch_detail = callomada(["switch", mthisswitch])
+ mswitch_dump = callomada(["-t", "myomada", "switch", "-d", mthisswitch])
else:
- mswitch_detail = ''
- nswitch_dump = ''
+ mswitch_detail = ""
+ nswitch_dump = ""
return mswitch_detail, mswitch_dump
+
def get_omada_devices_details_parallel(msadevice_data):
mthisswitch = msadevice_data[dMAC]
mtype = msadevice_data[dTYPE]
- mswitch_detail = ''
- mswitch_dump = ''
- if mtype == 'ap':
- mswitch_detail = subprocess.run('omada access-point '+mthisswitch, capture_output=True, text=True, shell=True).stdout
- elif mtype == 'switch':
- mswitch_detail = subprocess.run('omada switch '+mthisswitch, capture_output=True, text=True, shell=True).stdout
- mswitch_dump = subprocess.run('omada access-point '+mthisswitch, capture_output=True, text=True, shell=True).stdout
+ mswitch_detail = ""
+ mswitch_dump = ""
+ if mtype == "ap":
+ mswitch_detail = subprocess.run(
+ "omada access-point " + mthisswitch,
+ capture_output=True,
+ text=True,
+ shell=True,
+ ).stdout
+ elif mtype == "switch":
+ mswitch_detail = subprocess.run(
+ "omada switch " + mthisswitch, capture_output=True, text=True, shell=True
+ ).stdout
+ mswitch_dump = subprocess.run(
+ "omada access-point " + mthisswitch,
+ capture_output=True,
+ text=True,
+ shell=True,
+ ).stdout
else:
- mswitch_detail = ''
- mswitch_dump = ''
+ mswitch_detail = ""
+ mswitch_dump = ""
return mthisswitch, mswitch_detail, mswitch_dump
# ----------------------------------------------
# retrieve data
-def get_device_data(omada_clients_output,switches_and_aps,device_handler):
-
-
+def get_device_data(omada_clients_output, switches_and_aps, device_handler):
# sample omada devices input format:
# 0.MAC 1.IP 2.type 3.status 4.name 5.model
- #40-AE-30-A5-A7-50 192.168.0.11 ap CONNECTED office_Access_point EAP773(US) v1.0
- #B0-95-75-46-0C-39 192.168.0.4 switch CONNECTED pantry12 T1600G-52PS v4.0
+ # 40-AE-30-A5-A7-50 192.168.0.11 ap CONNECTED office_Access_point EAP773(US) v1.0
+ # B0-95-75-46-0C-39 192.168.0.4 switch CONNECTED pantry12 T1600G-52PS v4.0
#
# sample target output:
- # 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID, 5 TYPE
- #17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', '17', '40-AE-30-A5-A7-50, 'Switch']"
- #constants
+ # 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID, 5 TYPE
+ # 17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', '17', '40-AE-30-A5-A7-50, 'Switch']"
+ # constants
sadevices_macbyname = {}
sadevices_macbymac = {}
sadevices_linksbymac = {}
port_byswitchmac_byclientmac = {}
device_data_bymac = {}
device_data_mac_byip = {}
- omada_force_overwrite = get_setting_value('OMDSDN_force_overwrite')
+ omada_force_overwrite = get_setting_value("OMDSDN_force_overwrite")
switch_details = {}
switch_dumps = {}
- '''
+ """
command = 'which omada'
def run_command(command, index):
result = subprocess.run(command, capture_output=True, text=True, shell=True)
@@ -322,108 +406,125 @@ def get_device_data(omada_clients_output,switches_and_aps,device_handler):
myindex, command_output= run_command(command, 2)
mylog('verbose', [f'[{pluginName}] command={command} index={myindex} results={command_output}'])
- '''
+ """
sadevices = switches_and_aps.splitlines()
mylog(OMDLOGLEVEL, [f'[{pluginName}] switches_and_aps rows: "{len(sadevices)}"'])
-
- with multiprocessing.Pool(processes = PARALLELISM) as mypool:
- oresults = mypool.map(get_omada_devices_details_parallel, [sadevice.split() for sadevice in sadevices])
+
+ with multiprocessing.Pool(processes=PARALLELISM) as mypool:
+ oresults = mypool.map(
+ get_omada_devices_details_parallel,
+ [sadevice.split() for sadevice in sadevices],
+ )
for thisswitch, details, dump in oresults:
switch_details[thisswitch] = details
switch_dumps[thisswitch] = dump
- mylog(OMDLOGLEVEL, [f'[{pluginName}] switch={thisswitch} details={details}'])
-
- '''
+ mylog(OMDLOGLEVEL, [f"[{pluginName}] switch={thisswitch} details={details}"])
+
+ """
for sadevice in sadevices:
sadevice_data = sadevice.split()
thisswitch = sadevice_data[dMAC]
thistype = sadevice_data[dTYPE]
switch_details[thisswitch], switch_dumps[thisswitch] = get_omada_devices_details(sadevice_data)
- '''
-
- mylog('verbose', [f'[{pluginName}] switches details collected "{len(switch_details)}"'])
- mylog('verbose', [f'[{pluginName}] dump details collected "{len(switch_details)}"'])
-
+ """
+
+ mylog(
+ "verbose",
+ [f'[{pluginName}] switches details collected "{len(switch_details)}"'],
+ )
+ mylog("verbose", [f'[{pluginName}] dump details collected "{len(switch_details)}"'])
+
for sadevice in sadevices:
sadevice_data = sadevice.split()
thisswitch = sadevice_data[dMAC]
sadevices_macbyname[sadevice_data[4]] = thisswitch
- if sadevice_data[dTYPE] == 'ap':
- sadevice_type = 'AP'
- #sadevice_details = callomada(['access-point', thisswitch])
+ if sadevice_data[dTYPE] == "ap":
+ sadevice_type = "AP"
+ # sadevice_details = callomada(['access-point', thisswitch])
sadevice_details = switch_details[thisswitch]
- if sadevice_details == '':
+ if sadevice_details == "":
sadevice_links = [thisswitch]
else:
sadevice_links = extract_mac_addresses(sadevice_details)
sadevices_linksbymac[thisswitch] = sadevice_links[1:]
- #mylog(OMDLOGLEVEL, [f'[{pluginName}]adding switch details: "{sadevice_details}"'])
- #mylog(OMDLOGLEVEL, [f'[{pluginName}]links are: "{sadevice_links}"'])
- #mylog(OMDLOGLEVEL, [f'[{pluginName}]linksbymac are: "{sadevices_linksbymac[thisswitch]}"'])
- elif sadevice_data[dTYPE] == 'switch':
- sadevice_type = 'Switch'
- #sadevice_details=callomada(['switch', thisswitch])
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}]adding switch details: "{sadevice_details}"'])
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}]links are: "{sadevice_links}"'])
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}]linksbymac are: "{sadevices_linksbymac[thisswitch]}"'])
+ elif sadevice_data[dTYPE] == "switch":
+ sadevice_type = "Switch"
+ # sadevice_details=callomada(['switch', thisswitch])
sadevice_details = switch_details[thisswitch]
- if sadevice_details == '':
+ if sadevice_details == "":
sadevice_links = [thisswitch]
else:
- sadevice_links=extract_mac_addresses(sadevice_details)
+ sadevice_links = extract_mac_addresses(sadevice_details)
sadevices_linksbymac[thisswitch] = sadevice_links[1:]
# recovering the list of switches connected to sadevice switch and on which port...
- #switchdump = callomada(['-t','myomada','switch','-d',thisswitch])
+ # switchdump = callomada(['-t','myomada','switch','-d',thisswitch])
switchdump = switch_dumps[thisswitch]
- mylog(OMDLOGLEVEL, [f'[{pluginName}] switchdump: {switchdump}'])
- port_byswitchmac_byclientmac[thisswitch] = {}
+ mylog(OMDLOGLEVEL, [f"[{pluginName}] switchdump: {switchdump}"])
+ port_byswitchmac_byclientmac[thisswitch] = {}
for link in sadevices_linksbymac[thisswitch]:
- port_pattern = r"(?:{[^}]*\"port\"\: )([0-9]+)(?=[^}]*"+re.escape(link)+r")"
- myport = re.findall(port_pattern, switchdump,re.DOTALL)
- #mylog(OMDLOGLEVEL, [f'[{pluginName}] switchdump: link={link} myport:{myport}'])
- port_byswitchmac_byclientmac[thisswitch][link] = myport[0] if myport else ''
- #mylog(OMDLOGLEVEL, [f'[{pluginName}]links are: "{sadevice_links}"'])
- #mylog(OMDLOGLEVEL, [f'[{pluginName}]linksbymac are: "{sadevices_linksbymac[thisswitch]}"'])
- #mylog(OMDLOGLEVEL, [f'[{pluginName}]ports of each links are: "{port_byswitchmac_byclientmac[thisswitch]}"'])
- #mylog(OMDLOGLEVEL, [f'[{pluginName}]adding switch details: "{sadevice_details}"'])
+ port_pattern = (
+ r"(?:{[^}]*\"port\"\: )([0-9]+)(?=[^}]*" + re.escape(link) + r")"
+ )
+ myport = re.findall(port_pattern, switchdump, re.DOTALL)
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}] switchdump: link={link} myport:{myport}'])
+ port_byswitchmac_byclientmac[thisswitch][link] = (
+ myport[0] if myport else ""
+ )
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}]links are: "{sadevice_links}"'])
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}]linksbymac are: "{sadevices_linksbymac[thisswitch]}"'])
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}]ports of each links are: "{port_byswitchmac_byclientmac[thisswitch]}"'])
+ # mylog(OMDLOGLEVEL, [f'[{pluginName}]adding switch details: "{sadevice_details}"'])
else:
- sadevice_type = 'null'
- sadevice_details='null'
- device_data_bymac[thisswitch] = [thisswitch, sadevice_data[dIP], sadevice_data[dNAME], 'null', 'null',sadevice_type]
+ sadevice_type = "null"
+ sadevice_details = "null"
+ device_data_bymac[thisswitch] = [
+ thisswitch,
+ sadevice_data[dIP],
+ sadevice_data[dNAME],
+ "null",
+ "null",
+ sadevice_type,
+ ]
device_data_mac_byip[sadevice_data[dIP]] = thisswitch
- foo=[thisswitch, sadevice_data[1], sadevice_data[4], 'null', 'null']
+ foo = [thisswitch, sadevice_data[1], sadevice_data[4], "null", "null"]
mylog(OMDLOGLEVEL, [f'[{pluginName}]adding switch: "{foo}"'])
-
-
-
# sadevices_macbymac[thisswitch] = thisswitch
-
+
mylog(OMDLOGLEVEL, [f'[{pluginName}] switch_macbyname: "{sadevices_macbyname}"'])
mylog(OMDLOGLEVEL, [f'[{pluginName}] switches: "{device_data_bymac}"'])
-
# do some processing, call exteranl APIs, and return a device list
# ...
# sample omada clients input format:
- # 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID,
- #17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', 'myssid_name2', '(office_Access_point)']"
- #17:27:10 [] token: "['1A-2B-3C-4D-5E-01', '192.168.0.153', 'frontyard_ESP_29E753', 'pantry12', '(48)']"
- #17:27:10 [] token: "['1A-2B-3C-4D-5E-02', '192.168.0.1', 'bastion', 'office24', '(23)']"
- #17:27:10 [] token: "['1A-2B-3C-4D-5E-03', '192.168.0.226', 'brick', 'myssid_name3', '(office_Access_point)']"
-
+ # 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID,
+ # 17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', 'myssid_name2', '(office_Access_point)']"
+ # 17:27:10 [] token: "['1A-2B-3C-4D-5E-01', '192.168.0.153', 'frontyard_ESP_29E753', 'pantry12', '(48)']"
+ # 17:27:10 [] token: "['1A-2B-3C-4D-5E-02', '192.168.0.1', 'bastion', 'office24', '(23)']"
+ # 17:27:10 [] token: "['1A-2B-3C-4D-5E-03', '192.168.0.226', 'brick', 'myssid_name3', '(office_Access_point)']"
+
# sample target output:
- # 0 MAC, 1 IP, 2 Name, 3 MAC of switch/AP, 4 port/SSID, 5 TYPE
- #17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', 'brick', 'office_Access_point','myssid_name2', , 'Switch']"
+ # 0 MAC, 1 IP, 2 Name, 3 MAC of switch/AP, 4 port/SSID, 5 TYPE
+ # 17:27:10 [] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', 'brick', 'office_Access_point','myssid_name2', , 'Switch']"
odevices = omada_clients_output.splitlines()
- mylog(OMDLOGLEVEL, [f'[{pluginName}] omada_clients_outputs rows: "{len(odevices)}"'])
+ mylog(
+ OMDLOGLEVEL, [f'[{pluginName}] omada_clients_outputs rows: "{len(odevices)}"']
+ )
omada_clients_to_rename = []
for odevice in odevices:
odevice_data = odevice.split()
- odevice_data_reordered = [ MAC, IP, NAME, SWITCH_AP, PORT_SSID, TYPE]
- odevice_data_reordered[MAC]=odevice_data[cMAC]
- odevice_data_reordered[IP]=odevice_data[cIP]
- real_naxname = device_handler.getValueWithMac('devName',ieee2ietf_mac_formater(odevice_data[cMAC]))
+ odevice_data_reordered = [MAC, IP, NAME, SWITCH_AP, PORT_SSID, TYPE]
+ odevice_data_reordered[MAC] = odevice_data[cMAC]
+ odevice_data_reordered[IP] = odevice_data[cIP]
+ real_naxname = device_handler.getValueWithMac(
+ "devName", ieee2ietf_mac_formater(odevice_data[cMAC])
+ )
#
# if the name stored in Nax for a device is empty or the MAC addres or has some parenthhesis or is the same as in omada
@@ -432,86 +533,122 @@ def get_device_data(omada_clients_output,switches_and_aps,device_handler):
naxname = real_naxname
if real_naxname != None:
- if '(' in real_naxname:
- # removing parenthesis and domains from the name
- naxname = real_naxname.split('(')[0]
- if naxname != None and '.' in naxname:
- naxname = naxname.split('.')[0]
- if naxname in ( None, 'null', '' ):
- naxname = odevice_data[cNAME] if odevice_data[cNAME] != '' else odevice_data[cMAC]
+ if "(" in real_naxname:
+ # removing parenthesis and domains from the name
+ naxname = real_naxname.split("(")[0]
+ if naxname != None and "." in naxname:
+ naxname = naxname.split(".")[0]
+ if naxname in (None, "null", ""):
+ naxname = (
+ odevice_data[cNAME] if odevice_data[cNAME] != "" else odevice_data[cMAC]
+ )
naxname = naxname.strip()
- mylog('debug', [f'[{pluginName}] TEST name from MAC: {naxname}'])
- if odevice_data[cNAME] in ('null', ''):
- mylog('verbose', [f'[{pluginName}] updating omada server because odevice_data is: {odevice_data[cNAME]} and naxname is: "{naxname}"'])
- omada_clients_to_rename.append(['set-client-name',odevice_data[cMAC], naxname])
- #callomada(['set-client-name', odevice_data[cMAC], naxname])
+ mylog("debug", [f"[{pluginName}] TEST name from MAC: {naxname}"])
+ if odevice_data[cNAME] in ("null", ""):
+ mylog(
+ "verbose",
+ [
+ f'[{pluginName}] updating omada server because odevice_data is: {odevice_data[cNAME]} and naxname is: "{naxname}"'
+ ],
+ )
+ omada_clients_to_rename.append(
+ ["set-client-name", odevice_data[cMAC], naxname]
+ )
+ # callomada(['set-client-name', odevice_data[cMAC], naxname])
odevice_data_reordered[NAME] = naxname
- elif odevice_data[cNAME] == odevice_data[cMAC] and ieee2ietf_mac_formater(naxname) != ieee2ietf_mac_formater(odevice_data[cNAME]) :
- mylog('verbose', [f'[{pluginName}] updating omada server because odevice_data is: "{odevice_data[cNAME]} and naxname is: "{naxname}"'])
- omada_clients_to_rename.append(['set-client-name',odevice_data[cMAC], naxname])
- #callomada(['set-client-name', odevice_data[cMAC], naxname])
+ elif odevice_data[cNAME] == odevice_data[cMAC] and ieee2ietf_mac_formater(
+ naxname
+ ) != ieee2ietf_mac_formater(odevice_data[cNAME]):
+ mylog(
+ "verbose",
+ [
+ f'[{pluginName}] updating omada server because odevice_data is: "{odevice_data[cNAME]} and naxname is: "{naxname}"'
+ ],
+ )
+ omada_clients_to_rename.append(
+ ["set-client-name", odevice_data[cMAC], naxname]
+ )
+ # callomada(['set-client-name', odevice_data[cMAC], naxname])
odevice_data_reordered[NAME] = naxname
else:
- if omada_force_overwrite and naxname != odevice_data[cNAME] :
- mylog('verbose', [f'[{pluginName}] updating omada server because odevice_data is: "{odevice_data[cNAME]} and naxname is: "{naxname}"'])
- omada_clients_to_rename.append(['set-client-name',odevice_data[cMAC], naxname])
- #callomada(['set-client-name', odevice_data[cMAC], naxname])
+ if omada_force_overwrite and naxname != odevice_data[cNAME]:
+ mylog(
+ "verbose",
+ [
+ f'[{pluginName}] updating omada server because odevice_data is: "{odevice_data[cNAME]} and naxname is: "{naxname}"'
+ ],
+ )
+ omada_clients_to_rename.append(
+ ["set-client-name", odevice_data[cMAC], naxname]
+ )
+ # callomada(['set-client-name', odevice_data[cMAC], naxname])
odevice_data_reordered[NAME] = naxname
-
-
-
-
- mightbeport = odevice_data[cPORT_SSID].lstrip('(')
- mightbeport = mightbeport.rstrip(')')
+ mightbeport = odevice_data[cPORT_SSID].lstrip("(")
+ mightbeport = mightbeport.rstrip(")")
if mightbeport.isdigit():
odevice_data_reordered[SWITCH_AP] = odevice_data[cSWITCH_AP]
odevice_data_reordered[PORT_SSID] = mightbeport
else:
odevice_data_reordered[SWITCH_AP] = mightbeport
odevice_data_reordered[PORT_SSID] = odevice_data[cSWITCH_AP]
-
+
# replacing the switch name with its MAC...
try:
mightbemac = sadevices_macbyname[odevice_data_reordered[SWITCH_AP]]
odevice_data_reordered[SWITCH_AP] = mightbemac
except KeyError:
- mylog(OMDLOGLEVEL, [f'[{pluginName}] could not find the mac adddress for: "{odevice_data_reordered[SWITCH_AP]}"'])
+ mylog(
+ OMDLOGLEVEL,
+ [
+ f'[{pluginName}] could not find the mac adddress for: "{odevice_data_reordered[SWITCH_AP]}"'
+ ],
+ )
# adding the type
- odevice_data_reordered[TYPE] = 'null'
- device_data_bymac[odevice_data_reordered[MAC]] = odevice_data_reordered
+ odevice_data_reordered[TYPE] = "null"
+ device_data_bymac[odevice_data_reordered[MAC]] = odevice_data_reordered
device_data_mac_byip[odevice_data_reordered[IP]] = odevice_data_reordered[MAC]
mylog(OMDLOGLEVEL, [f'[{pluginName}] tokens: "{odevice_data}"'])
- mylog(OMDLOGLEVEL, [f'[{pluginName}] tokens_reordered: "{odevice_data_reordered}"'])
+ mylog(
+ OMDLOGLEVEL,
+ [f'[{pluginName}] tokens_reordered: "{odevice_data_reordered}"'],
+ )
# RENAMING
- #for omada_client_to_rename in omada_clients_to_rename:
+ # for omada_client_to_rename in omada_clients_to_rename:
# mylog('verbose', [f'[{pluginName}] calling omada: "{omada_client_to_rename}"'])
- #callomada(omada_client_to_rename)
+ # callomada(omada_client_to_rename)
- # populating the uplinks nodes of the omada switches and access points manually
+ # populating the uplinks nodes of the omada switches and access points manually
# since OMADA SDN makes is unreliable if the gateway is not their own tplink hardware...
- #
- with multiprocessing.Pool(processes = PARALLELISM) as mypool2:
+ #
+ with multiprocessing.Pool(processes=PARALLELISM) as mypool2:
oresults = mypool2.map(callomada, omada_clients_to_rename)
mylog(OMDLOGLEVEL, [f'[{pluginName}] results are: "{oresults}"'])
-
+
# step1 let's find the the default router
- #
- default_router_ip = find_default_gateway_ip()
+ #
+ default_router_ip = find_default_gateway_ip()
default_router_mac = ietf2ieee_mac_formater(get_mac_from_IP(default_router_ip))
- device_data_bymac[default_router_mac][TYPE] = 'Firewall'
+ device_data_bymac[default_router_mac][TYPE] = "Firewall"
# step2 let's find the first switch and set the default router parent to internet
- first_switch=device_data_bymac[default_router_mac][SWITCH_AP]
- device_data_bymac[default_router_mac][SWITCH_AP] = 'Internet'
+ first_switch = device_data_bymac[default_router_mac][SWITCH_AP]
+ device_data_bymac[default_router_mac][SWITCH_AP] = "Internet"
# step3 let's set the switch connected to the default gateway uplink to the default gateway and hardcode port to 1 for now:
- #device_data_bymac[first_switch][SWITCH_AP]=default_router_mac
- #device_data_bymac[first_switch][SWITCH_AP][PORT_SSID] = '1'
+ # device_data_bymac[first_switch][SWITCH_AP]=default_router_mac
+ # device_data_bymac[first_switch][SWITCH_AP][PORT_SSID] = '1'
# step4, let's go recursively through switches other links to mark update their uplinks
- # and pray it ends one day...
- #
+ # and pray it ends one day...
+ #
if len(sadevices) > 0:
- add_uplink(default_router_mac,first_switch, device_data_bymac,sadevices_linksbymac,port_byswitchmac_byclientmac)
+ add_uplink(
+ default_router_mac,
+ first_switch,
+ device_data_bymac,
+ sadevices_linksbymac,
+ port_byswitchmac_byclientmac,
+ )
return device_data_bymac.values()
-if __name__ == '__main__':
+
+if __name__ == "__main__":
main()