Skip to content

Commit 2696127

Browse files
committed
Fixed key parsing to ensure the correct keys are found
1 parent 934b26c commit 2696127

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

duckyinpython.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
duckyCommands = ["WINDOWS", "GUI", "APP", "MENU", "SHIFT", "ALT", "CONTROL", "CTRL", "DOWNARROW", "DOWN",
1010
"LEFTARROW", "LEFT", "RIGHTARROW", "RIGHT", "UPARROW", "UP", "BREAK", "PAUSE", "CAPSLOCK", "DELETE", "END",
1111
"ESC", "ESCAPE", "HOME", "INSERT", "NUMLOCK", "PAGEUP", "PAGEDOWN", "PRINTSCREEN", "SCROLLLOCK", "SPACE",
12-
"TAB", "ENTER", " a", " b", " c", " d", " e", " f", " g", " h", " i", " j", " k", " l", " m", " n", " o", " p", " q", " r", " s", " t",
13-
" u", " v", " w", " x", " y", " z", " A", " B", " C", " D", " E", " F", " G", " H", " I", " J", " K", " L", " M", " N", " O", " P",
14-
" Q", " R", " S", " T", " U", " V", " W", " X", " Y", " Z", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12"]
12+
"TAB", "ENTER", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
13+
"u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
14+
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", " Z", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12"]
1515

1616
keycodeCommands = [Keycode.WINDOWS, Keycode.GUI, Keycode.APPLICATION, Keycode.APPLICATION, Keycode.SHIFT, Keycode.ALT, Keycode.CONTROL,
1717
Keycode.CONTROL, Keycode.DOWN_ARROW, Keycode.DOWN_ARROW ,Keycode.LEFT_ARROW, Keycode.LEFT_ARROW, Keycode.RIGHT_ARROW, Keycode.RIGHT_ARROW,
@@ -26,12 +26,16 @@
2626
Keycode.F10, Keycode.F11, Keycode.F12]
2727

2828
def convertLine(line):
29+
keys = line.split(" ")
2930
newline = []
30-
print(line)
31-
for j in range(len(keycodeCommands)):
32-
if line.find(duckyCommands[j]) != -1:
33-
newline.append(keycodeCommands[j])
34-
print(newline)
31+
# print("keys ", keys)
32+
33+
for k in keys:
34+
for j in range(len(keycodeCommands)):
35+
if k == (duckyCommands[j]):
36+
newline.append(keycodeCommands[j])
37+
38+
# print("keys commands",newline)
3539
return newline
3640

3741
def runScriptLine(line):

0 commit comments

Comments
 (0)