mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -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"
|
||||
"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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue