From ecf6c1848d8947d737ee826be1c99038a346ded0 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Sun, 28 Apr 2024 10:17:02 +1000 Subject: [PATCH] =?UTF-8?q?NMAPDEV=20plugin=20work=20v0.6=20#645=20?= =?UTF-8?q?=F0=9F=86=95=F0=9F=94=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 10 ++++------ docs/NOTIFICATIONS.md | 4 ++-- front/plugins/nmap_dev_scan/config.json | 4 ++-- front/plugins/nmap_dev_scan/nmap_dev.py | 5 +++-- front/plugins/nslookup_scan/config.json | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2a0bfc61..55f3fe43 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,12 +11,10 @@ services: network_mode: host # restart: unless-stopped volumes: - # - ${APP_DATA_LOCATION}/netalertx_dev/config:/app/config - - ${APP_DATA_LOCATION}/netalertx/config:/app/config - # - ${APP_DATA_LOCATION}/netalertx/config:/home/pi/pialert/config - # - ${APP_DATA_LOCATION}/netalertx_dev/db:/app/db - - ${APP_DATA_LOCATION}/netalertx/db:/app/db - # - ${APP_DATA_LOCATION}/netalertx/db:/home/pi/pialert/db + - ${APP_DATA_LOCATION}/netalertx_dev/config:/app/config + # - ${APP_DATA_LOCATION}/netalertx/config:/app/config + - ${APP_DATA_LOCATION}/netalertx_dev/db:/app/db + # - ${APP_DATA_LOCATION}/netalertx/db:/app/db # (optional) useful for debugging if you have issues setting up the container # - ${LOGS_LOCATION}:/app/front/log # --------------------------------------------------------------------------- diff --git a/docs/NOTIFICATIONS.md b/docs/NOTIFICATIONS.md index 33055b63..9e2723bd 100755 --- a/docs/NOTIFICATIONS.md +++ b/docs/NOTIFICATIONS.md @@ -8,7 +8,7 @@ There are 3 ways how to influence notifications: 4. Ignoring devices > [!NOTE] -> It's recommended to use the same schedule interval for all plugins responsible for scanning devices, otherwise false positives might be reported if different devices are discovered by different plugins. Check the Settings > Enabled plugins section for a warning: +> It's recommended to use the same schedule interval for all plugins responsible for scanning devices, otherwise false positives might be reported if different devices are discovered by different plugins. Check the **Settings** > **Enabled settings** section for a warning: > ![Schedules out-of-sync](/docs/img/NOTIFICATIONS/Schedules_out-of-sync.png) @@ -36,7 +36,7 @@ On almost all plugins there are 2 core settings, `_WATCH` and `_ ![Global notification settings](/docs/img/NOTIFICATIONS/Global-notification-settings.png) -In the Notification Processing section, you can specify blanket rules. These allso to specify exceptions to the Plugin and Device settings and will override those. +In the Notification Processing section, you can specify blanket rules. These allow you to specify exceptions to the Plugin and Device settings and will override those. 1. Notify on (`NTFPRCS_INCLUDED_SECTIONS`) allows you to specify which events trigegr notifications. Usual setups will have `new_devices`, `down_devices`, and possibly `events` set. Setting `plugin` might be too noisy for most setups. 2. Alert down after (`NTFPRCS_alert_down_time`) is useful if you want to wait for some time before the system sends out a down notification for a device. This is related to the on-device **Alert down** setting. diff --git a/front/plugins/nmap_dev_scan/config.json b/front/plugins/nmap_dev_scan/config.json index eb38f150..e40e6d2a 100755 --- a/front/plugins/nmap_dev_scan/config.json +++ b/front/plugins/nmap_dev_scan/config.json @@ -300,7 +300,7 @@ { "function": "ARGS", "type": "text", - "default_value": "sudo nmap -sn ", + "default_value": "sudo nmap -sn -PR -n ", "options": [], "localized": [ "name", @@ -315,7 +315,7 @@ "description": [ { "language_code": "en_us", - "string": "Arguments to run nmap-scan with. Recommended and tested only with the setting:
sudo nmap -sn ." + "string": "Arguments to run nmap-scan with. Recommended and tested only with the setting:
sudo nmap -sn .

Note: The plugin attaches the interface and network mask, for example -e eth1 192.168.1.0/24 and performs a separate scan for each interface specified in the SCAN_SUBNETS setting." } ] } diff --git a/front/plugins/nmap_dev_scan/nmap_dev.py b/front/plugins/nmap_dev_scan/nmap_dev.py index ba23a7b7..8a387c44 100755 --- a/front/plugins/nmap_dev_scan/nmap_dev.py +++ b/front/plugins/nmap_dev_scan/nmap_dev.py @@ -83,9 +83,10 @@ def execute_scan (subnets_list, timeout): devices_list = [] # scan each interface - for interface in subnets_list: + nmap_output = execute_scan_on_interface(interface, timeout) + mylog('verbose', [f'[{pluginName}] nmap_output: ', nmap_output]) if nmap_output is not None: @@ -124,7 +125,7 @@ def execute_scan (subnets_list, timeout): def execute_scan_on_interface (interface, timeout): # Prepare command arguments - scan_args = get_setting_value('NMAPDEV_ARGS').split() + [interface.split()[0]] + scan_args = get_setting_value('NMAPDEV_ARGS').split() + interface.replace('--interface=','-e ').split() mylog('verbose', [f'[{pluginName}] scan_args: ', scan_args]) diff --git a/front/plugins/nslookup_scan/config.json b/front/plugins/nslookup_scan/config.json index 2904b3f0..4bac9650 100755 --- a/front/plugins/nslookup_scan/config.json +++ b/front/plugins/nslookup_scan/config.json @@ -54,7 +54,7 @@ }], "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." + "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.

Depends on the SCAN_SUBNETS setting." }] }, { @@ -112,7 +112,7 @@ }], "description": [{ "language_code":"en_us", - "string" : "Only enabled if you select schedule in the NSLOOKUP_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.

Depends on the SCAN_SUBNETS setting." + "string" : "Only enabled if you select schedule in the NSLOOKUP_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",