diff options
author | Julian T <julian@jtle.dk> | 2022-10-09 11:50:12 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2022-10-09 11:50:12 +0200 |
commit | 0511041756fa6f3b53bef3d197d43e88e42697d8 (patch) | |
tree | 800eabcaba8361a349899416e92c358de47276c8 /intcp | |
parent | 080d4eb5e354f98363a4b1d8f6a692299c54c389 (diff) |
Add interception tool config
Diffstat (limited to 'intcp')
-rw-r--r-- | intcp/intcp/main.c | 27 | ||||
-rw-r--r-- | intcp/intcp/udevmon.yaml | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/intcp/intcp/main.c b/intcp/intcp/main.c new file mode 100644 index 0000000..383ef5b --- /dev/null +++ b/intcp/intcp/main.c @@ -0,0 +1,27 @@ +#include <stdio.h> +#include <stdlib.h> +#include <linux/input.h> + +int main(void) { + setbuf(stdin, NULL); setbuf(stdout, NULL); + + struct input_event event; + while (fread(&event, sizeof(event), 1, stdin)) { + if (event.type == EV_KEY) { + switch (event.code) { + case KEY_CAPSLOCK: + event.code = KEY_LEFTCTRL; + break; + case KEY_LEFTALT: + event.code = KEY_LEFTMETA; + break; + case KEY_102ND: + event.code = KEY_LEFTALT; + break; + } + } + + fwrite(&event, sizeof(event), 1, stdout); + } +} + diff --git a/intcp/intcp/udevmon.yaml b/intcp/intcp/udevmon.yaml new file mode 100644 index 0000000..3733456 --- /dev/null +++ b/intcp/intcp/udevmon.yaml @@ -0,0 +1,4 @@ +- JOB: "intercept -g $DEVNODE | /home/julian/intcp/intcp | uinput -d $DEVNODE" + DEVICE: + EVENTS: + EV_KEY: [ KEY_CAPSLOCK, KEY_LEFTALT, KEY_102ND ] |