Add TSCM support to distributed agent with local mode parity

- Agent TSCM uses same ThreatDetector and CorrelationEngine as local mode
- Added baseline_id parameter support using get_tscm_baseline()
- Fixed RF scan stop_check to allow agent-specific stop events
- Fixed 'undefined MHz' display for WiFi devices (added essid fallback and null check)
- Fixed signal strength type conversion (string to int) for correlation engine
- Agent threat detection matches local mode behavior:
  - No baseline: detects anomaly/hidden_camera threats only
  - With baseline: also detects new_device threats
This commit is contained in:
cemaxecuter
2026-01-27 08:47:02 -05:00
parent d775ba5b3e
commit f916b9fa19
5 changed files with 859 additions and 240 deletions

View File

@@ -153,10 +153,16 @@ def get_agent_detail(agent_id: int):
client = create_client_from_agent(agent)
metadata = client.refresh_metadata()
if metadata['healthy']:
caps = metadata['capabilities'] or {}
# Store full interfaces structure (wifi, bt, sdr)
agent_interfaces = caps.get('interfaces', {})
# Fallback: also include top-level devices for backwards compatibility
if not agent_interfaces.get('sdr_devices') and caps.get('devices'):
agent_interfaces['sdr_devices'] = caps.get('devices', [])
update_agent(
agent_id,
capabilities=metadata['capabilities'].get('modes') if metadata['capabilities'] else None,
interfaces={'devices': metadata['capabilities'].get('devices', [])} if metadata['capabilities'] else None,
capabilities=caps.get('modes'),
interfaces=agent_interfaces,
update_last_seen=True
)
agent = get_agent(agent_id)
@@ -215,10 +221,15 @@ def refresh_agent_metadata(agent_id: int):
if metadata['healthy']:
caps = metadata['capabilities'] or {}
# Store full interfaces structure (wifi, bt, sdr)
agent_interfaces = caps.get('interfaces', {})
# Fallback: also include top-level devices for backwards compatibility
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={'devices': caps.get('devices', [])},
interfaces=agent_interfaces,
update_last_seen=True
)
agent = get_agent(agent_id)