diff --git a/back/update_vendors.sh b/back/update_vendors.sh index a1881dc4..d8df8c39 100755 --- a/back/update_vendors.sh +++ b/back/update_vendors.sh @@ -29,10 +29,7 @@ sudo cp -- *.csv 2_backup echo "" echo Download Start echo "" -sudo curl "$1" -LO https://standards-oui.ieee.org/iab/iab.csv \ - -LO https://standards-oui.ieee.org/iab/iab.txt \ - -LO https://standards-oui.ieee.org/oui28/mam.csv \ - -LO https://standards-oui.ieee.org/iab/iab.txt \ +sudo curl "$1" -LO https://standards-oui.ieee.org/oui28/mam.csv \ -LO https://standards-oui.ieee.org/oui28/mam.csv \ -LO https://standards-oui.ieee.org/oui28/mam.txt \ -LO https://standards-oui.ieee.org/oui36/oui36.csv \ diff --git a/docker-compose.yml b/docker-compose.yml index db933b65..4f5716be 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,7 @@ services: - ${APP_DATA_LOCATION}/pialert/php.ini:/etc/php/8.2/fpm/php.ini - ${DEV_LOCATION}/install:/home/pi/pialert/install - ${DEV_LOCATION}/front/css:/home/pi/pialert/front/css + - ${DEV_LOCATION}/back/update_vendors.sh:/home/pi/pialert/back/update_vendors.sh - ${DEV_LOCATION}/front/lib/AdminLTE:/home/pi/pialert/front/lib/AdminLTE - ${DEV_LOCATION}/front/js:/home/pi/pialert/front/js - ${DEV_LOCATION}/dockerfiles/start.sh:/home/pi/pialert/dockerfiles/start.sh diff --git a/front/plugins/vendor_update/script.py b/front/plugins/vendor_update/script.py index 09e696ab..c16ea48f 100755 --- a/front/plugins/vendor_update/script.py +++ b/front/plugins/vendor_update/script.py @@ -60,8 +60,8 @@ def update_vendor_database(): update_output = subprocess.check_output (update_args) except subprocess.CalledProcessError as e: # An error occured, handle it - mylog('none', [' FAILED: Updating vendors DB, set LOG_LEVEL=debug for more info']) - mylog('none', [e.output]) + mylog('verbose', [' FAILED: Updating vendors DB, set LOG_LEVEL=debug for more info']) + mylog('verbose', [e.output]) # ------------------------------------------------------------------------------ # resolve missing vendors diff --git a/pialert/README.md b/pialert/README.md index d3bf32fc..a92f8c2d 100755 --- a/pialert/README.md +++ b/pialert/README.md @@ -18,7 +18,7 @@ The original pilaert.py code is now moved to this new folder and split into diff |```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 teh scan results (maybe to merge with `reporting.py`) | +|```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 Pi.Alert | |```plugin_utils.py```| Helper utilities for `plugin.py` | diff --git a/pialert/device.py b/pialert/device.py index f4541058..6d1d8f62 100755 --- a/pialert/device.py +++ b/pialert/device.py @@ -366,9 +366,12 @@ def query_MAC_vendor (pMAC): with open(vendorsPath, 'r') as f: for line in f: if line.startswith(mac_start_string6): - vendor = line.split(' ', 1)[1].strip() - mylog('debug', [f"[Vendor Check] Found '{vendor}' for '{pMAC}' in {vendorsPath}"]) - return vendor + mylog('debug', [f"[Vendor Check] Macth found, line to process: {line}"]) + parts = line.split(' ', 1) + if len(parts) > 1: + vendor = parts[1].strip() + mylog('debug', [f"[Vendor Check] Found '{vendor}' for '{pMAC}' in {vendorsPath}"]) + return vendor return -1 # MAC address not found in the database diff --git a/pialert/reporting.py b/pialert/reporting.py index b749c3f2..34fe0063 100755 --- a/pialert/reporting.py +++ b/pialert/reporting.py @@ -84,8 +84,8 @@ def get_notifications (db): # Compose Devices Down Section # - select only Down Alerts with pending email of devices that didn't reconnect within the specified time window sqlQuery = f""" - SELECT * - FROM Events AS down_events + SELECT dev_Name, eve_MAC, dev_Vendor, eve_IP, eve_DateTime, eve_EventType + FROM Events_Devices AS down_events WHERE eve_PendingAlertEmail = 1 AND down_events.eve_EventType = 'Device Down' AND eve_DateTime < datetime('now', '-{get_setting_value('NTFPRCS_alert_down_time')} minutes', '{get_timezone_offset()}')