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
7356bf2295
commit
5314e9ff50
2 changed files with 14 additions and 21 deletions
|
@ -168,7 +168,6 @@ func mhz2chan(freq int) int {
|
|||
if freq <= 2484 {
|
||||
return ((freq - 2412) / 5) + 1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -263,7 +262,7 @@ func (w *WiFiRecon) Configure() error {
|
|||
|
||||
func (w *WiFiRecon) sendDeauthPacket(ap net.HardwareAddr, client net.HardwareAddr) {
|
||||
for seq := uint16(0); seq < 64; seq++ {
|
||||
if err, pkt := packets.NewDot11Deauth(ap, client, ap, layers.Dot11TypeMgmtDeauthentication, layers.Dot11ReasonClass2FromNonAuth, seq); err != nil {
|
||||
if err, pkt := packets.NewDot11Deauth(ap, client, ap, seq); err != nil {
|
||||
log.Error("Could not create deauth packet: %s", err)
|
||||
continue
|
||||
} else if err := w.handle.WritePacketData(pkt); err != nil {
|
||||
|
@ -273,7 +272,7 @@ func (w *WiFiRecon) sendDeauthPacket(ap net.HardwareAddr, client net.HardwareAdd
|
|||
time.Sleep(2 * time.Millisecond)
|
||||
}
|
||||
|
||||
if err, pkt := packets.NewDot11Deauth(client, ap, ap, layers.Dot11TypeMgmtDeauthentication, layers.Dot11ReasonClass2FromNonAuth, seq); err != nil {
|
||||
if err, pkt := packets.NewDot11Deauth(client, ap, ap, seq); err != nil {
|
||||
log.Error("Could not create deauth packet: %s", err)
|
||||
continue
|
||||
} else if err := w.handle.WritePacketData(pkt); err != nil {
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue