new: gateway.change event for MITM monitoring

This commit is contained in:
Simone Margaritelli 2021-04-10 22:59:03 +02:00
parent 43a93fd866
commit c47e3f6195
8 changed files with 144 additions and 5 deletions

View file

@ -129,6 +129,8 @@ func (mod *EventsStream) Render(output io.Writer, e session.Event) {
mod.viewUpdateEvent(output, e)
} else if strings.HasPrefix(e.Tag, "graph.") {
mod.viewGraphEvent(output, e)
} else if e.Tag == "gateway.change" {
mod.viewGatewayEvent(output, e)
} else if e.Tag != "tick" {
fmt.Fprintf(output, "[%s] [%s] %v\n", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), e)
}

View file

@ -0,0 +1,23 @@
package events_stream
import (
"fmt"
"io"
"github.com/bettercap/bettercap/session"
"github.com/evilsocket/islazy/tui"
)
func (mod *EventsStream) viewGatewayEvent(output io.Writer, e session.Event) {
change := e.Data.(session.GatewayChange)
fmt.Fprintf(output, "[%s] [%s] %s gateway changed: '%s' (%s) -> '%s' (%s)\n",
e.Time.Format(mod.timeFormat),
tui.Red(e.Tag),
string(change.Type),
change.Prev.IP,
change.Prev.MAC,
change.New.IP,
change.New.MAC)
}