mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 05:23:19 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
ae81bb8606
commit
ea477ef2b4
4 changed files with 38 additions and 45 deletions
|
@ -3,6 +3,7 @@ package modules
|
|||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/log"
|
||||
)
|
||||
|
@ -19,9 +20,7 @@ func (p *Prober) sendProbeUDP(from net.IP, from_hw net.HardwareAddr, ip net.IP)
|
|||
wrote, _ := con.Write([]byte{0x00})
|
||||
|
||||
if wrote > 0 {
|
||||
p.Session.Queue.Lock()
|
||||
p.Session.Queue.Sent += uint64(wrote)
|
||||
p.Session.Queue.Unlock()
|
||||
atomic.AddUint64(&p.Session.Queue.Stats.Sent, uint64(wrote))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,11 +144,11 @@ func (d *Discovery) Show(by string) error {
|
|||
|
||||
fmt.Printf("\n%s %s / %s %s / %d pkts / %d errs\n\n",
|
||||
core.Red("↑"),
|
||||
humanize.Bytes(atomic.LoadUint64(&d.Session.Queue.Sent)),
|
||||
humanize.Bytes(atomic.LoadUint64(&d.Session.Queue.Stats.Sent)),
|
||||
core.Green("↓"),
|
||||
humanize.Bytes(atomic.LoadUint64(&d.Session.Queue.Received)),
|
||||
atomic.LoadUint64(&d.Session.Queue.PktReceived),
|
||||
atomic.LoadUint64(&d.Session.Queue.Errors))
|
||||
humanize.Bytes(atomic.LoadUint64(&d.Session.Queue.Stats.Received)),
|
||||
atomic.LoadUint64(&d.Session.Queue.Stats.PktReceived),
|
||||
atomic.LoadUint64(&d.Session.Queue.Stats.Errors))
|
||||
|
||||
s := EventsStream{}
|
||||
events := d.Session.Events.Sorted()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue