<<<<<<< HEAD
A lightweight, zero-configuration Spring Boot + vanilla HTML/JS web application that monitors USB devices connected to your computer and displays a live security dashboard in any browser.
No login ID or password required โ opens directly in your browser.
Simply double-click run.bat (Windows) or run ./run.sh (Linux/macOS):
# Windows
run.bat
# Linux / macOS
chmod +x run.sh
./run.shThe application will automatically build, start with an embedded database, and open http://localhost:8080 in your browser.
Double-click view_in_browser.bat or open backend/src/main/resources/static/index.html in any web browser to view and interact with the dashboard directly.
Browser (http://localhost:8080 or standalone HTML)
โ REST API + Server-Sent Events (SSE)
โผ
Spring Boot Backend (Java 17)
โ
โโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
USB Monitor Database
(PowerShell / sysfs / profiler) (Embedded H2 / optional MySQL)
โ
OS โ Real USB Devices
| Feature | Detail |
|---|---|
| Instant Access | No credentials, login prompts, or passwords needed |
| Live Dashboard | Real-time connection stats, doughnut chart, live activity feed via SSE |
| Device Inventory | Complete history of detected USB devices with vendor, model, serial, and risk status |
| Trusted Whitelist | Whitelist authorized devices with custom labels |
| Security Alerts | Immediate alerts for unknown or high-risk USB devices (Allow, Trust, Simulate Block, Dismiss) |
| Security Audit Logs | Comprehensive event history with multi-parameter filtering and sorting |
| Data Export | Export filtered audit logs to CSV format |
| Zero-Config Database | Embedded file-based H2 database active by default (with optional MySQL support) |
| Native OS Backends | Automatic hardware detection on Windows (PowerShell), Linux (sysfs), and macOS (system_profiler) |
- Backend: Java 17, Spring Boot 3.2 (Spring Web, Spring Data JPA)
- Database: Embedded H2 Database (Default zero-config), MySQL 8 (Optional)
- Frontend: HTML5, CSS3, Vanilla JavaScript, Chart.js, Font Awesome 6
- Real-Time Updates: Server-Sent Events (SSE)
By default, the application runs with zero configuration using the embedded database. If you wish to connect to an external MySQL instance, set the following environment variables:
| Variable | Default | Description |
|---|---|---|
USB_MONITOR_DB_URL |
Embedded H2 (jdbc:h2:file:./data/usb_security_db) |
JDBC Connection URL |
USB_MONITOR_DB_DRIVER |
org.h2.Driver |
JDBC Driver Class Name |
USB_MONITOR_DB_USER |
sa |
Database user name |
USB_MONITOR_DB_PASSWORD |
(empty) | Database password |
USB_MONITOR_POLL_MS |
2000 |
USB poll interval in milliseconds |
USB_MONITOR_SIMULATE |
false |
Set true to run simulation without hardware polling |
To push this project to your GitHub account, follow these steps:
- Go to github.com/new.
- Name your repository (e.g.,
usb-security-web). - Leave "Initialize this repository with a README" unchecked (since we already have one).
- Click Create repository.
Run the following commands in PowerShell or Terminal from this project directory:
# Ensure branch is named main
git branch -M main
# Add your GitHub repository as the origin remote (replace with your GitHub repo URL)
git remote add origin https://github.com/<YOUR_USERNAME>/<YOUR_REPO_NAME>.git
# Push the code to GitHub
git push -u origin main
=======
# ๐ USB Device Security Monitor
A web-based **Cybersecurity Monitoring System** that detects USB devices connected to a computer, identifies trusted and unknown devices, generates security alerts, and maintains a complete history of USB activity through a web dashboard.
---
## ๐ Project Overview
USB devices such as flash drives, external hard drives, and other removable peripherals are commonly used for data transfer.
However, unauthorized USB devices can introduce security risks such as:
* Malware infection
* Unauthorized data transfer
* Data theft
* Unknown removable devices
* Malicious USB peripherals
* Security policy violations
The **USB Device Security Monitor** provides a centralized web dashboard for monitoring USB device activity and identifying potentially unauthorized devices.
---
## ๐ฏ Objectives
The main objectives of this project are:
* Detect USB device connection and disconnection events.
* Collect available USB device information.
* Identify trusted and unknown devices.
* Generate security alerts for unknown devices.
* Maintain USB activity logs.
* Provide a real-time web dashboard.
* Allow administrators/users to manage trusted devices.
* Provide security statistics and reports.
---
## โจ Features
### ๐ USB Device Monitoring
Automatically detect USB devices when they are connected or disconnected.
The system can collect information such as:
* Device Name
* Manufacturer
* Vendor ID (VID)
* Product ID (PID)
* Serial Number
* Device Type
* Connection Time
* Disconnection Time
* Current Status
---
### ๐ก๏ธ Trusted Device Management
Users can maintain a list of trusted USB devices.
Features include:
* Add device to trusted list
* Remove device from trusted list
* View trusted devices
* Automatically compare newly connected devices against the trusted list
---
### ๐จ Security Alerts
When an unknown USB device is detected, the system generates a security alert.
Example:
```text
โ UNKNOWN USB DEVICE DETECTED
Device: SanDisk USB Device
VID: XXXX
PID: XXXX
Risk Level: HIGH
Reason:
Device is not present in the trusted-device list.The dashboard provides an overview of the current USB security status.
Example:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ USB DEVICE SECURITY MONITOR โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Connected Trusted Unknown โ
โ 3 2 1 โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Recent USB Activity โ
โ โ
โ Device Event Risk โ
โ Kingston Connected LOW โ
โ SanDisk Connected HIGH โ
โ Kingston Disconnected LOW โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The system records USB activity including:
- Connection events
- Disconnection events
- Trusted devices
- Unknown devices
- Security alerts
- Risk levels
- Timestamps
Logs can be searched and filtered.
The system uses a basic heuristic risk classification.
| Risk | Description |
|---|---|
| ๐ข LOW | Trusted device |
| ๐ก MEDIUM | Unknown device with normal available metadata |
| ๐ด HIGH | Unknown device with suspicious/incomplete identifying information |
Note: A HIGH risk classification does not prove that a USB device is malicious. It indicates that the device requires further investigation.
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Web Browser โ
โ โ
โ Security Dashboard โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
HTTP
โ
โโโโโโโโโโโโผโโโโโโโโโโโโ
โ Spring Boot โ
โ Backend โ
โ โ
โ REST APIs โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโผโโโโโโโโโโ โโโโโโโโโโโผโโโโโโโโโ
โ USB Monitoring โ โ MySQL โ
โ Service โ โ Database โ
โโโโโโโโโโฌโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Operating System โ
โโโโโโโโโโฌโโโโโโโโโโ
โ
โผ
USB Devices
- Java
- Spring Boot
- Spring Web
- REST API
- Maven
- HTML5
- CSS3
- JavaScript
- Bootstrap
- Chart.js
- MySQL
- IntelliJ IDEA
- Git
- GitHub
- Postman
USB-Device-Security-Monitor/
โ
โโโ backend/
โ โโโ src/
โ โ โโโ main/
โ โ โ โโโ java/
โ โ โ โ โโโ com/usbsecurity/
โ โ โ โ โโโ controller/
โ โ โ โ โโโ service/
โ โ โ โ โโโ repository/
โ โ โ โ โโโ model/
โ โ โ โ โโโ monitor/
โ โ โ โ โโโ security/
โ โ โ โ โโโ config/
โ โ โ โ
โ โ โ โโโ resources/
โ โ โ โโโ application.properties
โ โ โ โโโ static/
โ โ โ
โ โ โโโ test/
โ โ
โ โโโ pom.xml
โ
โโโ database/
โ โโโ schema.sql
โ
โโโ screenshots/
โ
โโโ README.md
โโโ .gitignore
The project uses MySQL.
Stores information about detected USB devices.
id
device_name
manufacturer
vendor_id
product_id
serial_number
device_type
created_at
Stores trusted USB devices.
id
device_id
created_at
Stores USB connection and disconnection events.
id
device_id
event_type
risk_level
reason
timestamp
Stores security alerts.
id
device_id
severity
message
status
created_at
git clone https://github.com/your-username/USB-Device-Security-Monitor.gitMove into the project:
cd USB-Device-Security-Monitor
>>>>>>> 9fb99ce0992b6ed0cb730324ab636d26855533c5<<<<<<< HEAD
- Local Use: Designed for local hardware monitoring and administration.
- Risk Assessment: Risk scores (LOW, MEDIUM, HIGH) are heuristic assessments based on metadata completeness and whitelist status. =======
Install the following:
- Java 17 or later
- Maven
- MySQL
- Modern web browser
- Git
Verify Java:
java -versionVerify Maven:
mvn -versionOpen MySQL and create the database:
CREATE DATABASE usb_security_monitor;Then execute:
database/schema.sql
Update:
backend/src/main/resources/application.properties
Example:
spring.datasource.url=jdbc:mysql://localhost:3306/usb_security_monitor
spring.datasource.username=root
spring.datasource.password=YOUR_PASSWORD
spring.jpa.hibernate.ddl-auto=update
server.port=8080Do not commit real database passwords to GitHub.
Navigate to the backend:
cd backendRun:
mvn spring-boot:runThe server will start on:
http://localhost:8080
Open the URL in a browser.
The dashboard should open directly.
This project intentionally does not contain:
- Username
- Password
- Login page
- Registration
Anyone who can access the application can view the dashboard.
Open:
http://localhost:8080
Available pages:
/ โ Dashboard
/devices โ USB Devices
/trusted โ Trusted Devices
/alerts โ Security Alerts
/logs โ Security Logs
When a USB device is connected:
USB Connected
โ
Detect Device
โ
Collect Device Information
โ
Check Trusted List
โ
Calculate Risk
โ
Generate Event
โ
Save to MySQL
โ
Update Dashboard
When the device is removed:
USB Disconnected
โ
Create Event
โ
Save Event
โ
Update Dashboard
VID identifies the manufacturer of a USB device.
PID identifies a product/model associated with the manufacturer.
For example:
VID = 0781
PID = 5567
VID and PID are useful for device identification, but they should not be treated as a unique identity for a physical device by themselves.
When available, the serial number can provide stronger device-level identification.
A normal website cannot freely access all USB information from every visitor's computer.
This project therefore uses:
Browser
โ
Web Dashboard
โ
Spring Boot Backend
โ
USB Monitoring Service
โ
Operating System
โ
USB Device
The USB monitoring service runs on the computer being monitored.
For the normal college demonstration, the complete application can run locally:
http://localhost:8080
This project is designed as a defensive cybersecurity monitoring system.
It does NOT:
- Read personal files unnecessarily
- Copy files from USB devices
- Steal credentials
- Capture keyboard input
- Deploy malware
- Delete USB files
- Modify USB contents
- Perform unauthorized data collection
The system primarily monitors:
- USB metadata
- Connection events
- Device identity information
- Security alerts
The following test cases should be performed:
| Test | Expected Result |
|---|---|
| Connect trusted USB | Device marked LOW/TRUSTED |
| Connect unknown USB | Security alert generated |
| Disconnect USB | Disconnect event recorded |
| Connect multiple USBs | All devices detected |
| Missing serial number | Application continues normally |
| Database unavailable | Graceful error |
| Add trusted device | Device added to whitelist |
| Remove trusted device | Device removed from whitelist |
| Filter logs | Matching events displayed |
| Export CSV | CSV generated successfully |
Current limitations include:
- USB detection depends on operating-system capabilities.
- Some USB devices may not expose complete metadata.
- VID/PID alone cannot uniquely identify every physical USB device.
- An unknown USB device is not necessarily malicious.
- The system is not a replacement for antivirus software.
- Some operating-system operations may require administrator privileges.
- The current risk classification is heuristic.
Possible future improvements:
- ๐ค Machine-learning-based USB anomaly detection
- ๐ง Email security notifications
- ๐ฑ Mobile notifications
- ๐ Centralized monitoring for multiple computers
- ๐ Advanced device fingerprinting
- ๐ก๏ธ Enterprise USB security policies
- ๐ Advanced security analytics
- ๐ SIEM integration
- ๐ Digital signature verification
- ๐จ Automated incident response
- ๐ Historical security analytics
This project demonstrates knowledge of:
- Endpoint security
- USB security
- Device identification
- Access control concepts
- Security monitoring
- Event logging
- Risk assessment
- Security alerts
- Database security
- REST API security
- Secure coding
- SQL injection prevention
- Defensive cybersecurity
- Operating-system device monitoring
"USB Device Security Monitor is a web-based cybersecurity project that monitors USB devices connected to a computer. When a device is connected, the system collects its available metadata such as VID, PID, serial number and manufacturer information. It compares the device against a trusted-device list. If the device is unknown, the system generates a security alert and records the event in MySQL. The information is then displayed through a real-time web dashboard built using Java, Spring Boot, HTML, CSS and JavaScript."
This project is intended for educational and cybersecurity learning purposes.
Your Name
Cybersecurity / Java / Data Science Student
GitHub:
https://github.com/your-username
The goal of this project is to demonstrate how a defensive cybersecurity application can monitor removable devices, identify potentially unauthorized devices, generate security alerts, and maintain an auditable history of USB activity through a web-based interface.
9fb99ce0992b6ed0cb730324ab636d26855533c5