NMAPDEV plugin work v0.6 #645 🆕🔎

This commit is contained in:
jokob-sk
2024-04-27 10:30:40 +10:00
parent fbbe4dc64b
commit 87b114604c
6 changed files with 19 additions and 21 deletions

View File

@@ -43,7 +43,7 @@ In the Notification Processing section, you can specify blanket rules. These all
3. A filter to allow you to set device-specific exceptions to New devices being added to the app.
4. A filter to allow you to set device-specific exceptions to generated Events.
## Ignoring devices 🛑
## Ignoring devices 🔕
![Ignoring new devices](/docs/img/NOTIFICATIONS/NEWDEV_ignores.png)

View File

@@ -30,6 +30,7 @@ There is also an in-app Help / FAQ section that should be answering frequently a
- [Subnets and VLANs configuration for arp-scan](/docs/SUBNETS.md)
- [SMTP server config](/docs/SMTP.md)
- [Custom Icon configuration and support](/docs/ICONS.md)
- [Notifications](/docs/NOTIFICATIONS.md)
- [Better name resolution with Reverse DNS](/docs/REVERSE_DNS.md)
- [Network treemap configuration](/docs/NETWORK_TREE.md)
- [Backups](/docs/BACKUPS.md)

View File

@@ -1,5 +1,3 @@
> Community translations of this file (might be out-of-date): <a href="https://github.com/jokob-sk/NetAlertX/blob/main/front/plugins/README_ES.md">Spanish(<img src="https://github.com/lipis/flag-icons/blob/main/flags/4x3/es.svg" alt="README_ES.md" style="height: 16px !important;width: 20px !important;padding-inline:3px !important;">)</a>, <a href="https://github.com/jokob-sk/NetAlertX/blob/main/front/plugins/README_DE.md">German(<img src="https://github.com/lipis/flag-icons/blob/main/flags/4x3/de.svg" alt="README_DE.md" style="height: 16px !important;width: 20px !important;padding-inline:3px !important;">)</a>
# 📚 Docs for individual plugins
>[!NOTE]

View File

@@ -1,15 +1,3 @@
### Community translations of this file
<a href="https://github.com/jokob-sk/NetAlertX/blob/main/front/plugins/csv_backup/README_ES.md">
<img src="https://github.com/lipis/flag-icons/blob/main/flags/4x3/es.svg" alt="README_ES.md" style="height: 20px !important;width: 20px !important;">
Spanish (Spain)
</a>
<br>
<a href="https://github.com/jokob-sk/NetAlertX/blob/main/front/plugins/csv_backup/README_DE.md">
<img src="https://github.com/lipis/flag-icons/blob/main/flags/4x3/de.svg" alt="README_DE.md" style="height: 20px !important;width: 20px !important;">
German (Germany)
</a>
## Overview
Plugin generating CSV backups of your Devices database table, including the network mappings. Can be used for importing your setup via the Maintenance > Backup / Restore > CSV Import feature (See also: [Devices Bulk Editing](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DEVICES_BULK_EDITING.md)).

View File

@@ -100,14 +100,23 @@ def execute_scan (subnets_list, timeout):
# lines[1] can be Host is up (0.21s latency).
# lines[2] can be MAC Address: 6C:4A:4A:7B:4A:43 (Motorola Mobility, a Lenovo Company)
ip_address = extract_ip_addresses(lines[0])[0]
ip_addresses = extract_ip_addresses(lines[0])
host_name = extract_between_strings(lines[0], ' ', ' ')
vendor = extract_between_strings(lines[2], '(', ')')
mac_addresses = extract_mac_addresses(lines[2])
if len(mac_addresses) == 1:
# only include results with a MAC address and IPs as it's used as a unique ID
if len(mac_addresses) == 1 and len(ip_addresses) == 1:
devices_list.append({'name': host_name, 'ip': ip_address, 'mac': mac_addresses[0], 'vendor': vendor, 'interface': interface})
devices_list.append({'name' : host_name,
'ip' : ip_addresses[0],
'mac' : mac_addresses[0],
'vendor' : vendor,
'interface': interface})
else:
mylog('verbose', [f"[{pluginName}] Skipped (Couldn't parse MAC or IP): ", lines])
else:
mylog('verbose', [f"[{pluginName}] Skipped (Not enough info in output): ", lines])
return devices_list

View File

@@ -38,15 +38,17 @@ timeZoneSetting = configFile['TIMEZONE']
timeZone = pytz.timezone(timeZoneSetting)
# -------------------------------------------------------------------
# Sanitizes plugin output
def handleEmpty(input):
if input == '' or None:
if not input:
return 'null'
else:
# Validate and sanitize message content
# Remove potentially problematic characters if string
if isinstance(input, str):
input = re.sub(r'[^\x00-\x7F]+', ' ', input)
return input
input = input.replace('\n', '') # Removing new lines
return input
# -------------------------------------------------------------------
# Check if a valid MAC address