This is a simple keylogger implemented in Python using the pynput
library. It captures keyboard events and logs them to a text file (key_log.txt
) and a JSON file (key_log.json
).
- Records pressed, held, and released keys.
- Saves key logs in both text and JSON formats.
- Provides a graphical user interface (GUI) built with Tkinter for starting and stopping the keylogger.
- Python 3.x
- pynput library (
pip install pynput
)
- Run the script (
keylogger.py
). - Click the "Start" button to begin keylogging.
- Press keys on your keyboard.
- Click the "Stop" button to stop keylogging.
keylogger.py
: The main Python script containing the keylogger implementation.key_log.txt
: Text file containing logged key events.key_log.json
: JSON file containing logged key events in JSON format.
- The
on_press
function is called whenever a key is pressed. - The
on_release
function is called whenever a key is released. - Key events are stored in a list
keys_used
and periodically saved to text and JSON files. - The keylogger can be started and stopped using the GUI buttons.
- This keylogger is for educational purposes only. Do not use it for malicious purposes.
- Be cautious when running the keylogger, as it can log sensitive information.