flipperzero-firmware
flipperzero-firmware copied to clipboard
Dummy decoy/bad usb keyboard layout
What's new
- added a config menu to the badusb application which allows to select the keyboard layout used when emulating a hid and running a badusb script. the selected layout is persisted and reused on subsequent script execution until another layout is selected. some keyboard layouts are provided, layout files can be generated using the tool (here)[https://github.com/dummy-decoy/flipperzero_badusb_kl]
- reworked directory structure on the sd card to avoid mixing scripts and keyboard layout files. new structure and additional sd card files are in "assets/resources/badusb".
Verification
- copy the content of the "assets/resources/badusb/" folder into the "badusb/" folder of the sd card. if the sd card does not have the new directory hierarchy, the display may be confusing because the file selector will go straight to the root of the sd-card (but still everything will work)
- on your computer, select a keyboard input language other than english-us.
- plug the flipperzero to a computer with an usb cable
- launch the badusb application, select a simple script
- press run. the script executes, if your computer keyboard is not set to "en-US", you may see some strange character replacement ('q' instead of 'a', 'z' instead of 'y'...)
- on the flipper, still on the script execution page, press the left button to enter the "config" menu. select a keyboard layout matching the one on your computer. after selecting a layout, you are back to the config menu, you should press back once again to see the script execution view again.
- on the flipper, press "run". the script executes, you should see exactly what was intended, without character replacements.
- when you exit the badusb application, you should see a ".badusb.settings" file appear next to the script and layouts folders. this file persists the last used keyboard layout. application should work even if this file does not exist.
(effect is stronger when the computer is running a dvorak keyboard layout... standard scripts, without specifying a keyboard layout, fail miserably with dvorak configured computers)
Checklist (For Reviewer)
- [ ] PR has description of feature/bug or link to Confluence/Jira task
- [ ] Description contains actions to verify feature/bugfix
- [ ] I've built this code, uploaded it to the device and verified feature/bugfix
Works great ❤️
Hi. Amazing work. It will be merge after 0.64 release.
Also tested working well. Kudos!
Nicely done! While it would have been nice to store the keyboard layout files as Flipper Format (Human readable), I understand the complexity in mapping characters to key ID's. I guess the next big step would be support for UTF-16, should anyone have the (in)sanity to attempt that.
Works nicely. Would be cool to see the currently selected layout in the main screen too.
Will be merged this week and included in next release
Would be cool to see the currently selected layout in the main screen too.
@rcv4 done.
Do you have documentation for the users to generate their own keyboard files? @dummy-decoy
Do you have documentation for the users to generate their own keyboard files?
@RogueMaster i added the documentation for .kl file format inside the documentation folder right now.
Hi, is this PR still WIP ? under another PR ?
sorry folks, after resting here for a month without getting attention, i made a mistake 3 days ago and wiped all development for this pull request (thanks GitHub and your confusing web interface), just in time for this PR to be merged and closed...
Here's the commit from before you wiped it out: https://github.com/flipperdevices/flipperzero-firmware/archive/254484f1234719b36b85f522daa0937a1cb78faa.zip
sorry folks, after resting here for a month without getting attention, i made a mistake 3 days ago and wiped all development for this pull request (thanks GitHub and your confusing web interface), just in time for this PR to be merged and closed...
it can be saved i guess, your PR was Amazing i sincerly hope it makes it to the dev branch 👍
If you are still interested in contribution then we are freed enough space and ready for it.
I've restored the files and updated them to the latest dev, so this should be a good starting point if anyone wants to resume development. https://github.com/djsime1/flipperzero-firmware/tree/badusb-layout Note: There have been numerous changes that broke the code since it was last updated, which I have NOT fixed (at the time of writing) in the branch above.
I found a local copy of this branch from where i tested it on Aug 5. I fixed the breaking changes but i somehow messed up ~the icons in the layout selector and~ the embedded layouts But i added a label that shows the keyboard layout again. https://github.com/rcv4/flipperzero-firmware/tree/badusb_keyboardlayout
EDIT: fixed the icons
@rcv4 added you on discord. I can't make appear the menu to select a keyboard layout. Could you please help me ? Thanks
Do you confirm these layouts only work on PC keyboards and not MAC keyboards ?
Do you confirm these layouts only work on PC keyboards and not MAC keyboards ?
It should work but you have to modify the code of your badusb program, maybe take an example on the demo_macos, preinstalled on the flipper. Also I've found how to use different layouts like AZERTY but it is with unleashed fw of flipper not the original one as I cant make it works.
The language option is not shown in the bad usb application
@mikeair8 this feature will be released in 0.77 which is currently in RC state