mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Auto-refresh agent capabilities after monitor mode toggle
When monitor mode is toggled on a remote agent, the controller now automatically refreshes the agent's capabilities and updates the database. This keeps the UI interface list in sync without requiring a manual refresh.
This commit is contained in:
@@ -493,6 +493,24 @@ def proxy_wifi_monitor(agent_id: int):
|
||||
client = create_client_from_agent(agent)
|
||||
result = client.post('/wifi/monitor', data)
|
||||
|
||||
# Refresh agent capabilities after monitor mode toggle so UI stays in sync
|
||||
if result.get('status') == 'success':
|
||||
try:
|
||||
metadata = client.refresh_metadata()
|
||||
if metadata.get('healthy'):
|
||||
caps = metadata.get('capabilities') or {}
|
||||
agent_interfaces = caps.get('interfaces', {})
|
||||
if not agent_interfaces.get('sdr_devices') and caps.get('devices'):
|
||||
agent_interfaces['sdr_devices'] = caps.get('devices', [])
|
||||
update_agent(
|
||||
agent_id,
|
||||
capabilities=caps.get('modes'),
|
||||
interfaces=agent_interfaces,
|
||||
update_last_seen=True
|
||||
)
|
||||
except Exception:
|
||||
pass # Non-fatal if refresh fails
|
||||
|
||||
return jsonify({
|
||||
'status': result.get('status', 'error'),
|
||||
'agent_id': agent_id,
|
||||
|
||||
Reference in New Issue
Block a user