Skip to content

Latest commit

 

History

History
67 lines (43 loc) · 1.41 KB

File metadata and controls

67 lines (43 loc) · 1.41 KB

USB Device Monitor

#Some Screenshots of it in action usb_monitor

A cross-platform Python script for monitoring USB device plug-in and removal events on Linux, Windows, and macOS.

Features

  • 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.

Requirements

Linux

  • Python 3.x
  • pyudev library

Windows

  • Python 3.x
  • pywin32 library

macOS

  • Python 3.x

Installation

  1. Clone the repository:

    git clone https://github.com/BaseMax/USB-device-monitor.git
    cd USB-device-monitor
  2. Install the required dependencies:

    pip install -r requirements.txt

Usage

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.

How It Works

  • 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.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

© 2025 Max Base

GitHub: BaseMax