Skip to content

Commit ab75398

Browse files
authored
add internal variables (#321)
* add internal variables * remove extra spacing
1 parent 522e640 commit ab75398

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

duckyinpython.py

+12
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030
#from keyboard_layout_win_LANG import KeyboardLayout as KeyboardLayout
3131
#from keycode_win_LANG import Keycode
3232

33+
def _capsOn():
34+
return kbd.led_on(Keyboard.LED_CAPS_LOCK)
35+
36+
def _numOn():
37+
return kbd.led_on(Keyboard.LED_NUM_LOCK)
38+
39+
def _scrollOn():
40+
return kbd.led_on(Keyboard.LED_SCROLL_LOCK)
41+
3342
duckyKeys = {
3443
'WINDOWS': Keycode.GUI, 'RWINDOWS': Keycode.RIGHT_GUI, 'GUI': Keycode.GUI, 'RGUI': Keycode.RIGHT_GUI, 'COMMAND': Keycode.GUI, 'RCOMMAND': Keycode.RIGHT_GUI,
3544
'APP': Keycode.APPLICATION, 'MENU': Keycode.APPLICATION, 'SHIFT': Keycode.SHIFT, 'RSHIFT': Keycode.RIGHT_SHIFT,
@@ -63,6 +72,7 @@
6372
}
6473

6574
variables = {"$_RANDOM_MIN": 0, "$_RANDOM_MAX": 65535}
75+
internalVariables = {"$_CAPSLOCK_ON": _capsOn, "$_NUMLOCK_ON": _numOn, "$_SCROLLLOCK_ON": _scrollOn}
6676
defines = {}
6777
functions = {}
6878

@@ -219,6 +229,8 @@ def sendString(line):
219229
def replaceVariables(line):
220230
for var in variables:
221231
line = line.replace(var, str(variables[var]))
232+
for var in internalVariables:
233+
line = line.replace(var, str(internalVariables[var]()))
222234
return line
223235

224236
def replaceDefines(line):

0 commit comments

Comments
 (0)