mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 14:03:17 -07:00
fix: fixed packets queue stats
This commit is contained in:
parent
d030ccb5ed
commit
656b633023
3 changed files with 19 additions and 11 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/chzyer/readline"
|
||||
|
||||
|
@ -231,9 +232,15 @@ func (s *Session) Start() error {
|
|||
// keep reading network events in order to add / update endpoints
|
||||
go func() {
|
||||
for event := range s.Queue.Activities {
|
||||
addr := event.IP.String()
|
||||
mac := event.MAC.String()
|
||||
s.Targets.AddIfNotExist(addr, mac)
|
||||
if event.Source == true {
|
||||
addr := event.IP.String()
|
||||
mac := event.MAC.String()
|
||||
|
||||
existing := s.Targets.AddIfNotExist(addr, mac)
|
||||
if existing != nil {
|
||||
existing.LastSeen = time.Now()
|
||||
}
|
||||
}
|
||||
|
||||
if s.Active == false {
|
||||
return
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/core"
|
||||
"github.com/evilsocket/bettercap-ng/net"
|
||||
|
@ -64,7 +63,6 @@ func (tp *Targets) AddIfNotExist(ip, mac string) *net.Endpoint {
|
|||
}
|
||||
|
||||
if t, found := tp.Targets[mac]; found {
|
||||
t.LastSeen = time.Now()
|
||||
return t
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue