bettercap/modules/events_stream/events_view_hid.go
2024-08-09 18:19:21 +02:00

28 lines
680 B
Go

package events_stream
import (
"fmt"
"io"
"github.com/bettercap/bettercap/v2/network"
"github.com/bettercap/bettercap/v2/session"
"github.com/evilsocket/islazy/tui"
)
func (mod *EventsStream) viewHIDEvent(output io.Writer, e session.Event) {
dev := e.Data.(*network.HIDDevice)
if e.Tag == "hid.device.new" {
fmt.Fprintf(output, "[%s] [%s] new HID device %s detected on channel %s.\n",
e.Time.Format(mod.timeFormat),
tui.Green(e.Tag),
tui.Bold(dev.Address),
dev.Channels())
} else if e.Tag == "hid.device.lost" {
fmt.Fprintf(output, "[%s] [%s] HID device %s lost.\n",
e.Time.Format(mod.timeFormat),
tui.Green(e.Tag),
tui.Red(dev.Address))
}
}