6
\$\begingroup\$

Okay, I propose a shortest-key-logger challenge. As explained by the gentleman at "Are key-logger questions allowed?", strict rules have to be imposed in order to make this challenge valid for PPCG.

  1. The key-logger has to run on Windows, Linux or Mac OSX (any programming language is welcome).
  2. Upon execution, it has to show the message: "I'm gonna log you" (either in a console or using GUI).
  3. The keys that are relevant for logging in this challenge are letters (case is not important) and numbers, all others such as symbols, control keys and whitespace are optional and can be ignored.
  4. All relevant key presses that occur during runtime (even when the application is not in focus) have to be saved in a log file that can be read and verified using any text editor (even an esoteric one, as long as I can verify it using that text editor).

Anyone up for it? Whatdayatink?

\$\endgroup\$
7
  • 1
    \$\begingroup\$ "4. [...] saved in a log file" in what format? \$\endgroup\$
    – Leaky Nun
    Commented Apr 3, 2016 at 16:23
  • \$\begingroup\$ Updated my question to specify intended format. \$\endgroup\$ Commented Apr 3, 2016 at 16:25
  • \$\begingroup\$ I can easily log what is typed in my program's REPL, is that sufficient or should it work work when I type anything in my browser or any other application too? \$\endgroup\$
    – coredump
    Commented Apr 3, 2016 at 16:30
  • 1
    \$\begingroup\$ Can we write a program that runs on mac (AppleScript), if we provide an example gif of it running? \$\endgroup\$
    – Downgoat
    Commented Apr 3, 2016 at 19:02
  • 2
    \$\begingroup\$ I’m voting to close this question because it asks for code which can be trivially modified to be malicious. The linked meta question's (only) answer states that asking for programs that are covertly keyloggers is disallowed, and aside from printing an easily-modifiable message, that's what this is asking for ("All relevant key presses that occur during runtime (even when the application is not in focus)"). \$\endgroup\$ Commented Nov 18, 2021 at 19:21

1 Answer 1

9
\$\begingroup\$

Bash, 90 bytes

This works on Ubuntu, and requires evtest. It picks a device that is a keyboard, and saves evtest's output to the file l. If you want a more formatted output, I can do that with more bytes.

echo I\'m gonna log you
sudo evtest /dev/input/by-path/`ls /dev/input/by-path/|grep kbd`>l
\$\endgroup\$
1
  • 1
    \$\begingroup\$ You sir deserve respect. \$\endgroup\$ Commented Apr 4, 2016 at 5:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.