A Windows intrusion monitoring application that detects failed login attempts, captures webcam evidence, generates time-based OTP codes, sends email alerts, and provides a real-time monitoring dashboard.
Laptop Guard monitors the Windows Security Event Log for failed authentication events (Event ID 4625).
When a failed login attempt is detected, the application:
- Captures a webcam photo
- Displays a desktop notification
- Generates a TOTP verification code
- Sends an email alert containing the timestamp, OTP, and captured image
- Stores evidence locally for later review
The project is intended for personal workstation monitoring, security experimentation, and educational cybersecurity projects.
- Monitors Windows Security Event Logs
- Detects failed login events (Event ID 4625)
- Configurable polling interval
- Captures images from the default webcam
- Automatically timestamps captured photos
- Stores images locally
- Windows desktop notifications
- Email alerts via Gmail SMTP
- Attached webcam evidence
- Time-based OTP generation
- Live OTP display
- OTP countdown indicator
- Intruder photo gallery
- Full-size image preview
- Security event history
- Activity log viewer
- Service status monitoring
- Environment-variable based configuration
- Automatic TOTP secret generation
- Custom photo storage location
Failed Login Attempt
│
▼
Windows Security Log
(Event ID 4625)
│
▼
Laptop Guard Monitor
│
┌────────┼────────┬────────┐
▼ ▼ ▼ ▼
Photo Notify OTP Email
Capture User Generate Alert
│
▼
Evidence Storage
│
▼
Dashboard Update
laptop-guard/
│
├── main.py
├── dashboard.py
├── config.py
│
├── guard/
│ ├── camera.py
│ ├── event_monitor.py
│ ├── notifier.py
│ ├── mailer.py
│ └── otp_manager.py
│
├── .env.example
├── requirements.txt
├── guard.log
└── README.md
- Windows 10 or Windows 11
- Python 3.10+
- Administrator privileges
- Webcam
- Gmail account with App Password enabled
Clone the repository:
git clone https://github.com/YOUR_USERNAME/laptop-guard.git
cd laptop-guardInstall dependencies:
pip install -r requirements.txtCreate a configuration file:
copy .env.example .envEdit .env:
YOUR_EMAIL=you@gmail.com
APP_PASSWORD=your_app_password
TOTP_SECRET=
SAVE_FOLDER=C:\IntruderPhotos
POLL_INTERVAL=5Laptop Guard uses Gmail SMTP for email delivery.
- Enable Two-Factor Authentication.
- Generate a Gmail App Password.
- Add the generated password to the
.envfile.
Do not use your normal Gmail password.
Launch an elevated terminal and run:
python main.pyAdministrator privileges are required to access the Windows Security Event Log.
python dashboard.pyThe dashboard provides:
- Evidence review
- OTP monitoring
- Activity logging
- Service status visibility
If no TOTP secret is provided, Laptop Guard automatically generates one on first launch.
Example:
Generated new TOTP_SECRET: XXXXXXXXXXXXXXXXX
Store this value in your .env file and optionally import it into:
- Google Authenticator
- Authy
- Microsoft Authenticator
Generated codes remain valid for 30 seconds.
Captured images are stored in:
C:\IntruderPhotos
File naming format:
intruder_YYYYMMDD_HHMMSS.jpg
Example:
intruder_20250120_221530.jpg
FAILED LOGIN ALERT
Time : 2025-01-20 22:15:30
OTP Code : 573921
If this login attempt was not initiated by you,
review the attached image and investigate immediately.
| Package | Purpose |
|---|---|
| opencv-python | Webcam capture |
| pywin32 | Windows Event Log access |
| plyer | Desktop notifications |
| pyotp | TOTP generation |
| python-dotenv | Environment configuration |
| pillow | Dashboard image rendering |
- Windows-only implementation
- Polling-based event monitoring
- Gmail SMTP dependency
- Local storage only
- No automatic evidence retention policy
- Single-recipient email configuration
- Never commit
.envto source control. - Do not expose
APP_PASSWORDorTOTP_SECRET. - Run only on systems you own or are authorized to monitor.
- Protect stored evidence appropriately.
- Telegram notifications
- Discord integration
- Face recognition
- Cloud evidence storage
- Multi-user support
- Event subscription monitoring instead of polling
- Remote dashboard access
MIT License