Implemented a way to not send deauthentication and/or association packets to AP's for which key material was already acquired

This commit is contained in:
Frank Spierings 2020-02-28 12:05:23 +01:00
commit a0a0963cd5
3 changed files with 34 additions and 0 deletions

View file

@ -51,6 +51,15 @@ func (mod *WiFiModule) doAssocOpen() bool {
return mod.assocOpen
}
func (mod *WiFiModule) doAssocAcquired() bool {
if err, is := mod.BoolParam("wifi.assoc.acquired"); err != nil {
mod.Warning("%v", err)
} else {
mod.assocAcquired = is
}
return mod.assocAcquired
}
func (mod *WiFiModule) startAssoc(to net.HardwareAddr) error {
// parse skip list
if err, assocSkip := mod.StringParam("wifi.assoc.skip"); err != nil {
@ -110,6 +119,8 @@ func (mod *WiFiModule) startAssoc(to net.HardwareAddr) error {
if ap.IsOpen() && !mod.doAssocOpen() {
mod.Debug("skipping association for open network %s (wifi.assoc.open is false)", ap.ESSID())
} else if ap.HasKeyMaterial() && !mod.doAssocAcquired() {
mod.Debug("skipping association for AP %s (key material already acquired)", ap.ESSID())
} else {
logger("sending association request to AP %s (channel:%d encryption:%s)", ap.ESSID(), ap.Channel, ap.Encryption)