From 59cdda059625a59b6f70d3e053395cf705ed1d13 Mon Sep 17 00:00:00 2001 From: Cobra Date: Mon, 6 Apr 2026 11:35:52 -0400 Subject: [PATCH] Fix #206: Resolve auto interface to actual interface name - Engine.__init__ now detects actual interface when config has 'auto' - Uses get_primary_interface() to find default route interface - PacketCapture module updated to use detected interface with fallback - Handles Pi Zero 2W (wlan0) and other non-eth0 systems --- core/engine.py | 8 ++++++++ modules/passive/packet_capture.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/engine.py b/core/engine.py index 9baddb6..53c55d6 100644 --- a/core/engine.py +++ b/core/engine.py @@ -24,6 +24,7 @@ from typing import Optional, Type from core.bus import EventBus, Event from core.state import StateManager from modules.base import BaseModule +from utils.networking import get_primary_interface logger = logging.getLogger("bb.engine") @@ -217,6 +218,13 @@ class Engine: self._tier_limits = HARDWARE_TIERS.get(self._tier, HARDWARE_TIERS["generic"]) self._scope = config.get("scope", {}) self._phase = config.get("engagement_phase", {}).get("mode", "passive_only") + + # Resolve "auto" interface to actual interface name + if self.config.get("network", {}).get("primary_interface") == "auto": + actual_iface = get_primary_interface() + if actual_iface: + self.config.setdefault("network", {})["primary_interface"] = actual_iface + logger.debug("Resolved auto interface to: %s", actual_iface) self._lock = multiprocessing.Lock() logger.info("Engine initialized (tier=%s, phase=%s)", self._tier, self._phase) diff --git a/modules/passive/packet_capture.py b/modules/passive/packet_capture.py index 9baef89..bf8a786 100644 --- a/modules/passive/packet_capture.py +++ b/modules/passive/packet_capture.py @@ -23,6 +23,7 @@ from pathlib import Path from typing import Optional from modules.base import BaseModule +from utils.networking import get_primary_interface logger = logging.getLogger("bb.passive.packet_capture") @@ -62,7 +63,7 @@ class PacketCapture(BaseModule): if self._running: return - iface = self.config.get("interface", self.DEFAULT_INTERFACE) + iface = self.config.get("interface") or get_primary_interface() or self.DEFAULT_INTERFACE snap_len = self.config.get("snap_length", self.DEFAULT_SNAP_LEN) rotation = self.config.get("rotation_minutes", 60) * 60 if rotation <= 0: