Files
NetAlertX/server
Ashtin 2a4198c2c8 Sanitize device fields and prevent crash with numeric hostnames
This patch improves the resilience of the guess_icon function by sanitizing mac, vendor, and name fields to avoid crashes caused by unexpected data types (e.g., numeric hostnames).

Specifically:

mac is now cast to a string before being uppercased, with a newly added fallback to "00:00:00:00:00:00" if empty or invalid.

vendor is sanitized to a string before lowercasing, still defaulting to "unknown".

name is cast to a string before lowercasing, still falling back to "(unknown)" when empty.

This change not only resolves the error caused by numeric-only hostnames (which triggered an AttributeError due to calling .lower() on an int), but also proactively prevents similar crashes from malformed or unexpected input in the future.

References: Fixes issue #1088 and also let's me sleep a little easier tonight.
2025-06-20 00:46:24 -04:00
..
2025-06-01 13:59:54 +10:00
2024-04-12 19:44:29 +10:00
2025-06-07 09:00:56 +10:00
2025-05-10 14:33:27 +10:00
2025-06-01 13:59:54 +10:00
2025-06-01 13:59:54 +10:00
2025-06-01 15:40:17 +10:00
2025-06-01 13:59:54 +10:00
2025-06-07 09:00:56 +10:00
2024-04-12 19:44:29 +10:00

NetAlertX modules

The original pilaert.py code is now moved to this new folder and split into different modules.

Module Description
__main__.py The MAIN program of NetAlertX
__init__.py an empty init file
README.md this readme file
../front/plugins a folder containing all plugins that publish notifications or scan for devices
api.py updating the API endpoints with the relevant data.
appevent.py TBC
const.py A place to define the constants for NetAlertX like log path or config path.
conf.py conf.py holds the configuration variables and makes them available for all modules. It is also the workaround for global variables that need to be resolved at some point
database.py This module connects to the DB, makes sure the DB is up to date and defines some standard queries and interfaces.
device.py The device module looks after the devices and saves the scan results into the devices
flows.py TBC
helper.py Helper as the name suggest contains multiple little functions and methods used in many of the other modules and helps keep things clean
initialise.py Initiatlise sets up the environment and makes everything ready to go
logger.py Logger is there the keep all the logs organised and looking identical.
networscan.py Networkscan collects the scan results (maybe to merge with reporting.py)
notification.py Creates and handles the notification object and generates ther HTML and text variants of the message
plugin.py This is where the plugins get integrated into the backend of NetAlertX
plugin_utils.py Helper utilities for plugin.py
reporting.py Reporting collects the data for the notification reports
scheduler.py All things scheduling