UjjwalMishraa24/Keylogger ? reverse-engineered prompt
Reverse engineered prompt
Build me a small educational Linux keylogger in C++ that reads keystrokes directly from the kernel input devices under /dev/input/eventN and prints them to the terminal while also appending them to a log file. It should be able to scan the available input devices, find the actual keyboard automatically, and also let me pass a specific event device and optional output file from the command line. Keep it simple and transparent, no hiding, no networking, no grabbing the device from other apps, just read only access so normal keyboard input still works. I want it to track Shift and Caps Lock, map raw key codes to readable characters using a US QWERTY layout, and ignore things like arrow keys and media keys if they are not mapped. It should have a Makefile, a clean build, a help message, and stop nicely with Ctrl C while flushing the log before exit. If you need to check current Linux docs or ioctl details, look them up online.
Are you gonna build this?
make sure you review the code using coderabbit