This project implements a Python-based keyboard event monitoring system with network capabilities. It's designed for legitimate system monitoring and diagnostic purposes, featuring efficient event processing and network transmission.
- Asynchronous keyboard event processing
- Memory-efficient buffering system
- Network transmission with retry capability
- Thread-safe operations
- Configurable monitoring intervals
- Python 3.7+
- Required packages:
pynput>=1.7.3
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
Edit the key.py file to set the following parameters:
SERVER_IP_ADDR = "your_server_ip"
SERVER_PORT = your_port_number
TIME_INTERVAL = transmission_interval_in_seconds.
├── client.py # Main implementation file
├── key.py # Configuration constants
└── README.md # This file
The main class handling keyboard monitoring and event processing.
Key features:
- Event buffering using StringIO
- Thread-safe operations with buffer locks
- Queued event processing
- Configurable network transmission
- TCP-based transmission
- Automatic retry on connection failure
- Server acknowledgment handling
- Asynchronous event processing
- Memory-efficient buffering
- Reduced disk I/O
- Optimized thread management
Run the program with:
python client.pyThe program will:
- Initialize the monitoring system
- Create necessary directories
- Begin processing keyboard events
- Transmit data at configured intervals
The system includes comprehensive error handling for:
- Network connectivity issues
- File system operations
- Memory management
- Thread synchronization
- Console output for diagnostic information
- Error logging for troubleshooting
- Network transmission status updates
- CPU usage is optimized through event queuing
- Memory usage is controlled via buffer management
- Network transmission is handled in separate threads
- File I/O is minimized to improve performance
For development purposes:
- Set shorter
TIME_INTERVALvalues - Monitor console output for diagnostics
- Check network connectivity with test server
The system is optimized for minimal system impact:
- Efficient event queuing
- Controlled memory usage
- Reduced disk operations
- Optimized thread management
Common issues and solutions:
-
Connection failures:
- Verify server address and port
- Check network connectivity
- Confirm firewall settings
-
Performance issues:
- Adjust queue size
- Modify processing intervals
- Check system resources