mirror of
https://github.com/smittix/intercept.git
synced 2026-07-24 16:58:12 -07:00
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:
+14
-3
@@ -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)
|
||||
|
||||
+11
-2
@@ -944,7 +944,7 @@ def _scan_bluetooth_devices(interface: str, duration: int = 10) -> list[dict]:
|
||||
return devices
|
||||
|
||||
|
||||
def _scan_rf_signals(sdr_device: int | None, duration: int = 30) -> list[dict]:
|
||||
def _scan_rf_signals(sdr_device: int | None, duration: int = 30, stop_check: callable | None = None) -> list[dict]:
|
||||
"""
|
||||
Scan for RF signals using SDR (rtl_power).
|
||||
|
||||
@@ -956,7 +956,16 @@ def _scan_rf_signals(sdr_device: int | None, duration: int = 30) -> list[dict]:
|
||||
- 915 MHz: US ISM band
|
||||
- 1.2 GHz: Video transmitters
|
||||
- 2.4 GHz: WiFi, Bluetooth, video transmitters
|
||||
|
||||
Args:
|
||||
sdr_device: SDR device index
|
||||
duration: Scan duration per band
|
||||
stop_check: Optional callable that returns True if scan should stop.
|
||||
Defaults to checking module-level _sweep_running.
|
||||
"""
|
||||
# Default stop check uses module-level _sweep_running
|
||||
if stop_check is None:
|
||||
stop_check = lambda: not _sweep_running
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
@@ -1021,7 +1030,7 @@ def _scan_rf_signals(sdr_device: int | None, duration: int = 30) -> list[dict]:
|
||||
|
||||
# Scan each band and look for strong signals
|
||||
for start_freq, end_freq, bin_size, band_name in scan_bands:
|
||||
if not _sweep_running:
|
||||
if stop_check():
|
||||
break
|
||||
|
||||
logger.info(f"Scanning {band_name} ({start_freq/1e6:.1f}-{end_freq/1e6:.1f} MHz)")
|
||||
|
||||
Reference in New Issue
Block a user