misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2019-02-20 15:06:42 +01:00
parent 7cc9e5b0b6
commit 055ba917a1
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
3 changed files with 7 additions and 3 deletions

View file

@ -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{

View file

@ -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
} }

View file

@ -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
} }