USB Port Access Controller — Whitelist, Block, and Alert in Real Time
Stop data leaks and malware via USB ports. Monitor devices live, whitelist by VID/PID, auto-block unauthorized storage, and keep an audit trail — all from a simple dashboard.
- ✓Hardware-ID whitelisting (Vendor ID / Product ID)
- ✓Background daemon/service with instant alerts
- ✓Cross-platform: Windows & Linux support
1. Introduction
The USB Port Access Controller for System Security is a Python-based endpoint protection project that monitors and controls USB usage. It enables administrators to enable/disable ports, whitelist known devices by hardware IDs, and block unauthorized connections automatically. Continuous real-time monitoring and alerts harden systems against data theft, malware ingress, and tampering.
2. Existing System vs Proposed System
- Manual OS controls with limited policy depth.
- No instant alerts for unauthorized insertions.
- No automated whitelisting by hardware IDs.
- Automated background monitoring & control.
- Secure whitelisting via Vendor ID / Product ID.
- Real-time block/eject of unknown storage.
- Complete logs and optional email/desktop alerts.
3. Working
- Device Detection: Continuous scan of connected USB devices.
- Identification: Extract name, VID, and PID via pyudev/pywinusb/psutil.
- Verification: Compare against authorized whitelist in SQLite.
- Access Decision: Authorized → allow; Unauthorized → disable/eject device.
- Logging & Alerts: Record events and notify admin instantly.
- Policy Management: Add/remove devices; toggle monitoring & alerting.
4. Technology Stack
- Language: Python
- Libraries: psutil, pyudev (Linux), pywinusb (Windows), os, subprocess, sqlite3, smtplib
- Database: SQLite3 for device whitelist, logs, settings
- Interface: Flask web dashboard or Tkinter desktop GUI
- Security: Hardware-ID whitelisting, password-protected admin, background service
5. Modules
Scan & enumerate USB devices.
- Hotplug events
- VID/PID parsing
Whitelist matching.
- Exact/partial match
- Per-user policy*
Allow/Block/Eject.
- Windows PowerShell
- Linux udev/udisks
Audit trails.
- Timestamps & IDs
- CSV/SQLite export
Notify on violations.
- Email via SMTP
- Desktop toasts
Policy & reports.
- Add/remove whitelist
- Start/stop monitor
6. Advantages
- Prevents data leakage via rogue USB storage.
- Centralized control over all USB connections.
- Lightweight background service with minimal overhead.
- Works on Windows and Linux.
- Customizable for enterprise/lab environments.
7. Applications
- Corporate & government endpoints.
- Education & research labs.
- Banking/defence high-confidentiality systems.
- Personal systems to block unknown drives.
- Cybersecurity training & demos.
Python Integration Sketch (pyudev/pywinusb + SQLite + Alerts)
# Linux hotplug (pyudev)
import pyudev, sqlite3, smtplib, subprocess, psutil, time
ctx = pyudev.Context()
mon = pyudev.Monitor.from_netlink(ctx)
mon.filter_by('usb')
def allowed(vid, pid):
cur = db.execute("SELECT 1 FROM whitelist WHERE vid=? AND pid=?", (vid, pid))
return cur.fetchone() is not None
for dev in iter(lambda: mon.poll(timeout=3), None):
if dev.action == 'add' and dev.get('ID_VENDOR_ID') and dev.get('ID_MODEL_ID'):
vid, pid = dev['ID_VENDOR_ID'], dev['ID_MODEL_ID']
if not allowed(vid, pid):
log_event('BLOCK', vid, pid, dev.get('ID_MODEL'))
# Attempt to unmount/eject if storage
subprocess.run(['udisksctl','power-off','-b', dev.device_node], capture_output=True)
send_alert(f"Blocked USB {vid}:{pid}")
else:
log_event('ALLOW', vid, pid, dev.get('ID_MODEL'))
# Windows (pywinusb/PowerShell)
# - Enumerate USB storage
# - If unauthorized: Disable via 'Set-StorageDeviceProperty' or registry policy, then alert.
# Dashboard (Flask/Tk)
# - List devices, add/remove whitelist (VID/PID), toggle monitor, export logs.
What You Get
| Item | Included | Notes |
|---|---|---|
| Python Source Code | ✅ | psutil, pyudev/pywinusb, subprocess |
| Whitelist & Policies | ✅ | SQLite schema + CRUD UI |
| Real-time Monitor/Daemon | ✅ | Start/stop from dashboard |
| Alerts & Logging | ✅ | SMTP + desktop toasts, CSV/SQLite |
| Demo Video | ✅ | Setup & working walkthrough |
| Report & PPT | ✅ | College-format templates |
| Support | ✅ | Installation + viva Q&A (1 month) |
FAQs — USB Port Access Controller
Need a no-nonsense USB security project?
Get the USB Port Access Controller with code, demo, docs, and support.
WhatsApp Us Now
