mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
new: started implementing RSN PMKID parsing support (ref #436)
This commit is contained in:
parent
e1d72342f6
commit
0ec645afd3
4 changed files with 39 additions and 3 deletions
|
@ -1,8 +1,10 @@
|
|||
package network
|
||||
|
||||
import (
|
||||
"github.com/google/gopacket"
|
||||
"sync"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
)
|
||||
|
||||
type Handshake struct {
|
||||
|
@ -34,6 +36,29 @@ func (h *Handshake) SetBeacon(pkt gopacket.Packet) {
|
|||
}
|
||||
}
|
||||
|
||||
func (h *Handshake) AddAndGetPMKID(pkt gopacket.Packet) []byte {
|
||||
h.AddFrame(0, pkt)
|
||||
|
||||
prevWasKey := false
|
||||
for _, layer := range pkt.Layers() {
|
||||
if layer.LayerType() == layers.LayerTypeEAPOLKey {
|
||||
prevWasKey = true
|
||||
continue
|
||||
}
|
||||
|
||||
if prevWasKey && layer.LayerType() == layers.LayerTypeDot11InformationElement {
|
||||
info := layer.(*layers.Dot11InformationElement)
|
||||
if info.ID == layers.Dot11InformationElementIDVendor && info.Length == 20 {
|
||||
return info.Info
|
||||
}
|
||||
}
|
||||
|
||||
prevWasKey = false
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handshake) AddFrame(n int, pkt gopacket.Packet) {
|
||||
h.Lock()
|
||||
defer h.Unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue