mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
63a07cf262
commit
0a8b8548b6
6 changed files with 39 additions and 38 deletions
|
@ -26,6 +26,24 @@ var (
|
|||
IPv4Validator = regexp.MustCompile("^[0-9\\.]+/?\\d*$")
|
||||
)
|
||||
|
||||
func IsZeroMac(mac net.HardwareAddr) bool {
|
||||
for _, b := range mac {
|
||||
if b != 0x00 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func IsBroadcastMac(mac net.HardwareAddr) bool {
|
||||
for _, b := range mac {
|
||||
if b != 0xff {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func NormalizeMac(mac string) string {
|
||||
var parts []string
|
||||
if strings.ContainsRune(mac, '-') {
|
||||
|
|
|
@ -7,6 +7,17 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
func Dot11Freq2Chan(freq int) int {
|
||||
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
|
||||
}
|
||||
|
||||
type APNewCallback func(ap *AccessPoint)
|
||||
type APLostCallback func(ap *AccessPoint)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue