mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
new: new wifi.deauth.open boolean parameter to optionally skip open networks while deauthing en masse
This commit is contained in:
parent
1f925334ec
commit
1d55083f75
3 changed files with 28 additions and 5 deletions
|
@ -36,6 +36,7 @@ type WiFiModule struct {
|
||||||
pktSourceChanClosed bool
|
pktSourceChanClosed bool
|
||||||
deauthSkip []net.HardwareAddr
|
deauthSkip []net.HardwareAddr
|
||||||
deauthSilent bool
|
deauthSilent bool
|
||||||
|
deauthOpen bool
|
||||||
shakesFile string
|
shakesFile string
|
||||||
apRunning bool
|
apRunning bool
|
||||||
apConfig packets.Dot11ApConfig
|
apConfig packets.Dot11ApConfig
|
||||||
|
@ -115,6 +116,10 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
|
||||||
"false",
|
"false",
|
||||||
"If true, messages from wifi.deauth will be suppressed."))
|
"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", "",
|
w.AddHandler(session.NewModuleHandler("wifi.ap", "",
|
||||||
"Inject fake management beacons in order to create a rogue access point.",
|
"Inject fake management beacons in order to create a rogue access point.",
|
||||||
func(args []string) error {
|
func(args []string) error {
|
||||||
|
|
|
@ -59,6 +59,15 @@ func (w *WiFiModule) isDeauthSilent() bool {
|
||||||
return w.deauthSilent
|
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 {
|
func (w *WiFiModule) startDeauth(to net.HardwareAddr) error {
|
||||||
// parse skip list
|
// parse skip list
|
||||||
if err, deauthSkip := w.StringParam("wifi.deauth.skip"); err != nil {
|
if err, deauthSkip := w.StringParam("wifi.deauth.skip"); err != nil {
|
||||||
|
@ -121,14 +130,19 @@ func (w *WiFiModule) startDeauth(to net.HardwareAddr) error {
|
||||||
client := deauth.Client
|
client := deauth.Client
|
||||||
ap := deauth.Ap
|
ap := deauth.Ap
|
||||||
if w.Running() {
|
if w.Running() {
|
||||||
|
if ap.IsOpen() && !w.doDeauthOpen() {
|
||||||
|
log.Debug("skipping deauth for open network %s", ap.ESSID())
|
||||||
|
} else {
|
||||||
if !w.isDeauthSilent() {
|
if !w.isDeauthSilent() {
|
||||||
log.Info("deauthing client %s from AP %s (channel %d)", client.String(), ap.ESSID(), ap.Channel())
|
log.Info("deauthing client %s from AP %s (channel %d)", client.String(), ap.ESSID(), ap.Channel())
|
||||||
}
|
}
|
||||||
|
|
||||||
w.onChannel(ap.Channel(), func() {
|
w.onChannel(ap.Channel(), func() {
|
||||||
w.sendDeauthPacket(ap.HW, client.HW)
|
w.sendDeauthPacket(ap.HW, client.HW)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -55,3 +55,7 @@ func (s *Station) Channel() int {
|
||||||
func (s *Station) HasWPS() bool {
|
func (s *Station) HasWPS() bool {
|
||||||
return len(s.WPS) > 0
|
return len(s.WPS) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Station) IsOpen() bool {
|
||||||
|
return s.Encryption == ""
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue