diff --git a/network/wifi.go b/network/wifi.go index 797e9009..21e3b634 100644 --- a/network/wifi.go +++ b/network/wifi.go @@ -218,9 +218,6 @@ func (w *WiFi) NumHandshakes() int { } func (w *WiFi) SaveHandshakesTo(fileName string, linkType layers.LinkType) error { - w.RLock() - defer w.RUnlock() - // check if folder exists first dirName := filepath.Dir(fileName) if _, err := os.Stat(dirName); err != nil { @@ -244,6 +241,9 @@ func (w *WiFi) SaveHandshakesTo(fileName string, linkType layers.LinkType) error } } + w.RLock() + defer w.RUnlock() + for _, ap := range w.aps { for _, station := range ap.Clients() { // if half (which includes also complete) or has pmkid