mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
447aaede5b
commit
86456e76a9
2 changed files with 7 additions and 9 deletions
|
@ -27,12 +27,11 @@ import (
|
||||||
type WDiscovery struct {
|
type WDiscovery struct {
|
||||||
session.SessionModule
|
session.SessionModule
|
||||||
|
|
||||||
wifi *WiFi
|
wifi *WiFi
|
||||||
stats *WiFiStats
|
stats *WiFiStats
|
||||||
handle *pcap.Handle
|
handle *pcap.Handle
|
||||||
BroadcastMac []byte
|
cliTarget net.HardwareAddr
|
||||||
cliTarget net.HardwareAddr
|
apTarget net.HardwareAddr
|
||||||
apTarget net.HardwareAddr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWDiscovery(s *session.Session) *WDiscovery {
|
func NewWDiscovery(s *session.Session) *WDiscovery {
|
||||||
|
@ -283,7 +282,7 @@ func (w *WDiscovery) discoverAccessPoints(packet gopacket.Packet) {
|
||||||
dst := dot11.Address1
|
dst := dot11.Address1
|
||||||
|
|
||||||
// packet sent to broadcast mac with a SSID set?
|
// packet sent to broadcast mac with a SSID set?
|
||||||
if bytes.Compare(dst, w.BroadcastMac) == 0 && len(ssid) > 0 {
|
if bytes.Compare(dst, network.BroadcastMac) == 0 && len(ssid) > 0 {
|
||||||
radiotap, _ := radiotapLayer.(*layers.RadioTap)
|
radiotap, _ := radiotapLayer.(*layers.RadioTap)
|
||||||
channel := mhz2chan(int(radiotap.ChannelFrequency))
|
channel := mhz2chan(int(radiotap.ChannelFrequency))
|
||||||
w.wifi.AddIfNew(ssid, bssid, true, channel)
|
w.wifi.AddIfNew(ssid, bssid, true, channel)
|
||||||
|
@ -341,7 +340,6 @@ func (w *WDiscovery) Configure() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
w.wifi = NewWiFi(w.Session, w.Session.Interface)
|
w.wifi = NewWiFi(w.Session, w.Session.Interface)
|
||||||
w.BroadcastMac, _ = net.ParseMAC(network.BroadcastMac)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,12 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MonitorModeAddress = "0.0.0.0"
|
MonitorModeAddress = "0.0.0.0"
|
||||||
BroadcastMac = "ff:ff:ff:ff:ff:ff"
|
|
||||||
IPv4MulticastStart = "01:00:5e:00:00:00"
|
IPv4MulticastStart = "01:00:5e:00:00:00"
|
||||||
IPv4MulticastEnd = "01:00:5e:7f:ff:ff"
|
IPv4MulticastEnd = "01:00:5e:7f:ff:ff"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
BroadcastMac = []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
|
||||||
IPv4Validator = regexp.MustCompile("^[0-9\\.]+/?\\d*$")
|
IPv4Validator = regexp.MustCompile("^[0-9\\.]+/?\\d*$")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue