usbrubberducky-payloads/payloads/examples/Lock Keys/Lock-Keys-example2.txt

1 line
939 B
Plaintext

REM Example SAVE and RESTORE of of the Keyboard Lock State
ATTACKMODE HID STORAGE
DELAY 2000
SAVE_HOST_KEYBOARD_LOCK_STATE
$_RANDOM_MIN = 1
$_RANDOM_MAX = 3
VAR $TIMER = 120
WHILE ($TIMER > 0)
VAR $A = $_RANDOM_INT
IF ($A == 1) THEN
CAPSLOCK
ELSE IF ($A == 2) THEN
NUMLOCK
ELSE IF ($A == 3) THEN
SCROLLLOCK
END_IF
DELAY 50
$TIMER = ($TIMER - 1)
END_WHILE
RESTORE_HOST_KEYBOARD_LOCK_STATE
REM At the beginning of the payload, the currently reported keyboard lock state are saved.
REM For about 6 seconds, as a while loop iterates 120 times with a 50 ms delay, the caps, num or scroll lock keys will be randomly pressed.
REM When the "keyboard fireworks" display has concluded, the previously saved keyboard lock state will be restored.
REM Meaning, if the target has caps lock off, scroll lock off, and num lock on before the payload began, so too would it after its conclusion.