This project is purely for educational purposes, and I do not endorse or encourage any malicious use of this code. This project is simply designed to demonstrate my understanding of keyloggers and Python, and misuse of this project could result in legal action against those responsible. I take no responsibility for what others may choose to do with this information.
This project demonstrates a Python keylogger using pynput for capturing user input and cryptography for encrypting and transmitting data to a server using sockets.
- Python 3
- Required libraries: Socket, Pynput, Cryptography
To install the necessary libraries, run the following command in your terminal:
pip install pynput cryptography
- Run
keys.pyto generate a key for encryption. This key will be used to encrypt and decrypt the keystrokes. Store the generated key securely. - Replace
"Your server IP here"inPyKey.pywith your server's IP address. - Run
keylogger_server.pyon your server machine first. - Run
PyKey.pyon the target machine (the machine you want to monitor). - Check the server terminal for confirmation that the server is running and receiving data.
- View the keystrokes logged in
Keystroke Log Desktop.txton your server.
PyKey.py: Runs on the target machine to capture and send keystrokes.keylogger_server.py: Receives encrypted keystrokes fromPyKey.pyand logs them.keys.py: Used to generate encryption keys.
control.py: Demonstrates using the Controller module to manipulate keyboard and mouse inputs.listen.py: Outputs mouse coordinates to the terminal.
Feel free to contact me on GitHub for any questions or feedback.
Thanks to the tutorial "Building a keylogger using Python + Pynput" by buildwithpython on YouTube.