#Some Screenshots of it in action
A cross-platform Python script for monitoring USB device plug-in and removal events on Linux, Windows, and macOS.
- Logs USB device connections and disconnections.
- Supports Linux, Windows, and macOS.
- Outputs logs to both the console and a file (
usb_monitor.log). - Graceful termination with Ctrl+C.
- Python 3.x
pyudevlibrary
- Python 3.x
pywin32library
- Python 3.x
-
Clone the repository:
git clone https://github.com/BaseMax/USB-device-monitor.git cd USB-device-monitor -
Install the required dependencies:
pip install -r requirements.txt
Run the script directly:
python usb_device_monitor.pyThe script will start monitoring USB devices and log events to the console and usb_monitor.log.
- Linux: Uses the
pyudevlibrary to monitor USB device events. - Windows: Utilizes the Windows API to handle USB device changes.
- macOS: Leverages
system_profilerto detect USB device state changes.
This project is licensed under the MIT License. See the LICENSE file for details.
© 2025 Max Base
GitHub: BaseMax