dbisu / pico-ducky

Create a USB Rubber Ducky like device using a Raspberry PI Pico
GNU General Public License v2.0
2.31k stars 421 forks source link

Problem with backslash #5

Closed jr551 closed 3 years ago

jr551 commented 3 years ago

Is this because I have a UK keyboard layout?

image

It just places a hash symbol

dbisu commented 3 years ago

It is probably because the computer is expecting a UK keyboard layout. If you have a Linux computer available for testing, could you run this command while plugging in the ducky? sudo showkeys

I haven't tracked down the UK keycodes yet, so not sure the mapping from US to UK.

peterfritz commented 3 years ago

Wouldn't it be possible to use a different approach like the one proposed by @elkentaro in Bash Bunny?

He made a script that changes the system's keyboard language to en-US before running the payload and returns to the default after (as seen here).

Sure, it would make the code execution slower, but all the payloads would be internationalized out of the box, making the project easier to configure, use, and, as a bonus, save some precious space on the Pico by not having to store in it a bunch of language files.

While writing this, I see some problems with this approach, like losing the focus on the currently open application before and after the payload execution and making it only compatible with Windows, probably messing things up in other operating systems. But anyway, it would be nice to have something like this even if disabled by default.

jr551 commented 3 years ago

I do not believe you would need to incooperate all the keyboard layouts, it would be appropriate to just inherit the US keyboard and overwrite just the symbol keys where appropriate, maybe the user can set the keyboard type at the start of the script/config file? Changing the user's keyboard layout with powershell seems a bit messy.

I can get it to do a backslash using the following (would only work on Windows as far as I'm aware but it would be keyboard independent): Maybe we can incoooperate this for now somehow?

def doBackSlashWin(): kbd.release_all() NUMPAD_9 = 0x61 NUMPAD_2 = 0x5A kbd.press(Keycode.ALT) time.sleep(float(defaultDelay)/1000) kbd.press(NUMPAD_9) time.sleep(float(defaultDelay)/1000) kbd.release(NUMPAD_9) time.sleep(float(defaultDelay)/1000) kbd.press(NUMPAD_2) time.sleep(float(defaultDelay)/1000) kbd.release_all()

peterfritz commented 3 years ago

The issue is that officially, the Adafruit CircuitPython HID module only supports en-US.

The setup process is already quite weird. At that point, maybe it would be easier to create some sort of compiler for ducky scripts. This was what Hak5 did on the original USB Rubber Ducky and is way more intuitive and easier to maintain than having that many steps just to set it up.

dbisu commented 3 years ago

I believe this is a keyboard layout issue. I'm going to close this issue, as keyboard layout updates are being tracked in Issue #10