mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
fix: save unsaved packets only if handshake is complete
This commit is contained in:
parent
605361daa2
commit
e9b93b8586
1 changed files with 10 additions and 5 deletions
|
@ -220,11 +220,16 @@ func (w *WiFi) SaveHandshakesTo(fileName string, linkType layers.LinkType) error
|
||||||
|
|
||||||
for _, ap := range w.aps {
|
for _, ap := range w.aps {
|
||||||
for _, station := range ap.Clients() {
|
for _, station := range ap.Clients() {
|
||||||
station.Handshake.EachUnsavedPacket(func(pkt gopacket.Packet) {
|
if station.Handshake.Complete() {
|
||||||
err = writer.WritePacket(pkt.Metadata().CaptureInfo, pkt.Data())
|
err = nil
|
||||||
})
|
station.Handshake.EachUnsavedPacket(func(pkt gopacket.Packet) {
|
||||||
if err != nil {
|
if err == nil {
|
||||||
return err
|
err = writer.WritePacket(pkt.Metadata().CaptureInfo, pkt.Data())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue