diff --git a/Dockerfile b/Dockerfile index c9a8d739..9ce5e9e2 100755 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 RUN apk update --no-cache \ && apk add --no-cache bash zip lsblk gettext-envsubst sudo mtr tzdata s6-overlay \ - && apk add --no-cache curl arp-scan iproute2 iproute2-ss nmap nmap-scripts traceroute net-tools net-snmp-tools bind-tools awake ca-certificates \ + && apk add --no-cache curl arp-scan iproute2 iproute2-ss nmap nmap-scripts traceroute nbtscan net-tools net-snmp-tools bind-tools awake ca-certificates \ && apk add --no-cache sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session \ && apk add --no-cache python3 nginx \ && apk add --no-cache dcron \ diff --git a/Dockerfile.debian b/Dockerfile.debian index 887f9c0a..5a0e3f10 100755 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -33,7 +33,7 @@ COPY --chmod=775 --chown=${USER_ID}:${USER_GID} . ${INSTALL_DIR}/ RUN apt-get install -y \ tini snmp ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo \ nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools php-openssl \ - python3 python3-dev iproute2 nmap python3-pip zip systemctl usbutils traceroute + python3 python3-dev iproute2 nmap python3-pip zip systemctl usbutils traceroute nbtscan # Alternate dependencies RUN apt-get install nginx nginx-core mtr php-fpm php8.2-fpm php-cli php8.2 php8.2-sqlite3 -y diff --git a/front/css/app.css b/front/css/app.css index fc5d9851..16593145 100755 --- a/front/css/app.css +++ b/front/css/app.css @@ -232,7 +232,12 @@ .content-wrapper, .right-side, .main-footer { - margin-left: 150px; + margin-left: 150px; +} + +#settingsPage +{ + display: grid; } @media (max-width: 767px) { diff --git a/front/js/settings_utils.js b/front/js/settings_utils.js index d5428f32..b70063ba 100755 --- a/front/js/settings_utils.js +++ b/front/js/settings_utils.js @@ -383,27 +383,56 @@ function filterRows(inputText) { inputText = ""; } - $(".table_row").each(function () { - // Check if the row id ends with '__metadata' - var idAttribute = $(this).attr("id"); - if (idAttribute && idAttribute.endsWith("__metadata")) { - $(this).hide(); // Hide the row if it ends with '__metadata' - return; // Skip to the next iteration - } + $(".panel").each(function () { + var $panel = $(this); + var $panelHeader = $panel.find('.panel-heading'); + var $panelBody = $panel.find('.panel-collapse'); - var description = $(this).find(".setting_description").text().toLowerCase(); - var codeName = $(this).find(".setting_name code").text().toLowerCase(); - if ( - description.includes(inputText.toLowerCase()) || - codeName.includes(inputText.toLowerCase()) - ) { - $(this).show(); // Show the row if it matches the input text + var anyVisible = false; // Flag to check if any row is visible + + $panelBody.find(".table_row:not(.docs)").each(function () { + var $row = $(this); + + // Check if the row ID ends with "__metadata" + var rowId = $row.attr("id"); + var isMetadataRow = rowId && rowId.endsWith("__metadata"); + + // Always hide metadata rows + if (isMetadataRow) { + $row.hide(); + return; // Skip further processing for metadata rows + } + + var description = $row.find(".setting_description").text().toLowerCase(); + var codeName = $row.find(".setting_name code").text().toLowerCase(); + + if ( + description.includes(inputText.toLowerCase()) || + codeName.includes(inputText.toLowerCase()) + ) { + $row.show(); + anyVisible = true; // Set the flag to true if at least one row is visible + } else { + $row.hide(); + } + }); + + // Determine whether to hide or show the panel based on visibility of rows + if (anyVisible) { + $panelBody.collapse('show'); // Ensure the panel body is shown if there are visible rows + $panelHeader.show(); // Show the panel header + $panel.show(); // Show the entire panel if there are visible rows } else { - $(this).hide(); // Hide the row if it doesn't match the input text + $panelBody.collapse('hide'); // Hide the panel body if no rows are visible + $panelHeader.hide(); // Hide the panel header if no rows are visible + $panel.hide(); // Hide the entire panel if no rows are visible } }); } + + + setTimeout(() => { // Event listener for input change $("#settingsSearch").on("input", function () { diff --git a/front/maintenance.php b/front/maintenance.php index 94636c8f..37502984 100755 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -408,7 +408,7 @@ $db->close();
/mnt/dhcp2.leases. You must map these files accordingly in your docker-compose.yml file. (If you are mapping a PiHole dhcp.leases file the path in the container must contain pihole, e.g.: :/etc/pihole/dhcp.leases)"
- },
- {
- "language_code": "es_es",
- "string": "Agregue todas las rutas asignadas de dhcp.leases para observar. Ingrese la ruta completa dentro del contenedor, p.e. /mnt/dhcp2.leases. Debe asignar estos archivos en consecuencia en su archivo docker-compose.yml. (Si está asignando un archivo PiHole dhcp.leases, la ruta en el contenedor debe contener pihole, por ejemplo: :/etc/pihole/dhcp.leases)"
- },
- {
- "language_code": "de_de",
- "string": "Alle zu überwachenden dhcp.leases-Pfade hinzufügen. Den absoluten Pfad innerhalb des Containers angeben, z.B. /mnt/dchp2.leases. Diese Dateien müssen korrekt in der docker-compose.yml gemapped werden. Wird eine PiHole dhcp.leases-Datei in den Container gemapped, so muss der Pfad im Container pihole inkludieren, z.B. :/etc/pihole/dhcp.leases"
+ "string": "Add all dhcp.leases mapped paths to watch. Enter full path within the container, e.g. /mnt/dhcp2.leases. You must map these files accordingly in your docker-compose.yml file. Supports pihole, dnsmasq, and generic formats. pihole or dnsmasq; e.g.: :/etc/pihole/dhcp.leases). See the above docs for details."
}
]
},
diff --git a/front/plugins/nbtscan_scan/README.md b/front/plugins/nbtscan_scan/README.md
new file mode 100755
index 00000000..4c0aa412
--- /dev/null
+++ b/front/plugins/nbtscan_scan/README.md
@@ -0,0 +1,23 @@
+## Overview
+
+Plugin functionality overview and links to external resources if relevant. Include use cases if available.
+
+> [!TIP]
+> Some tip.
+
+### Quick setup guide
+
+To set up the plugin correctly, make sure...
+
+#### Required Settings
+
+- When to run `PREF_RUN`
+-
+
+### Usage
+
+- Head to **Settings** > **Plugin name** to adjust the default values.
+
+### Notes
+
+- Additional notes, limitations, Author info.
\ No newline at end of file
diff --git a/front/plugins/nbtscan_scan/config.json b/front/plugins/nbtscan_scan/config.json
new file mode 100755
index 00000000..8117d5cf
--- /dev/null
+++ b/front/plugins/nbtscan_scan/config.json
@@ -0,0 +1,337 @@
+{
+ "code_name": "nbtscan_scan",
+ "unique_prefix": "NBTSCAN",
+ "plugin_type": "other",
+ "enabled": true,
+ "data_source": "script",
+ "show_ui": true,
+ "localized": ["display_name", "description", "icon"],
+ "display_name": [
+ {
+ "language_code": "en_us",
+ "string": "NBTSCAN (Name discovery)"
+ }
+ ],
+ "icon": [
+ {
+ "language_code": "en_us",
+ "string": ""
+ }
+ ],
+ "description": [
+ {
+ "language_code": "en_us",
+ "string": "A plugin to discover device names."
+ }
+ ],
+ "params": [
+ {
+ "name": "ips",
+ "type": "sql",
+ "value": "SELECT dev_LastIP from DEVICES order by dev_MAC",
+ "timeoutMultiplier": true
+ }
+ ],
+ "settings": [
+ {
+ "function": "RUN",
+ "events": ["run"],
+ "type": {
+ "dataType": "string",
+ "elements": [
+ { "elementType": "select", "elementOptions": [], "transformers": [] }
+ ]
+ },
+ "default_value": "disabled",
+ "options": [
+ "disabled",
+ "before_name_updates",
+ "on_new_device",
+ "once",
+ "schedule",
+ "always_after_scan"
+ ],
+ "localized": ["name", "description"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "When to run"
+ },
+ {
+ "language_code": "es_es",
+ "string": "Cuándo ejecutar"
+ },
+ {
+ "language_code": "de_de",
+ "string": "Wann laufen"
+ }
+ ],
+ "description": [
+ {
+ "language_code": "en_us",
+ "string": "When the plugin should be executed. If enabled this will execute the scan until there are no (unknown) or (name not found) devices. Setting this to on_new_device or a daily schedule is recommended.SCAN_SUBNETS setting."
+ }
+ ]
+ },
+ {
+ "function": "CMD",
+ "type": {
+ "dataType": "string",
+ "elements": [
+ {
+ "elementType": "input",
+ "elementOptions": [{ "readonly": "true" }],
+ "transformers": []
+ }
+ ]
+ },
+ "default_value": "python3 /app/front/plugins/nbtscan_scan/nbtscan.py",
+ "options": [],
+ "localized": ["name", "description"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "Command"
+ },
+ {
+ "language_code": "es_es",
+ "string": "Comando"
+ },
+ {
+ "language_code": "de_de",
+ "string": "Befehl"
+ }
+ ],
+ "description": [
+ {
+ "language_code": "en_us",
+ "string": "Command to run. This can not be changed"
+ },
+ {
+ "language_code": "es_es",
+ "string": "Comando a ejecutar. Esto no se puede cambiar"
+ },
+ {
+ "language_code": "de_de",
+ "string": "Befehl zum Ausführen. Dies kann nicht geändert werden"
+ }
+ ]
+ },
+ {
+ "function": "RUN_SCHD",
+ "type": {
+ "dataType": "string",
+ "elements": [
+ { "elementType": "input", "elementOptions": [], "transformers": [] }
+ ]
+ },
+ "default_value": "*/30 * * * *",
+ "options": [],
+ "localized": ["name", "description"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "Schedule"
+ },
+ {
+ "language_code": "es_es",
+ "string": "Schedule"
+ },
+ {
+ "language_code": "de_de",
+ "string": "Schedule"
+ }
+ ],
+ "description": [
+ {
+ "language_code": "en_us",
+ "string": "Only enabled if you select schedule in the NBTSCAN_RUN setting. Make sure you enter the schedule in the correct cron-like format (e.g. validate at crontab.guru). For example entering 0 4 * * * will run the scan after 4 am in the TIMEZONE you set above. Will be run NEXT time the time passes."
+ },
+ {
+ "language_code": "es_es",
+ "string": "Solo está habilitado si selecciona schedule en la configuración NBTSCAN_RUN. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en crontab.guru). Por ejemplo, ingresar 0 4 * * * ejecutará el escaneo después de las 4 a.m. en el TIMEZONE código> que configuró arriba. Se ejecutará la PRÓXIMA vez que pase el tiempo."
+ },
+ {
+ "language_code": "de_de",
+ "string": "Nur aktiviert, wenn Sie schedule in der NBTSCAN_RUN-Einstellung auswählen. Stellen Sie sicher, dass Sie den Zeitplan im richtigen Cron-ähnlichen Format eingeben (z. B. validieren unter crontab.guru). Wenn Sie beispielsweise 0 4 * * * eingeben, wird der Scan nach 4 Uhr morgens in der TIMEZONE ausgeführt. Code> den Sie oben festgelegt haben. Wird das NÄCHSTE Mal ausgeführt, wenn die Zeit vergeht."
+ }
+ ]
+ },
+ {
+ "function": "RUN_TIMEOUT",
+ "type": {
+ "dataType": "integer",
+ "elements": [
+ {
+ "elementType": "input",
+ "elementOptions": [{ "type": "number" }],
+ "transformers": []
+ }
+ ]
+ },
+ "default_value": 10,
+ "options": [],
+ "localized": ["name", "description"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "Run timeout"
+ },
+ {
+ "language_code": "es_es",
+ "string": "Tiempo límite de ejecución"
+ },
+ {
+ "language_code": "de_de",
+ "string": "Zeitüberschreitung"
+ }
+ ],
+ "description": [
+ {
+ "language_code": "en_us",
+ "string": "Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted."
+ },
+ {
+ "language_code": "es_es",
+ "string": "Tiempo máximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela."
+ },
+ {
+ "language_code": "de_de",
+ "string": "Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei Überschreitung dieser Zeit wird das Skript abgebrochen."
+ }
+ ]
+ }
+ ],
+ "database_column_definitions": [
+ {
+ "column": "Object_PrimaryID",
+ "css_classes": "col-sm-2",
+ "show": true,
+ "type": "device_name_mac",
+ "default_value": "",
+ "options": [],
+ "localized": ["name"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "MAC"
+ },
+ {
+ "language_code": "es_es",
+ "string": "MAC"
+ }
+ ]
+ },
+ {
+ "column": "Object_SecondaryID",
+ "css_classes": "col-sm-2",
+ "show": true,
+ "type": "label",
+ "default_value": "",
+ "options": [],
+ "localized": ["name"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "IP"
+ },
+ {
+ "language_code": "es_es",
+ "string": "IP"
+ }
+ ]
+ },
+ {
+ "column": "Watched_Value1",
+ "css_classes": "col-sm-2",
+ "show": true,
+ "type": "label",
+ "default_value": "",
+ "options": [],
+ "localized": ["name"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "Server"
+ }
+ ]
+ },
+ {
+ "column": "Watched_Value2",
+ "css_classes": "col-sm-2",
+ "show": true,
+ "type": "label",
+ "default_value": "",
+ "options": [],
+ "localized": ["name"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "Name"
+ }
+ ]
+ },
+ {
+ "column": "DateTimeCreated",
+ "css_classes": "col-sm-2",
+ "show": true,
+ "type": "label",
+ "default_value": "",
+ "options": [],
+ "localized": ["name"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "Created"
+ }
+ ]
+ },
+ {
+ "column": "DateTimeChanged",
+ "css_classes": "col-sm-2",
+ "show": true,
+ "type": "label",
+ "default_value": "",
+ "options": [],
+ "localized": ["name"],
+ "name": [
+ {
+ "language_code": "en_us",
+ "string": "Changed"
+ }
+ ]
+ },
+ {
+ "column": "Status",
+ "css_classes": "col-sm-1",
+ "show": true,
+ "type": "replace",
+ "default_value": "",
+ "options": [
+ {
+ "equals": "watched-not-changed",
+ "replacement": "schedule in the ARPSCAN_RUN setting. Make sure you enter the schedule in the correct cron-like format (e.g. validate at crontab.guru). For example entering */30 * * * * will run the scan every 30 minutes. Will be run NEXT time the time passes. schedule in the PIHOLE_RUN setting. Make sure you enter the schedule in the correct cron-like format (e.g. validate at crontab.guru). For example entering */30 * * * * will run the scan every 30 minutes. Will be run NEXT time the time passes. schedule en la configuración ARPSCAN_RUN. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en crontab.guru). Por ejemplo, ingresar */30 * * * * ejecutará el escaneo cada 30 minutos. Se ejecutará la PRÓXIMA vez que pase el tiempo. schedule en la configuración PIHOLE_RUN. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en crontab.guru). Por ejemplo, ingresar */30 * * * * ejecutará el escaneo cada 30 minutos. Se ejecutará la PRÓXIMA vez que pase el tiempo.