From 8884cb4a18f32cb3ac464bcdb235659bd0d6f8e9 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Thu, 21 Feb 2019 15:23:49 +0100 Subject: [PATCH] added frame retransmission for hid.inject --- modules/hid/hid_inject.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/hid/hid_inject.go b/modules/hid/hid_inject.go index 1baa3f0c..9a51ec6f 100644 --- a/modules/hid/hid_inject.go +++ b/modules/hid/hid_inject.go @@ -110,8 +110,16 @@ func (mod *HIDRecon) doInjection() { for i, cmd := range cmds { for j, frame := range cmd.Frames { - if err := mod.dongle.TransmitPayload(frame.Data, 500, 3); err != nil { - mod.Warning("error sending frame #%d of HID command #%d: %v", j, i, err) + for attempt := 0; attempt < 3; attempt++ { + if err := mod.dongle.TransmitPayload(frame.Data, 500, 1); err != nil { + if attempt < 2 { + mod.Warning("error sending frame #%d of HID command #%d: %v, retrying ...", j, i, err) + } else { + mod.Error("error sending frame #%d of HID command #%d: %v", j, i, err) + } + } else { + break + } } if frame.Delay > 0 {