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
This commit is contained in:
Cobra
2026-04-06 11:35:52 -04:00
parent 841d43a3b3
commit 59cdda0596
2 changed files with 10 additions and 1 deletions
+8
View File
@@ -24,6 +24,7 @@ from typing import Optional, Type
from core.bus import EventBus, Event from core.bus import EventBus, Event
from core.state import StateManager from core.state import StateManager
from modules.base import BaseModule from modules.base import BaseModule
from utils.networking import get_primary_interface
logger = logging.getLogger("bb.engine") logger = logging.getLogger("bb.engine")
@@ -217,6 +218,13 @@ class Engine:
self._tier_limits = HARDWARE_TIERS.get(self._tier, HARDWARE_TIERS["generic"]) self._tier_limits = HARDWARE_TIERS.get(self._tier, HARDWARE_TIERS["generic"])
self._scope = config.get("scope", {}) self._scope = config.get("scope", {})
self._phase = config.get("engagement_phase", {}).get("mode", "passive_only") 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() self._lock = multiprocessing.Lock()
logger.info("Engine initialized (tier=%s, phase=%s)", self._tier, self._phase) logger.info("Engine initialized (tier=%s, phase=%s)", self._tier, self._phase)
+2 -1
View File
@@ -23,6 +23,7 @@ from pathlib import Path
from typing import Optional from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.networking import get_primary_interface
logger = logging.getLogger("bb.passive.packet_capture") logger = logging.getLogger("bb.passive.packet_capture")
@@ -62,7 +63,7 @@ class PacketCapture(BaseModule):
if self._running: if self._running:
return 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) snap_len = self.config.get("snap_length", self.DEFAULT_SNAP_LEN)
rotation = self.config.get("rotation_minutes", 60) * 60 rotation = self.config.get("rotation_minutes", 60) * 60
if rotation <= 0: if rotation <= 0: