mirror of
https://github.com/bettercap/bettercap.git
synced 2024-11-08 06:30:13 -08:00
28 lines
680 B
Go
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))
|
|
}
|
|
}
|