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

This commit is contained in:
evilsocket 2018-02-17 01:05:58 +01:00
commit 5314e9ff50
2 changed files with 14 additions and 21 deletions

View file

@ -7,25 +7,19 @@ import (
"github.com/google/gopacket/layers"
)
func NewDot11Deauth(a1 net.HardwareAddr, a2 net.HardwareAddr, a3 net.HardwareAddr, t layers.Dot11Type, reason layers.Dot11Reason, seq uint16) (error, []byte) {
var (
deauth layers.Dot11MgmtDeauthentication
dot11Layer layers.Dot11
radioTapLayer layers.RadioTap
)
deauth.Reason = reason
dot11Layer.Address1 = a1
dot11Layer.Address2 = a2
dot11Layer.Address3 = a3
dot11Layer.Type = t
dot11Layer.SequenceNumber = seq
func NewDot11Deauth(a1 net.HardwareAddr, a2 net.HardwareAddr, a3 net.HardwareAddr, seq uint16) (error, []byte) {
return Serialize(
&radioTapLayer,
&dot11Layer,
&deauth,
&layers.RadioTap{},
&layers.Dot11{
Address1: a1,
Address2: a2,
Address3: a3,
Type: layers.Dot11TypeMgmtDeauthentication,
SequenceNumber: seq,
},
&layers.Dot11MgmtDeauthentication{
Reason: layers.Dot11ReasonClass2FromNonAuth,
},
)
}