From 1d55083f754e7f71c4276f5501b87e2e24d6042e Mon Sep 17 00:00:00 2001 From: evilsocket Date: Wed, 6 Feb 2019 07:53:39 +0100 Subject: [PATCH] new: new wifi.deauth.open boolean parameter to optionally skip open networks while deauthing en masse --- modules/wifi.go | 5 +++++ modules/wifi_deauth.go | 24 +++++++++++++++++++----- network/wifi_station.go | 4 ++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/modules/wifi.go b/modules/wifi.go index 92eb95cf..65ae8f81 100644 --- a/modules/wifi.go +++ b/modules/wifi.go @@ -36,6 +36,7 @@ type WiFiModule struct { pktSourceChanClosed bool deauthSkip []net.HardwareAddr deauthSilent bool + deauthOpen bool shakesFile string apRunning bool apConfig packets.Dot11ApConfig @@ -115,6 +116,10 @@ func NewWiFiModule(s *session.Session) *WiFiModule { "false", "If true, messages from wifi.deauth will be suppressed.")) + w.AddParam(session.NewBoolParameter("wifi.deauth.open", + "true", + "Send wifi deauth packets to open networks.")) + w.AddHandler(session.NewModuleHandler("wifi.ap", "", "Inject fake management beacons in order to create a rogue access point.", func(args []string) error { diff --git a/modules/wifi_deauth.go b/modules/wifi_deauth.go index ebb1e017..6a045035 100644 --- a/modules/wifi_deauth.go +++ b/modules/wifi_deauth.go @@ -59,6 +59,15 @@ func (w *WiFiModule) isDeauthSilent() bool { return w.deauthSilent } +func (w *WiFiModule) doDeauthOpen() bool { + if err, is := w.BoolParam("wifi.deauth.open"); err != nil { + log.Warning("%v", err) + } else { + w.deauthOpen = is + } + return w.deauthOpen +} + func (w *WiFiModule) startDeauth(to net.HardwareAddr) error { // parse skip list if err, deauthSkip := w.StringParam("wifi.deauth.skip"); err != nil { @@ -121,12 +130,17 @@ func (w *WiFiModule) startDeauth(to net.HardwareAddr) error { client := deauth.Client ap := deauth.Ap if w.Running() { - if !w.isDeauthSilent() { - log.Info("deauthing client %s from AP %s (channel %d)", client.String(), ap.ESSID(), ap.Channel()) + if ap.IsOpen() && !w.doDeauthOpen() { + log.Debug("skipping deauth for open network %s", ap.ESSID()) + } else { + if !w.isDeauthSilent() { + log.Info("deauthing client %s from AP %s (channel %d)", client.String(), ap.ESSID(), ap.Channel()) + } + + w.onChannel(ap.Channel(), func() { + w.sendDeauthPacket(ap.HW, client.HW) + }) } - w.onChannel(ap.Channel(), func() { - w.sendDeauthPacket(ap.HW, client.HW) - }) } } }() diff --git a/network/wifi_station.go b/network/wifi_station.go index 4c3212b1..243ab715 100644 --- a/network/wifi_station.go +++ b/network/wifi_station.go @@ -55,3 +55,7 @@ func (s *Station) Channel() int { func (s *Station) HasWPS() bool { return len(s.WPS) > 0 } + +func (s *Station) IsOpen() bool { + return s.Encryption == "" +}