Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy decoy/bad usb keyboard layout #1525

Conversation

dummy-decoy
Copy link

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

@v1nc
Copy link

v1nc commented Aug 3, 2022

Works great ❤️

@skotopes
Copy link
Member

skotopes commented Aug 3, 2022

Hi. Amazing work.
It will be merge after 0.64 release.

@UberGuidoZ
Copy link
Contributor

Also tested working well. Kudos!

@djsime1
Copy link
Contributor

djsime1 commented Aug 4, 2022

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.

@rcv4
Copy link

rcv4 commented Aug 5, 2022

Works nicely. Would be cool to see the currently selected layout in the main screen too.

@skotopes
Copy link
Member

skotopes commented Aug 7, 2022

Will be merged this week and included in next release

@dummy-decoy
Copy link
Author

Would be cool to see the currently selected layout in the main screen too.

@rcv4 done.

@hedger hedger added USB BadUSB + physical USB interface UI Affects UI New Feature Contains an IMPLEMENTATION of a new feature labels Aug 9, 2022
@RogueMaster

This comment was marked as abuse.

@dummy-decoy
Copy link
Author

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.

@shelld0n
Copy link

Hi, is this PR still WIP ? under another PR ?

@dummy-decoy
Copy link
Author

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...

@djsime1
Copy link
Contributor

djsime1 commented Sep 17, 2022

Here's the commit from before you wiped it out:
https://github.com/flipperdevices/flipperzero-firmware/archive/254484f1234719b36b85f522daa0937a1cb78faa.zip

@shelld0n
Copy link

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 👍

@skotopes
Copy link
Member

skotopes commented Oct 8, 2022

If you are still interested in contribution then we are freed enough space and ready for it.

@djsime1
Copy link
Contributor

djsime1 commented Oct 9, 2022

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.

@rcv4
Copy link

rcv4 commented Oct 11, 2022

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 rcv4 mentioned this pull request Oct 11, 2022
3 tasks
@OsIrIs29000
Copy link

@rcv4 added you on discord. I can't make appear the menu to select a keyboard layout. Could you please help me ? Thanks

@VxTedxV
Copy link

VxTedxV commented Dec 20, 2022

Do you confirm these layouts only work on PC keyboards and not MAC keyboards ?

@OsIrIs29000
Copy link

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.

@xMasterX xMasterX mentioned this pull request Jan 6, 2023
3 tasks
@mikeair8
Copy link

mikeair8 commented Feb 9, 2023

The language option is not shown in the bad usb application

@skotopes
Copy link
Member

skotopes commented Feb 9, 2023

@mikeair8 this feature will be released in 0.77 which is currently in RC state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Feature Contains an IMPLEMENTATION of a new feature UI Affects UI USB BadUSB + physical USB interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.