mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
fix: fixed verbose gousb logging (fixes #969)
This commit is contained in:
parent
2659a559c9
commit
9d5c38c693
1 changed files with 14 additions and 0 deletions
|
@ -2,12 +2,14 @@ package hid
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
golog "log"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/bettercap/bettercap/v2/modules/utils"
|
||||
"github.com/bettercap/bettercap/v2/session"
|
||||
"github.com/evilsocket/islazy/str"
|
||||
|
||||
"github.com/bettercap/nrf24"
|
||||
)
|
||||
|
@ -164,6 +166,15 @@ func (mod HIDRecon) Author() string {
|
|||
return "Simone Margaritelli <evilsocket@gmail.com> (this module and the nrf24 client library), Bastille Research (the rfstorm firmware and original research), phikshun and infamy for JackIt."
|
||||
}
|
||||
|
||||
type dummyWriter struct {
|
||||
mod *HIDRecon
|
||||
}
|
||||
|
||||
func (w dummyWriter) Write(p []byte) (n int, err error) {
|
||||
w.mod.Debug("[hid.log] %s", str.Trim(string(p)))
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (mod *HIDRecon) Configure() error {
|
||||
var err error
|
||||
var n int
|
||||
|
@ -198,6 +209,9 @@ func (mod *HIDRecon) Configure() error {
|
|||
mod.sniffPeriod = time.Duration(n) * time.Millisecond
|
||||
}
|
||||
|
||||
golog.SetFlags(0)
|
||||
golog.SetOutput(dummyWriter{mod})
|
||||
|
||||
if mod.dongle, err = nrf24.Open(); err != nil {
|
||||
return fmt.Errorf("make sure that a nRF24LU1+ based USB dongle is connected and running the rfstorm firmware: %s", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue