misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2018-03-12 15:58:45 +01:00
commit 0a8b8548b6
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
6 changed files with 39 additions and 38 deletions

View file

@ -7,18 +7,6 @@ import (
"github.com/bettercap/bettercap/network"
)
func mhz2chan(freq int) int {
// ambo!
if freq <= 2472 {
return ((freq - 2412) / 5) + 1
} else if freq == 2484 {
return 14
} else if freq >= 5035 && freq <= 5865 {
return ((freq - 5035) / 5) + 7
}
return 0
}
func (w *WiFiModule) onChannel(channel int, cb func()) {
prev := w.stickChan
w.stickChan = channel
@ -49,7 +37,7 @@ func (w *WiFiModule) channelHopper() {
}
for _, frequency := range w.frequencies {
channel := mhz2chan(frequency)
channel := network.Dot11Freq2Chan(frequency)
// stick to the access point channel as long as it's selected
// or as long as we're deauthing on it
if w.stickChan != 0 {