mirror of
https://github.com/bettercap/bettercap
synced 2025-07-31 12:10:10 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
7cc9e5b0b6
commit
055ba917a1
3 changed files with 7 additions and 3 deletions
|
@ -5,7 +5,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type FrameBuilder interface {
|
type FrameBuilder interface {
|
||||||
BuildFrames([]*Command)
|
BuildFrames([]*Command) error
|
||||||
}
|
}
|
||||||
|
|
||||||
var FrameBuilders = map[network.HIDType]FrameBuilder{
|
var FrameBuilders = map[network.HIDType]FrameBuilder{
|
||||||
|
|
|
@ -74,7 +74,9 @@ func (mod *HIDRecon) prepInjection() (error, *network.HIDDevice, []*Command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.BuildFrames(cmds)
|
if err := builder.BuildFrames(cmds); err != nil {
|
||||||
|
return err, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
return nil, dev, cmds
|
return nil, dev, cmds
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ func (b LogitechBuilder) frameFor(cmd *Command) []byte {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b LogitechBuilder) BuildFrames(commands []*Command) {
|
func (b LogitechBuilder) BuildFrames(commands []*Command) error {
|
||||||
numCommands := len(commands)
|
numCommands := len(commands)
|
||||||
for i, cmd := range commands {
|
for i, cmd := range commands {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
|
@ -51,4 +51,6 @@ func (b LogitechBuilder) BuildFrames(commands []*Command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue