mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
fix: fixed handshakes filename if wifi.aggregate is false
This commit is contained in:
parent
7d85483214
commit
81adcc96e6
1 changed files with 11 additions and 8 deletions
|
@ -23,6 +23,15 @@ func allZeros(s []byte) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (mod *WiFiModule) getHandshakeFileFor(ap *network.AccessPoint) string {
|
||||
shakesFileName := mod.shakesFile
|
||||
if !mod.shakesAggregate {
|
||||
parentDir := path.Dir(shakesFileName)
|
||||
shakesFileName = path.Join(parentDir, fmt.Sprintf("%s.pcap", ap.PathFriendlyName()))
|
||||
}
|
||||
return shakesFileName
|
||||
}
|
||||
|
||||
func (mod *WiFiModule) discoverHandshakes(radiotap *layers.RadioTap, dot11 *layers.Dot11, packet gopacket.Packet) {
|
||||
isEAPOL := false
|
||||
|
||||
|
@ -94,10 +103,7 @@ func (mod *WiFiModule) discoverHandshakes(radiotap *layers.RadioTap, dot11 *laye
|
|||
|
||||
// if we have unsaved packets as part of the handshake, save them.
|
||||
numUnsaved := station.Handshake.NumUnsaved()
|
||||
shakesFileName := mod.shakesFile
|
||||
if mod.shakesAggregate == false {
|
||||
shakesFileName = path.Join(shakesFileName, fmt.Sprintf("%s.pcap", ap.PathFriendlyName()))
|
||||
}
|
||||
shakesFileName := mod.getHandshakeFileFor(ap)
|
||||
doSave := numUnsaved > 0
|
||||
if doSave && shakesFileName != "" {
|
||||
mod.Debug("(aggregate %v) saving handshake frames to %s", mod.shakesAggregate, shakesFileName)
|
||||
|
@ -176,10 +182,7 @@ func (mod *WiFiModule) discoverHandshakes(radiotap *layers.RadioTap, dot11 *laye
|
|||
|
||||
target.Handshake.AddExtra(packet)
|
||||
|
||||
shakesFileName := mod.shakesFile
|
||||
if mod.shakesAggregate == false {
|
||||
shakesFileName = path.Join(shakesFileName, fmt.Sprintf("%s.pcap", targetAP.PathFriendlyName()))
|
||||
}
|
||||
shakesFileName := mod.getHandshakeFileFor(targetAP)
|
||||
if shakesFileName != "" {
|
||||
mod.Debug("(aggregate %v) saving handshake frames to %s", mod.shakesAggregate, shakesFileName)
|
||||
if err := mod.Session.WiFi.SaveHandshakesTo(shakesFileName, mod.handle.LinkType()); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue