mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
new: integrated net.sniff events into main events system ( with new.sniff.leak.* even type )
This commit is contained in:
parent
5bc00fb126
commit
e8c6c7cf92
6 changed files with 115 additions and 28 deletions
36
modules/net_sniff_event.go
Normal file
36
modules/net_sniff_event.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package modules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/session"
|
||||
)
|
||||
|
||||
type SniffData map[string]interface{}
|
||||
|
||||
type SnifferEvent struct {
|
||||
PacketTime time.Time
|
||||
Protocol string
|
||||
Source string
|
||||
Destination string
|
||||
Data SniffData
|
||||
Message string
|
||||
}
|
||||
|
||||
func NewSnifferEvent(t time.Time, proto string, src string, dst string, data SniffData, format string, args ...interface{}) SnifferEvent {
|
||||
return SnifferEvent{
|
||||
PacketTime: t,
|
||||
Protocol: proto,
|
||||
Source: src,
|
||||
Destination: dst,
|
||||
Data: data,
|
||||
Message: fmt.Sprintf(format, args...),
|
||||
}
|
||||
}
|
||||
|
||||
func (e SnifferEvent) Push() {
|
||||
fmt.Printf("%s\n", e.Message)
|
||||
session.I.Events.Add("net.sniff.leak."+e.Protocol, e.Data)
|
||||
session.I.Input.Refresh()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue