mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
110d288f98
commit
7356bf2295
2 changed files with 37 additions and 26 deletions
|
@ -3,6 +3,7 @@ package packets
|
|||
import (
|
||||
"net"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
)
|
||||
|
||||
|
@ -27,3 +28,27 @@ func NewDot11Deauth(a1 net.HardwareAddr, a2 net.HardwareAddr, a3 net.HardwareAdd
|
|||
&deauth,
|
||||
)
|
||||
}
|
||||
|
||||
func Dot11Parse(packet gopacket.Packet) (ok bool, radiotap *layers.RadioTap, dot11 *layers.Dot11) {
|
||||
ok = false
|
||||
radiotap = nil
|
||||
dot11 = nil
|
||||
|
||||
radiotapLayer := packet.Layer(layers.LayerTypeRadioTap)
|
||||
if radiotapLayer == nil {
|
||||
return
|
||||
}
|
||||
radiotap, ok = radiotapLayer.(*layers.RadioTap)
|
||||
if ok == false || radiotap == nil {
|
||||
return
|
||||
}
|
||||
|
||||
dot11Layer := packet.Layer(layers.LayerTypeDot11)
|
||||
if dot11Layer == nil {
|
||||
ok = false
|
||||
return
|
||||
}
|
||||
|
||||
dot11, ok = dot11Layer.(*layers.Dot11)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue