mirror of
https://github.com/bettercap/bettercap
synced 2025-07-10 07:13:36 -07:00
Merge pull request #1150 from Sniffleupagus/patch-1
Improve backwards compatibility with getHandshakeFileFor
This commit is contained in:
commit
c4e45b368d
1 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/bettercap/bettercap/v2/network"
|
"github.com/bettercap/bettercap/v2/network"
|
||||||
|
@ -27,6 +28,11 @@ func (mod *WiFiModule) getHandshakeFileFor(ap *network.AccessPoint) string {
|
||||||
shakesFileName := mod.shakesFile
|
shakesFileName := mod.shakesFile
|
||||||
if !mod.shakesAggregate {
|
if !mod.shakesAggregate {
|
||||||
parentDir := path.Dir(shakesFileName)
|
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()))
|
shakesFileName = path.Join(parentDir, fmt.Sprintf("%s.pcap", ap.PathFriendlyName()))
|
||||||
}
|
}
|
||||||
return shakesFileName
|
return shakesFileName
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue