Jump to content

Injecting letters with accents through QUACK (fr / AZERTY keyboard)

Go to solution Solved by dark_pyrro,

Recommended Posts

Hello! I'm having trouble setting up a Key Croc (firmware version 1.3_513) to use a french keyboard layout with accented letters.

I have configured the Croc's locale to fr_FR.utf8, and can now input accented letters from my computer to the croc's terminal through SSH.

I notice in the QUACK script that it loads the lang file available in the udisk/languages directory to generate keyboard inputs to the target. I could force it to load fr.json by modifying the line 263:

    language = os.getenv("DUCKY_LANG", default="fr").lower()

Since DUCKY_LANG isn't present in the env (one of the solutions refered in the topic below).

However, the accented letters we use the most "éèçàöâê" (this list is not exhaustive) aren't defined in the fr.json file, and the QUACK script throws an exception if I try to quack any of these. This is quite an issue for me, as the french language use these pretty much everywhere.

The comments at the begining of the lang files refer to the USB HID Usage Tables Version 1.12 and Device Class Definition for HID Version 1.11. I went and and took a look to try and find a keycode table that would allow me to add the accented letters we use in french. Unfortunately, I couldn't find such table that ressembles the patterns of the [lang].json files.

Could anyone help me with this please?

Kind regards,



Link to comment
Share on other sites

  • Solution

Just look at a physical keyboard (US for example) and compare to the AZERTY keyboard. Then use something like the following workflow: "OK, so é on the french keyboard is on the same position as 2 on the US keyboard and 2 on the US keyboard uses 00,00,1f according to the us.json language file, so lets re-map 00,00,1f to é" (and so on...) So, you already have all that you need, you only have to map the french keys to the correct keycodes and one of the ways of doing that is compare keyboard layouts in the way I described. There are other ways, but I find that to be the easiest/fastest way, at least if just adjusting already existing keymaps for a few keys.

  • Thanks 1
Link to comment
Share on other sites

Thank you very much for this answer! With your insight I could have most of the accented letters working. I had to remove the existing definition of the '^' char in order to replace it with something that allows QUACK STRING "^e" to output "ê".

I'm still having difficulties with 'É' and 'È'. I wanted to use alt codes for these (as seen in this video from Hak5 : https://www.youtube.com/watch?v=q9j5c6nnZiw ).

Unfortunately, I get the following error:

root@croc:~# QUACK ALTCODE 212
Traceback (most recent call last):
  File "/usr/local/croc/bin/QUACK", line 281, in <module>
    run_script(input_line, language)
  File "/usr/local/croc/bin/QUACK", line 250, in run_script
    context = run_ducky_line(context, line, lang_file)
  File "/usr/local/croc/bin/QUACK", line 151, in run_ducky_line
  File "/usr/local/croc/bin/QUACK", line 78, in write_altcode
    with open("/tmp/hid_out", mode='r') as f:
IOError: [Errno 2] No such file or directory: '/tmp/hid_out'

The alt code 212 is supposed to output 'È'.

From what I understand, the QUACK script uses the /tmp/hid_out file to know if the bumeric pad is activated. I tried creating the file, but to no avail. There is something I'm missing somewhere. Is the attackmode HID sufficient for the use of ALTCODE ? Or do I need to activate another that would create and prepare this file ?

Best regards,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...