readKeyState function for badusb mjs module
Describe the enhancement you're suggesting.
The firmware of most external keyboards allows the keyboard to receive signals from the device to which it is connected, in order to update the status LEDs for the caps-lock, num-lock, and scroll-lock keys. This could be a useful method of data exfiltration in airgapped systems: if the flipper zero could read the state of a virtual keyboard, a badusb payload could install and execute a script on the target machine that uses these keys to send data directly to the flipper itself.
The feature could take the form of a readKeyState() method in the JavaScript badusb module, or even a separate method for each key.
Anything else?
No response
Coming back to this to mention that the flipper firmware has a function defined that returns the state of capslock, scrolllock, and numlock LEDs (defined on line 204 of this file). However there doesn't seem to be a way to take advantage of this using mjs. I'm not sure how the scripting interface interacts with firmware functionality, but having a way to read the state of the status LEDs of a keyboard would be a nice feature to have.