From 56922c9be6bf212ad8b83bcb8ca3cfd964fdf979 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Sat, 2 Mar 2019 12:07:46 +0100 Subject: [PATCH] fix: fixed a bug which prevented some keys from being correctly parsed from the duckyscript parser (fixes #466) --- modules/hid/duckyparser.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/hid/duckyparser.go b/modules/hid/duckyparser.go index 34b4df58..25c95065 100644 --- a/modules/hid/duckyparser.go +++ b/modules/hid/duckyparser.go @@ -107,7 +107,7 @@ func (p DuckyParser) Parse(kmap KeyMap, path string) (cmds []*Command, err error } cmds = make([]*Command, 0) - for lineno, line := range source { + for _, line := range source { cmd := &Command{} if p.lineIs(line, "CTRL", "CONTROL") { if cmd, err = p.parseModifier(line, kmap, 1); err != nil { @@ -177,8 +177,8 @@ func (p DuckyParser) Parse(kmap KeyMap, path string) (cmds []*Command, err error } continue - } else { - err = fmt.Errorf("can't parse line %d ('%s') of %s", lineno+1, line, path) + } else if cmd, err = p.parseLiteral(line, kmap); err != nil { + err = fmt.Errorf("error parsing '%s': %s", line, err) return }