Compare commits

...

12 Commits

Author SHA1 Message Date
jokob-sk
e776c3ac41 Merge branch 'main' of https://github.com/jokob-sk/NetAlertX
Some checks are pending
docker / docker_dev (push) Waiting to run
2024-11-22 19:01:39 +11:00
jokob-sk
81af82073e (Unknown) vendor not updated #889 2024-11-22 19:01:20 +11:00
Hosted Weblate
cddf4cf086 Merge branch 'origin/main' into Weblate. 2024-11-22 07:43:50 +00:00
Massimo Pissarello
a4f3d8c60e Translated using Weblate (Italian)
Currently translated at 100.0% (719 of 719 strings)

Translation: NetAlertX/core
Translate-URL: https://hosted.weblate.org/projects/pialert/core/it/
2024-11-22 07:43:49 +00:00
Sylvain Pichon
a8a2dab4bc Translated using Weblate (French)
Currently translated at 100.0% (719 of 719 strings)

Translation: NetAlertX/core
Translate-URL: https://hosted.weblate.org/projects/pialert/core/fr/
2024-11-22 07:43:48 +00:00
jokob-sk
9b0c722922 (Unknown) vendor not updated #889 2024-11-22 18:43:30 +11:00
jokob-sk
8f9c3d2091 Merge branch 'main' of https://github.com/jokob-sk/NetAlertX 2024-11-22 13:23:38 +11:00
jokob-sk
c5ef9645e6 WAL truncating #769 2024-11-22 13:23:11 +11:00
Hosted Weblate
04faef6dae Merge branch 'origin/main' into Weblate. 2024-11-22 02:33:36 +01:00
gallegonovato
825bff9ce7 Translated using Weblate (Spanish)
Currently translated at 100.0% (719 of 719 strings)

Translation: NetAlertX/core
Translate-URL: https://hosted.weblate.org/projects/pialert/core/es/
2024-11-22 02:33:36 +01:00
jokob-sk
eee84b23b8 Merge branch 'main' of https://github.com/jokob-sk/NetAlertX 2024-11-22 12:33:24 +11:00
jokob-sk
a9a4d397dc (unknown) vendor update #889 2024-11-22 12:33:08 +11:00
9 changed files with 30 additions and 29 deletions

View File

@@ -30,13 +30,12 @@ IEEE_OUI_URL="http://standards-oui.ieee.org/oui/oui.txt"
# Download the file using wget
wget "$IEEE_OUI_URL" -O ieee-oui_dl.txt
# Filter lines containing "(base 16)" and remove the "(base 16)" string
grep "(base 16)" ieee-oui_dl.txt | sed 's/ *(base 16)//' > ieee-oui_new.txt
# Combine ieee-oui_new.txt and ieee-oui.txt, and extract unique MAC start values along with vendor names
# Filter lines containing "(base 16)" and format them with a tab between MAC and vendor
grep "(base 16)" ieee-oui_dl.txt | sed -E 's/ *\(base 16\)//' | awk -F' ' '{printf "%s\t%s\n", $1, substr($0, index($0, $2))}' > ieee-oui_new.txt
# Combine, sort, and remove duplicates, ensuring tab-separated output
cat ieee-oui.txt ieee-oui_new.txt >> ieee-oui_all.txt
sort ieee-oui_all.txt > ieee-oui_all_sort.txt
awk '{$1=$1; print}' ieee-oui_all_sort.txt | sort -u > ieee-oui_all_filtered.txt
sort ieee-oui_all.txt | awk '{$1=$1; print}' | sort -u | awk -F' ' '{printf "%s\t%s\n", $1, substr($0, index($0, $2))}' > ieee-oui_all_filtered.txt

View File

@@ -40,7 +40,9 @@
// Size and last mod of DB ------------------------------------------------------
$nax_db = str_replace('front', 'db', getcwd()).'/app.db';
$nax_wal = str_replace('front', 'db', getcwd()).'/app.db-wal';
$nax_db_size = number_format((filesize($nax_db) / 1000000),2,",",".") . ' MB';
$nax_wal_size = number_format((filesize($nax_wal) / 1000000),2,",",".") . ' MB';
$nax_db_mod = date ("F d Y H:i:s", filemtime($nax_db));
@@ -104,13 +106,13 @@ $db->close();
<div class="db_info_table_row">
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_database_path');?></div>
<div class="db_info_table_cell">
<?php echo $nax_db;?>
<?php echo $nax_db;?>
</div>
</div>
<div class="db_info_table_row">
<div class="db_info_table_cell"><?= lang('Maintenance_database_size');?></div>
<div class="db_info_table_cell">
<?php echo $nax_db_size;?>
<?php echo $nax_db_size;?> (wal: <?php echo $nax_wal_size;?>)
</div>
</div>
<div class="db_info_table_row">

2
front/php/templates/language/es_es.json Normal file → Executable file
View File

@@ -790,7 +790,7 @@
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "Cargue más editor@s con el ajuste <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a>",
"settings_publishers_label": "Editores",
"settings_readonly": "",
"settings_readonly": "No se puede LEER ni ESCRIBIR <code>app.conf</code>. Intente reiniciar el contenedor y lea la <a href=\"https://github.com/jokob-sk/NetAlertX/blob/main/docs/FILE_PERMISSIONS.md\" target=\"_blank\">documentación de permisos de archivo</a>",
"settings_saved": "<br/>Ajustes guardados. <br/><br/> Recargando... <br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
"settings_system_icon": "fa-solid fa-gear",
"settings_system_label": "Sistema",

2
front/php/templates/language/fr_fr.json Normal file → Executable file
View File

@@ -711,7 +711,7 @@
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "Charger plus de passerelles de publication avec le paramètre <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a>",
"settings_publishers_label": "Passerelles de publication",
"settings_readonly": "",
"settings_readonly": "Impossible de LIRE ou ÉCRIRE <code>app.conf</code>. Essayer de relancer le container et lire la <a href=\"https://github.com/jokob-sk/NetAlertX/blob/main/docs/FILE_PERMISSIONS.md\" target=\"_blank\">documentation sur les droits des fichiers</a>",
"settings_saved": "<br/>Paramètres enregistrés. <br/> Rechargement... <br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
"settings_system_icon": "fa-solid fa-gear",
"settings_system_label": "Système",

View File

@@ -711,7 +711,7 @@
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "Carica più editori con l'impostazione <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a>",
"settings_publishers_label": "Editori",
"settings_readonly": "",
"settings_readonly": "Impossibile LEGGERE o SCRIVERE <code>app.conf</code>. Prova a riavviare il contenitore e leggi la <a href=\"https://github.com/jokob-sk/NetAlertX/blob/main/docs/FILE_PERMISSIONS.md\" target=\"_blank\">documentazione sulle autorizzazioni dei file</a>",
"settings_saved": "<br/>Impostazioni salvate. <br/> Aggiornamento in corso... <br/> <i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
"settings_system_icon": "fa-solid fa-gear",
"settings_system_label": "Sistema",

View File

@@ -60,7 +60,7 @@ def cleanup_database (dbPath, DAYS_TO_KEEP_EVENTS, PHOLUS_DAYS_DATA, HRS_TO_KEEP
mylog('verbose', [f'[{pluginName}] Upkeep Database:' ])
# Connect to the App database
conn = sqlite3.connect(dbPath)
conn = sqlite3.connect(dbPath, timeout=30)
cursor = conn.cursor()
# -----------------------------------------------------
@@ -149,7 +149,7 @@ def cleanup_database (dbPath, DAYS_TO_KEEP_EVENTS, PHOLUS_DAYS_DATA, HRS_TO_KEEP
# Cleanup Offline Devices
if HRS_TO_KEEP_OFFDEV != 0:
mylog('verbose', [f'[{pluginName}] Devices: Delete all New Devices older than {str(HRS_TO_KEEP_OFFDEV)} hours (HRS_TO_KEEP_OFFDEV setting)'])
query = f"""DELETE FROM Devices WHERE devPresentLastScan = 0 AND devLastConnection < date('now', '-{str(HRS_TO_KEEP_OFFDEV)} hour'))"""
query = f"""DELETE FROM Devices WHERE devPresentLastScan = 0 AND devLastConnection < date('now', '-{str(HRS_TO_KEEP_OFFDEV)} hour')"""
mylog('verbose', [f'[{pluginName}] Query: {query} '])
cursor.execute (query)
@@ -204,13 +204,18 @@ def cleanup_database (dbPath, DAYS_TO_KEEP_EVENTS, PHOLUS_DAYS_DATA, HRS_TO_KEEP
conn.commit()
# Check WAL file size
cursor.execute("PRAGMA wal_checkpoint(TRUNCATE);")
cursor.execute("PRAGMA wal_checkpoint(FULL);")
mylog('verbose', [f'[{pluginName}] WAL checkpoint executed to truncate file.'])
# Shrink DB
mylog('verbose', [f'[{pluginName}] Shrink Database'])
cursor.execute ("VACUUM;")
# Close the database connection
conn.close()
conn.close()
#===============================================================================

View File

@@ -44,7 +44,7 @@ def handleEmpty(input):
return 'null'
else:
# Validate and sanitize message content
# Remove potentially problematic characters if string
# Remove potentially problematic characters in string
if isinstance(input, str):
input = re.sub(r'[^\x00-\x7F]+', ' ', input)
input = input.replace('\n', '') # Removing new lines

View File

@@ -182,7 +182,7 @@ def main ():
mylog('verbose', ['[Notification] No changes to report'])
# Commit SQL
db.commitDB()
db.commitDB()
# Footer
@@ -198,11 +198,6 @@ def main ():
#===============================================================================
# BEGIN
#===============================================================================

View File

@@ -317,7 +317,7 @@ def update_devices_data_from_scan (db):
WHERE EXISTS (SELECT 1 FROM CurrentScan
WHERE devMac = cur_MAC) """)
# Update only devices with empty or NULL vendors
# Update only devices with empty, NULL or (u(U)nknown) vendors
mylog('debug', '[Update Devices] - cur_Vendor -> (if empty) devVendor')
sql.execute("""UPDATE Devices
SET devVendor = (
@@ -326,7 +326,7 @@ def update_devices_data_from_scan (db):
WHERE Devices.devMac = CurrentScan.cur_MAC
)
WHERE
(devVendor IS NULL OR devVendor IN ("", "null"))
(devVendor IS NULL OR devVendor IN ("", "null", "(unknown)", "(Unknown)"))
AND EXISTS (
SELECT 1
FROM CurrentScan
@@ -439,8 +439,8 @@ def update_devices_data_from_scan (db):
# Update VENDORS
recordsToUpdate = []
query = """SELECT * FROM Devices
WHERE devVendor = '(unknown)' OR devVendor =''
OR devVendor IS NULL"""
WHERE devVendor IS NULL OR devVendor IN ("", "null", "(unknown)", "(Unknown)")
"""
for device in sql.execute (query) :
vendor = query_MAC_vendor (device['devMac'])
@@ -469,8 +469,8 @@ def update_devices_data_from_scan (db):
# Guess Type
recordsToUpdate = []
query = """SELECT * FROM Devices
WHERE devType in ('', 'null')
OR devType IS NULL"""
WHERE devType in ('', 'null')
OR devType IS NULL"""
default_type = get_setting_value('NEWDEV_devType')
for device in sql.execute (query) :
@@ -634,7 +634,7 @@ def query_MAC_vendor (pMAC):
for line in f:
line_lower = line.lower() # Convert line to lowercase for case-insensitive matching
if line_lower.startswith(mac_start_string6):
parts = line.split(' ', 1)
parts = line.split('\t', 1)
if len(parts) > 1:
vendor = parts[1].strip()
mylog('debug', [f"[Vendor Check] Found '{vendor}' for '{pMAC}' in {vendorsPath}"])