vmonaco / kloak

Keystroke-level online anonymization kernel: obfuscates typing behavior at the device level.
BSD 3-Clause "New" or "Revised" License
496 stars 35 forks source link

starting kloak resets keyboard layout #12

Open adrelanos opened 5 years ago

adrelanos commented 5 years ago

Starting kloak resets my keyboard layout type from de to en-US.

vmonaco commented 5 years ago

Confirmed on Whonix 14 and Ubuntu. Always switches back to en-US from other layouts.

I'll investigate. This possibly has something to do with grabbing the device file.

HulaHoop0 commented 4 years ago

The TailsOS folks are also interested and will ship Kloak when this bug is squashed :)

https://lists.autistici.org/message/20190502.153722.2bd2b373.en.html

OmarMesqq commented 1 year ago

Confirmed on Arch Linux as well. Apparently, it only affects the keyboard layout on Xorg (I didn't test it on Wayland though). When I run # systemctl start kloak on the tty the layout stays the same. I have managed to mitigate this by adding a script that runs setxkbmap <layout> to the code but I'm investigating to see if I can find the origin of the bug in the codebase.

adrelanos commented 1 year ago

I have managed to mitigate this by adding a script that runs setxkbmap <layout> to the code but I'm investigating to see if I can find the origin of the bug in the codebase.

Any chance?

OmarMesqq commented 11 months ago

I was thinking of ways of solving this bug. Quite interesting to say the least, maybe it has something to do on how X11 (Wayland isn't supported, right?) handles the "sudden" change of device control takeover that kloak does. Here's a snippet of some logs:

Arg 0 Current keyboard layout: pc+br+inet(evdev)
Arg 1 Current keyboard layout: pc+br+inet(evdev)
Raw event: Time: 1702271333353, Device: 1, Type: 4, Code: 4, Value: 458803
Arg 2 Current keyboard layout: pc+br+inet(evdev)
Arg 3 Current keyboard layout: pc+br+inet(evdev)
Arg 0 Current keyboard layout: pc+br+inet(evdev)
Arg 1 Current keyboard layout: pc+br+inet(evdev)
Raw event: Time: 1702271333354, Device: 1, Type: 1, Code: 39, Value: 1
Arg 2 Current keyboard layout: pc+br+inet(evdev)
Arg 3 Current keyboard layout: pc+br+inet(evdev)
Arg 0 Current keyboard layout: pc+br+inet(evdev)
Arg 1 Current keyboard layout: pc+br+inet(evdev)
Raw event: Time: 1702271333355, Device: 1, Type: 0, Code: 0, Value: 0
Arg 2 Current keyboard layout: pc+br+inet(evdev)
Arg 3 Current keyboard layout: pc+br+inet(evdev)
;Arg 0 Current keyboard layout: pc+us+inet(evdev)
Arg 1 Current keyboard layout: pc+us+inet(evdev)
Raw event: Time: 1702271333457, Device: 1, Type: 4, Code: 4, Value: 458803
Arg 2 Current keyboard layout: pc+us+inet(evdev)

One can see when the bug happens in the line:

;Arg 0 Current keyboard layout: pc+us+inet(evdev)

My keyboard layout is pt_BR and the key I pressed is for the character ç. However, in the exact moment I press it, the keyboard layout falls back to en_US and the key that should have been ç becomes ;

Edit 1: It definitely has to do with EVIOCGRAB - X11 falls back to default layout after the first keystroke

AguirreIF commented 10 months ago

Same issue with kloak 0.2.49 on GNU/Linux Debian Trixie.

OmarMesqq commented 10 months ago

hi everyone. i found a solution, when possible, please take a look at the pull request

siliconwaffle commented 4 months ago

The TailsOS folks are also interested and will ship Kloak when this bug is squashed :)

https://lists.autistici.org/message/20190502.153722.2bd2b373.en.html

Interested to see how open they are to including it now that Tails is on Wayland and #12 is only an X11 issue, not a Wayland issue.