mirror of
https://github.com/bettercap/bettercap
synced 2025-08-13 18:26:57 -07:00
fix: counting udp probe packets in sent stats
This commit is contained in:
parent
79130e2669
commit
97c97a668a
2 changed files with 11 additions and 1 deletions
|
@ -75,7 +75,13 @@ func (p *Prober) sendProbe(from net.IP, from_hw net.HardwareAddr, ip net.IP) {
|
|||
} else {
|
||||
// log.Debug("UDP connection to %s enstablished.", name)
|
||||
defer con.Close()
|
||||
con.Write([]byte{0xde, 0xad, 0xbe, 0xef})
|
||||
wrote, _ := con.Write([]byte{0xde, 0xad, 0xbe, 0xef})
|
||||
|
||||
if wrote > 0 {
|
||||
p.Session.Queue.Lock()
|
||||
p.Session.Queue.Sent += uint64(wrote)
|
||||
p.Session.Queue.Unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,8 @@ func (q *Queue) worker() {
|
|||
if q.active == false {
|
||||
return
|
||||
}
|
||||
|
||||
q.Lock()
|
||||
pktSize := uint64(len(pkt.Data()))
|
||||
|
||||
q.PktReceived++
|
||||
|
@ -131,6 +133,8 @@ func (q *Queue) worker() {
|
|||
q.Traffic[addr].Received += pktSize
|
||||
}
|
||||
}
|
||||
|
||||
q.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue