mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
fixed a bug caused by multiple wifi devices attached with different supported frequencies
This commit is contained in:
parent
529a1b48d9
commit
a3b730ce69
1 changed files with 14 additions and 16 deletions
|
@ -441,23 +441,21 @@ func (mod *WiFiModule) Configure() error {
|
|||
mod.hopPeriod = time.Duration(hopPeriod) * time.Millisecond
|
||||
|
||||
if mod.source == "" {
|
||||
// No channels setted, retrieve frequencies supported by the card
|
||||
if len(mod.frequencies) == 0 {
|
||||
if freqs, err := network.GetSupportedFrequencies(ifName); err != nil {
|
||||
return fmt.Errorf("error while getting supported frequencies of %s: %s", ifName, err)
|
||||
} else {
|
||||
mod.setFrequencies(freqs)
|
||||
}
|
||||
|
||||
mod.Debug("wifi supported frequencies: %v", mod.frequencies)
|
||||
|
||||
// we need to start somewhere, this is just to check if
|
||||
// this OS supports switching channel programmatically.
|
||||
if err = network.SetInterfaceChannel(ifName, 1); err != nil {
|
||||
return fmt.Errorf("error while initializing %s to channel 1: %s", ifName, err)
|
||||
}
|
||||
mod.Info("started (min rssi: %d dBm)", mod.minRSSI)
|
||||
if freqs, err := network.GetSupportedFrequencies(ifName); err != nil {
|
||||
return fmt.Errorf("error while getting supported frequencies of %s: %s", ifName, err)
|
||||
} else {
|
||||
mod.setFrequencies(freqs)
|
||||
}
|
||||
|
||||
mod.Debug("wifi supported frequencies: %v", mod.frequencies)
|
||||
|
||||
// we need to start somewhere, this is just to check if
|
||||
// this OS supports switching channel programmatically.
|
||||
if err = network.SetInterfaceChannel(ifName, 1); err != nil {
|
||||
return fmt.Errorf("error while initializing %s to channel 1: %s", ifName, err)
|
||||
}
|
||||
|
||||
mod.Info("started (min rssi: %d dBm)", mod.minRSSI)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue