new: wifi.client.probe.ap.filter and wifi.client.probe.sta.filter actions to filter wifi client probes

This commit is contained in:
Simone Margaritelli 2019-09-28 17:43:07 +02:00
commit caba6e1952
2 changed files with 44 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"net"
"regexp"
"strconv"
"sync"
"time"
@ -51,6 +52,8 @@ type WiFiModule struct {
assocSkip []net.HardwareAddr
assocSilent bool
assocOpen bool
filterProbeSTA *regexp.Regexp
filterProbeAP *regexp.Regexp
apRunning bool
showManuf bool
apConfig packets.Dot11ApConfig
@ -138,6 +141,33 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
return err
}))
mod.AddHandler(session.NewModuleHandler("wifi.client.probe.sta.filter FILTER", "wifi.client.probe.sta.filter (.+)",
"Use this regular expression on the station address to filter client probes, 'clear' to reset the filter.",
func(args []string) (err error) {
filter := args[0]
if filter == "clear" {
mod.filterProbeSTA = nil
return
} else if mod.filterProbeSTA, err = regexp.Compile(filter); err != nil {
return
}
return
}))
mod.AddHandler(session.NewModuleHandler("wifi.client.probe.ap.filter FILTER", "wifi.client.probe.ap.filter (.+)",
"Use this regular expression on the access point name to filter client probes, 'clear' to reset the filter.",
func(args []string) (err error) {
filter := args[0]
if filter == "clear" {
mod.filterProbeAP = nil
return
} else if mod.filterProbeAP, err = regexp.Compile(filter); err != nil {
return
}
return
}))
minRSSI := session.NewIntParameter("wifi.rssi.min",
"-200",
"Minimum WiFi signal strength in dBm.")