WinUSB-Guardian is a robust, real-time USB management and security tool for Windows. It provides advanced monitoring and automated blocking of unauthorized USB storage devices to protect your system from data injection and malicious payloads.
- 🚀 Real-time Monitoring: Detects USB storage devices (
USBSTOR) the moment they are connected using WMI event watchers. - 🚫 Automated Blocking: Instantly disables unauthorized USB devices at the system level using
pnputiland native Windows APIs. - 📑 Whitelist Management: Maintain a persistent
usb_whitelist.jsonfile to allow trusted devices based on their unique serial numbers. - 🛡️ AutoRun Protection: Automatically disables Windows AutoRun/AutoPlay system-wide to prevent the execution of malicious
autorun.inffiles. - 🔄 Smart Recovery: Automatically detects and recovers devices that were left in a disabled state from previous sessions. (비활성화된 USB 장치는 노트북에 꽂은 상태로 프로그램을 다시 실행하면 정상적으로 복구됩니다.)
- 💻 Admin-Aware: Automatically requests elevation to Administrator privileges if needed.
- Windows 10 or 11
- Python 3.10+
- Administrator privileges
Install the required Python libraries:
pip install wmi pywin32-
Clone the repository:
git clone https://github.com/siggniel/WinUSB-Guardian.git cd WinUSB-Guardian -
Run the manager:
python usb_manager.py
-
Whitelist a device:
- When an unauthorized device is blocked, its Device ID will be printed in the terminal.
- Manually add the serial number (the last part of the Device ID) to
usb_whitelist.json. - Example
usb_whitelist.json:[ "1234567890123456" ]
usb_manager.py: The main controller that handles detection, blocking, and whitelisting.usb_detector.py: A lightweight script for monitoring connection events.usb_whitelist.json: (Generated) Stores the serial numbers of allowed devices.usb_events.log: (Generated) Detailed logs of all connection and blocking events.
This tool is designed to enhance security, but physical security is also paramount. Ensure your laptop is configured to Lock on Lid Close and requires a password on wake-up to mitigate HID-based (keyboard emulation) attacks.
Apache License 2.0. See LICENSE for details.