diff --git a/modules/wifi/wifi_recon_handshakes.go b/modules/wifi/wifi_recon_handshakes.go index ac5b52dd..5b949231 100644 --- a/modules/wifi/wifi_recon_handshakes.go +++ b/modules/wifi/wifi_recon_handshakes.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "net" + "os" "path" "github.com/bettercap/bettercap/v2/network" @@ -27,6 +28,11 @@ func (mod *WiFiModule) getHandshakeFileFor(ap *network.AccessPoint) string { shakesFileName := mod.shakesFile if !mod.shakesAggregate { parentDir := path.Dir(shakesFileName) + // check for existing directory at "shakesFileName" for backwards compatibility + fileInfo, err := os.Stat(shakesFileName) + if (err == nil) && (fileInfo.IsDir()) { + parentDir = shakesFileName + } shakesFileName = path.Join(parentDir, fmt.Sprintf("%s.pcap", ap.PathFriendlyName())) } return shakesFileName