kernc / logkeys

:memo: :keyboard: A GNU/Linux keylogger that works!
Other
750 stars 251 forks source link

Most Keys Log Accurately - Some Keys Are Broken! :/ #162

Open ultrablast opened 7 years ago

ultrablast commented 7 years ago

Hi Folks. If I placed this request in the wrong area, my apologies. Please re-direct to the right area if necessary. I borrowed one of the earlier posts as a template to provide the data necessary to help repair keymappings that aren't working correctly on a newer model DELL Ultrabook laptop.

What steps will reproduce the problem?

  1. Start Logkeys (and kill logkeys as needed) No problems there!
  2. Type something I would expect to properly translate in the .log but the keymapping seems to be incorrect. (Best guess so far!)
  3. Scrambled output in the "github.log.txt" file output from logkeys.
  4. Ask the experts!

What is the expected output? >> Just typing something for github to help with! What do you see instead? >> Huat typibf aonetgif dor fitguv to gekp witg! github.log.txt

What version of the product are you using? >> 0.1.1b-svn On what operating system? >> Ubuntu 16.04

Please provide any additional information below. Attach contents of /proc/bus/input/devices >>DONE<< devices.txt

Include the output of command dumpkeys -n > dumpkeys.output >>DONE<< dumpkeys.output.txt

I have no problem reading the dumpkeys.output in gedit.

Let me know if I need to provide anything else to help troubleshoot this situation. Anything helps!

Warm Regards

ultrablast commented 7 years ago

Anybody out there? lol

Gremlyn commented 7 years ago

I am seeing the same thing, also on Ubuntu 16.04.

dumpkeys.output.txt devices.txt

kernc commented 7 years ago

I reckon logkeys was originally coded for a pc105 laid out keyboard and it may not support pc104 (or other) keyboards without some rewriting. If you're using en_US layout, have you tried -u switch?

Gremlyn commented 7 years ago

I had not tried it, but just did and no change.

PeterAndreus commented 7 years ago

I had same problem. Try use -m switch with en_US_ubuntu_1204.map stored in logkeys-master/keymaps

logkeys -s -o log.log -m logkeys-master/keymaps/en_US_ubuntu_1204.map

ultrablast commented 7 years ago

First off, I wanted to send a kind thank you to everyone who took time to help with this case.

@kernc - I did try with the -u switch, but it did not seem to matter. Keys logged were still incorrect.

@PeterAndreus - I was able to find and download the en_US_ubuntu_1204.map file and unfortunately it did not work. Here is the result I received (error) when I tried it:

logkeys -s -o log.log -m /home/bench/Desktop/en_US_ubuntu_1204.map

logkeys:/home/bench/Desktop/en_US_ubuntu_1204.map:1: No characters on line Segmentation fault (core dumped)

Ubuntu offered to send an error report, but I declined.

Any other tips? Seems like we may be getting warmer!

Thanks again & Cheers, -Ultrablast

PeterAndreus commented 7 years ago

@ultrablast i had mine en_US_ubuntu_1204.map right in downloaded version. which version do you have? mine: logkeys version: 0.1.1b-svn after download from git i run autogen.sh according to INSTALL file before compiling logkeys. Did you do same steps?

ricardoaiglesias commented 4 years ago

I added print statements to the part of the code that prints out the currently captured character, as well as its hex and decimal codes.

In this run I typed "qwertyuiop[]\ <ENTER> asdfghjkl;' <ENTER> zxcvbnm,./".

What I found is that in my case is that it's the key_event struct that is interpreted incorrectly, which means it's possible the issue is inside the update_key_state() function.

When I press "a" I get a strange hex code, which means that in the update_key_state function, in line 475 of logkeys.cc, either the scan code, or the translation of scan code to a printable character is wrong. I'm not familiar with keymaps or how to interpret this behavior, but it may be helpful to someone more familiar with these concepts. It seems like all the logged keys are either one or two "off" from the actual key I pressed (pressing "v" logs an "x", for example).

qwerty.log

As a small update, I tweaked the to_char_keys_index functions (possible-fix.c) and now I seem to get an accurate key logging on my keyboard. The most straightforward way I seemed to get this to work is by simply separating all the rows into their own array (I wasn't able to make this work while only modifying the original char_keys array) and changing the respective lines in logkeys.cc.

I'm not sure if changing these two functions has some unexpected side effects I didn't see while debugging, so feedback is appreciated.

@ultrablast, can you see if 1) We are talking about the same issue (by comparing your log file's output when you press certain keys to "qwerty.log") 2) Modifying your code with these functions fixes this?

possible-fix.cc

za3k commented 1 year ago

I have tested logkeys with two computers.

On a raspberry pi with an external US keyboard, most keys are off. How many depends on the row.

On a Thinkpad T460s with a US keyboard, most keys are one key off (I press F, I see G)

At the same time, typing on my console (outside of X) works fine. Is there a way logkeys could be auto-detecting keyboards better, if this is not a bug?