mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
f01e9021a1
commit
b201a95370
1 changed files with 13 additions and 16 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/evilsocket/bettercap-ng/core"
|
"github.com/evilsocket/bettercap-ng/core"
|
||||||
|
"github.com/evilsocket/bettercap-ng/log"
|
||||||
"github.com/evilsocket/bettercap-ng/network"
|
"github.com/evilsocket/bettercap-ng/network"
|
||||||
"github.com/evilsocket/bettercap-ng/session"
|
"github.com/evilsocket/bettercap-ng/session"
|
||||||
|
|
||||||
|
@ -235,26 +236,22 @@ func (w *WDiscovery) buildDeauthPkt(address1 net.HardwareAddr, address2 net.Hard
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *WDiscovery) sendDeauthPacket(ap net.HardwareAddr, client net.HardwareAddr) {
|
func (w *WDiscovery) sendDeauthPacket(ap net.HardwareAddr, client net.HardwareAddr) {
|
||||||
var pkt []byte
|
for seq := uint16(0); seq < 64; seq++ {
|
||||||
var err error
|
pkt := w.buildDeauthPkt(ap, client, ap, layers.Dot11TypeMgmtDeauthentication, layers.Dot11ReasonClass2FromNonAuth, seq)
|
||||||
|
if err := w.Handle.WritePacketData(pkt); err != nil {
|
||||||
var seq uint16
|
log.Error("Could not send deauth packet: %s", err)
|
||||||
for seq = 0; seq < 64; seq++ {
|
continue
|
||||||
pkt = w.buildDeauthPkt(ap, client, ap, layers.Dot11TypeMgmtDeauthentication, layers.Dot11ReasonClass2FromNonAuth, seq)
|
} else {
|
||||||
err = w.Handle.WritePacketData(pkt)
|
time.Sleep(2 * time.Millisecond)
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(2 * time.Millisecond)
|
|
||||||
|
|
||||||
pkt = w.buildDeauthPkt(client, ap, ap, layers.Dot11TypeMgmtDeauthentication, layers.Dot11ReasonClass2FromNonAuth, seq)
|
pkt = w.buildDeauthPkt(client, ap, ap, layers.Dot11TypeMgmtDeauthentication, layers.Dot11ReasonClass2FromNonAuth, seq)
|
||||||
err = w.Handle.WritePacketData(pkt)
|
if err := w.Handle.WritePacketData(pkt); err != nil {
|
||||||
if err != nil {
|
log.Error("Could not send deauth packet: %s", err)
|
||||||
return
|
continue
|
||||||
|
} else {
|
||||||
|
time.Sleep(2 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(2 * time.Millisecond)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue