mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -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
|
||||
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 {
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
|
@ -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 == ""
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue