From bd6fa279700f3453ab704c0a30fed9c308a42b54 Mon Sep 17 00:00:00 2001 From: cemaxecuter Date: Sat, 31 Jan 2026 08:55:05 -0500 Subject: [PATCH] Detect existing monitor mode when loading agent interfaces When refreshing agent WiFi interfaces, check if any interface has type='monitor' and automatically set the monitor status to Active. Previously the UI only showed Active when monitor was explicitly enabled via the button. --- templates/index.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index 7951b7b..1905bc3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5459,15 +5459,28 @@ if (interfaces.length === 0) { select.innerHTML = ''; showNotification('WiFi', 'No WiFi interfaces found on remote agent.'); + monitorInterface = null; + updateMonitorStatus(false); } else { select.innerHTML = interfaces.map(i => { let label = i.name || i; if (i.display_name) label = i.display_name; else if (i.type) label += ` (${i.type})`; if (i.monitor_capable) label += ' [Monitor OK]'; - return ``; + return ``; }).join(''); showNotification('WiFi', `Found ${interfaces.length} interface(s) on agent`); + + // Check if any interface is already in monitor mode + const monitorIface = interfaces.find(i => i.type === 'monitor'); + if (monitorIface) { + monitorInterface = monitorIface.name; + updateMonitorStatus(true); + select.value = monitorIface.name; + } else { + monitorInterface = null; + updateMonitorStatus(false); + } } }) .catch(err => {