Klogger is a Python-based keylogging system that demonstrates how global keyboard input can be captured, buffered, and periodically transmitted using standard Python libraries.
The program listens to all keyboard events at the OS level, records both character and special keys, and sends the collected input at fixed time intervals via SMTP email.
Starts a global keyboard listener using pynput
Captures:
Printable characters (a, 1, ., etc.)
Special keys (space, enter, escape, modifiers)
Appends all captured input into an in-memory log buffer
Every N seconds (default: 300):
Sends the current log via email using Gmail’s SMTP server (TLS)
Clears the log
Reschedules the next report automatically
Runs continuously until the process is terminated
pynput Used to hook into low-level keyboard events and receive keypress callbacks.
Logging mechanism Keystrokes are normalized (characters vs special keys) and concatenated into a single string buffer.
The listener captures all keyboard input globally, not just from a specific window.
Email delivery depends on valid SMTP credentials and configuration.
persistence is not present.
The program is designed as a continuous background process.