new: wifi module reports current channel in state

This commit is contained in:
evilsocket 2025-03-27 13:18:21 +01:00
parent 7a2ecb15f6
commit 3a360e4622
2 changed files with 6 additions and 0 deletions

View file

@ -104,7 +104,10 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
}
mod.InitState("channels")
mod.InitState("channel")
mod.State.Store("channels", []int{})
mod.State.Store("channel", 0)
mod.AddParam(session.NewStringParameter("wifi.interface",
"",
@ -661,6 +664,7 @@ func (mod *WiFiModule) Configure() error {
if err = network.SetInterfaceChannel(ifName, 1); err != nil {
return fmt.Errorf("error while initializing %s to channel 1: %s", ifName, err)
}
mod.State.Store("channel", 1)
mod.Info("started (min rssi: %d dBm)", mod.minRSSI)
}

View file

@ -36,6 +36,8 @@ func (mod *WiFiModule) hopUnlocked(channel int) (mustStop bool) {
}
}
mod.State.Store("channel", channel)
return
}