mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
fix: every wifi frame injection operation on macOS will print an error (ref #448)
This commit is contained in:
parent
5858743b6e
commit
2499d5147f
3 changed files with 24 additions and 13 deletions
|
@ -5,23 +5,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/bettercap/bettercap/network"
|
"github.com/bettercap/bettercap/network"
|
||||||
"github.com/bettercap/bettercap/packets"
|
"github.com/bettercap/bettercap/packets"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (mod *WiFiModule) injectPacket(data []byte) {
|
|
||||||
if err := mod.handle.WritePacketData(data); err != nil {
|
|
||||||
mod.Error("could not inject WiFi packet: %s", err)
|
|
||||||
mod.Session.Queue.TrackError()
|
|
||||||
} else {
|
|
||||||
mod.Session.Queue.TrackSent(uint64(len(data)))
|
|
||||||
}
|
|
||||||
// let the network card breath a little
|
|
||||||
time.Sleep(10 * time.Millisecond)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *WiFiModule) sendDeauthPacket(ap net.HardwareAddr, client net.HardwareAddr) {
|
func (mod *WiFiModule) sendDeauthPacket(ap net.HardwareAddr, client net.HardwareAddr) {
|
||||||
for seq := uint16(0); seq < 64 && mod.Running(); seq++ {
|
for seq := uint16(0); seq < 64 && mod.Running(); seq++ {
|
||||||
if err, pkt := packets.NewDot11Deauth(ap, client, ap, seq); err != nil {
|
if err, pkt := packets.NewDot11Deauth(ap, client, ap, seq); err != nil {
|
||||||
|
|
18
modules/wifi/wifi_inject.go
Normal file
18
modules/wifi/wifi_inject.go
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//go:build !darwin
|
||||||
|
|
||||||
|
package wifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (mod *WiFiModule) injectPacket(data []byte) {
|
||||||
|
if err := mod.handle.WritePacketData(data); err != nil {
|
||||||
|
mod.Error("could not inject WiFi packet: %s", err)
|
||||||
|
mod.Session.Queue.TrackError()
|
||||||
|
} else {
|
||||||
|
mod.Session.Queue.TrackSent(uint64(len(data)))
|
||||||
|
}
|
||||||
|
// let the network card breath a little
|
||||||
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
}
|
5
modules/wifi/wifi_inject_darwin.go
Normal file
5
modules/wifi/wifi_inject_darwin.go
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package wifi
|
||||||
|
|
||||||
|
func (mod *WiFiModule) injectPacket(data []byte) {
|
||||||
|
mod.Error("wifi frame injection is not supported on macOS (see https://github.com/bettercap/bettercap/issues/448)")
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue