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

Keylogger tools #37

Merged
merged 26 commits into from
Mar 23, 2024
Merged

Keylogger tools #37

merged 26 commits into from
Mar 23, 2024

Conversation

xjjak
Copy link
Owner

@xjjak xjjak commented Feb 15, 2024

Contains a keylogging script and some additional tools.

The conversion script to convert the timestamped keylogging data to the same format delivered by the virtual keyboard. This could utilize a selector to only consider the left or right hand and then provide uniform output, mirrored for the right hand.

Will finish and close #30.

Using `pio device monitor | grep -E -o  --line-buffered "(^[0-9]+:)" | ../../../Software/tools/keylogging/logging.sh | tee -a comparing-timing.log` in the `Hardware/Firmware/mainboard` directory this script helps with collecting the microseocond timestamps of the motherboard alongside the output of `date +%s%N`.
Set of value pairs the timestamp on the host computer being collected as each line comes in on the serial monitor.

There is also a simple evaluation script that prints the mean and then standard deviation of the microseconds, which is less than 1ms.
Collect the filtered output from the QMK driven keyboard using `./hid_listen | grep -E --line-buffered "(0x[A-F0-9]+,)?[0-9]+,[0-9]+,[0-9]{1,2}"` and adds the timestamp given by `date +s%N`.

This script required the program hid_listen to be executable in the same folder and then continuously appends to keylog.csv
@xjjak xjjak added the software label Feb 15, 2024
@xjjak xjjak self-assigned this Feb 15, 2024
xjjak and others added 5 commits March 1, 2024 10:33
The aim is to translate the keylogger's output into the same format of
the virutal keyboard.
This is a first framework with the translation and output function
missing.
This is simple implementation with the proposed interface from
#39.

The implementation is quite simple and the window is fragile as it
only draws every time when it receives an input.  But it should
suffice for our purposes.
@xjjak
Copy link
Owner Author

xjjak commented Mar 15, 2024

We have to add proper documentation on how to set this and the usage. The readme should also include the results of the comparison between PC and μC timestamps.

xjjak and others added 15 commits March 18, 2024 14:10
Indented optional steps in QMK firmware mods
The former method of representing a key position was a string with the
character representation of the column and row position.  This is
neither extensible nor is it a very clean way to represent the
position.  Thus, we changed the representation to a 2-tuple (column,
row).

Additionally, we changed the column and row values to match those that
qmk uses internally.
Make the processes more elaborate and up to date (i think).
- fixed functions to act on single record instead of a list
- print timestamp
Python evaluates `bool("0")` und `bool("1")` zu `True`.  Gewünscht ist
jedoch `bool("0") == False`, dies erhalten wir mit `bool(int("0"))`.
Calling the `keylogger-for-data-collection.sh` script from another
directory will result in an error because the local hid_listen script
will not be in that directory.  Referring to the hid_listen script
from the keylogger script location (dirname "$0") solves this issue.

Further checking for a global hid_listen script makes things easier
with a nix-shell environment.
Datasets won't be part of the public repository anymore.
@palisn palisn self-assigned this Mar 23, 2024
@palisn palisn marked this pull request as ready for review March 23, 2024 13:15
@palisn
Copy link
Collaborator

palisn commented Mar 23, 2024

Keylogger conversion tools are ready functionality wise. Further changes should be included in the upcoming refactoring.

@xjjak xjjak merged commit c1f02d1 into main Mar 23, 2024
@xjjak xjjak deleted the keylogger-tools branch March 23, 2024 13:34
xjjak added a commit that referenced this pull request Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PLAN] Key logger for data collection
2 participants