| 1 | package events_stream |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "io" |
| 6 | |
| 7 | "github.com/bettercap/bettercap/network" |
| 8 | "github.com/bettercap/bettercap/session" |
| 9 | |
| 10 | "github.com/evilsocket/islazy/tui" |
| 11 | ) |
| 12 | |
| 13 | func (mod *EventsStream) viewHIDEvent(output io.Writer, e session.Event) { |
| 14 | dev := e.Data.(*network.HIDDevice) |
| 15 | if e.Tag == "hid.device.new" { |
| 16 | fmt.Fprintf(output, "[%s] [%s] new HID device %s detected on channel %s.\n", |
| 17 | e.Time.Format(mod.timeFormat), |
| 18 | tui.Green(e.Tag), |
| 19 | tui.Bold(dev.Address), |
| 20 | dev.Channels()) |
| 21 | } else if e.Tag == "hid.device.lost" { |
| 22 | fmt.Fprintf(output, "[%s] [%s] HID device %s lost.\n", |
| 23 | e.Time.Format(mod.timeFormat), |
| 24 | tui.Green(e.Tag), |
| 25 | tui.Red(dev.Address)) |
| 26 | } |
| 27 | } |