mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
new: graph module
This commit is contained in:
parent
6aa8f45d20
commit
db275429c2
7 changed files with 1078 additions and 0 deletions
35
modules/events_stream/events_view_graph.go
Normal file
35
modules/events_stream/events_view_graph.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package events_stream
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/bettercap/bettercap/session"
|
||||
"github.com/bettercap/bettercap/modules/graph"
|
||||
|
||||
"github.com/evilsocket/islazy/tui"
|
||||
)
|
||||
|
||||
func (mod *EventsStream) viewGraphEvent(output io.Writer, e session.Event) {
|
||||
if e.Tag == "graph.node.new" {
|
||||
node := e.Data.(*graph.Node)
|
||||
|
||||
fmt.Fprintf(output, "[%s] [%s] %s %s\n",
|
||||
e.Time.Format(mod.timeFormat),
|
||||
tui.Green(e.Tag),
|
||||
tui.Yellow(string(node.Type)),
|
||||
node.ID)
|
||||
} else if e.Tag == "graph.edge.new" {
|
||||
data := e.Data.(graph.EdgeEvent)
|
||||
fmt.Fprintf(output, "[%s] [%s] %s %s %s %s %s\n",
|
||||
e.Time.Format(mod.timeFormat),
|
||||
tui.Green(e.Tag),
|
||||
tui.Dim(string(data.Left.Type)),
|
||||
data.Left.ID,
|
||||
tui.Bold(string(data.Edge.Type)),
|
||||
tui.Dim(string(data.Right.Type)),
|
||||
data.Right.ID)
|
||||
}else {
|
||||
fmt.Fprintf(output, "[%s] [%s] %v\n", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), e)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue