mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
wifi module: fix on beacon parsing and multiple channel selection
This commit is contained in:
parent
582e1ae81e
commit
4726c2fc9d
4 changed files with 105 additions and 22 deletions
|
@ -126,3 +126,20 @@ func Dot11IsDataFor(dot11 *layers.Dot11, station net.HardwareAddr) bool {
|
|||
// packet going to this specific BSSID?
|
||||
return bytes.Compare(dot11.Address1, station) == 0
|
||||
}
|
||||
|
||||
func Dot11ParseDSSet(packet gopacket.Packet) (bool, int) {
|
||||
channel := 0
|
||||
found := false
|
||||
for _, layer := range packet.Layers() {
|
||||
info, ok := layer.(*layers.Dot11InformationElement)
|
||||
if ok == true {
|
||||
if info.ID == layers.Dot11InformationElementIDDSSet {
|
||||
channel, _ = Dot11InformationElementIDDSSetDecode(info.Info)
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found, channel
|
||||
}
|
||||
|
|
|
@ -211,3 +211,11 @@ func Dot11InformationElementRSNInfoDecode(buf []byte) (rsn RSNInfo, err error) {
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
func Dot11InformationElementIDDSSetDecode(buf []byte) (channel int, err error) {
|
||||
if err = canParse("DSSet.channel", buf, 1); err == nil {
|
||||
channel = int(buf[0])
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue