#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
pyudev
library
- Python 3.x
pywin32
library
- 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.py
The script will start monitoring USB devices and log events to the console and usb_monitor.log
.
- Linux: Uses the
pyudev
library to monitor USB device events. - Windows: Utilizes the Windows API to handle USB device changes.
- macOS: Leverages
system_profiler
to detect USB device state changes.
This project is licensed under the MIT License. See the LICENSE file for details.
© 2025 Max Base
GitHub: BaseMax