# ICEYOU - Personal Anti-Intrusion Monitor ICEYOU watches your Windows machine while you're away. The moment any input, USB event, or camera tamper happens after idle, it locks the screen behind a full-screen white overlay with a mandatory password / face-unlock gate, snaps a photo of whoever is at the keyboard, records what they typed, and emails you the evidence. ## What It Does | Capability | Detail | |---|---| | Idle / away detection | Configurable idle timeout flips ICEYOU into "away" mode | | Whiteout lockout | Full-screen overlay with embedded password + face unlock | | Motion recording | Rolling 5s pre + event + 5s post AVI clips saved to `motion_clips/` while locked | | Escape-key blocking | Low-level Windows keyboard hook blocks CTRL+ESC, ALT+TAB, WIN, ALT+F4, CTRL+SHIFT+ESC, etc. while locked | | Snapshot on attempt | Webcam photo for every unlock attempt (success or failure) | | Credential logging | Failed password attempts saved to `events.log` and emailed | | Face recognition unlock | LBPH-based owner verification with `Unlock by Face` button + auto-attempt | | Camera tamper detection | Triggers full lockdown if lens is covered while locked | | USB / device monitor | Drive insertions/removals during away are treated as intrusions | | Email alerts | SMTP with photo attachment + entered credentials | | OS workstation lock | After N failed password attempts, Windows lock kicks in (whiteout reappears on resume) | | System tray UI | Pause/resume monitoring, force away, send test email, open snapshots/log | | Hotkeys | Force away & re-show unlock prompt globally | --- ## Quick Start 1. **Create a virtualenv** (recommended — opencv-contrib requires numpy < 2): ```powershell python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt ``` 2. **Copy & edit config**: ```powershell copy config.example.json config.json notepad config.json ``` - Set `unlock_password` to your phrase. - Fill SMTP details (Gmail App Password recommended). - Pick the correct `camera_device_index` (run `python face_enrollment.py --list-cameras` to enumerate). 3. **(Optional) Enroll your face**: ```powershell python face_enrollment.py --name owner ``` Re-run with the same `--name` for each accessory combination (glasses, headphones, hat) to build a robust model. 4. **Run**: ```powershell python main.py ``` A red shield tray icon appears. Right-click for the menu. 5. *(Optional)* Use the **Add to Windows Startup** option (via `startup.py`) so ICEYOU launches at login. --- ## Hotkeys & Manual Control | Hotkey (default) | Action | |---|---| | `Ctrl+Alt+L` | Force away mode + show whiteout immediately | | `Ctrl+Alt+U` | Re-show the whiteout password prompt (useful if it was hidden) | | `Ctrl+Alt+M` | **Toggle Monitoring** — Pause or resume monitoring (motion + intrusion detection) | | `Ctrl+Alt+S` | **Stop Monitoring** — Immediately pause motion recording and intrusion detection | Combos are configurable in `config.json → hotkeys` using pynput syntax (`+++p`, etc.). Restart ICEYOU after editing. **Automatic behavior**: When the user successfully unlocks the whiteout, monitoring is automatically **paused** (no more motion recording or intrusion detection). It will **automatically resume** the next time the machine idles for the configured timeout. --- ## Tray Menu | Item | Description | |---|---| | **Stop Monitoring** | Immediately pauses motion recording, intrusion detection, **and releases the camera** | | **Resume Monitoring** | Re-enables idle detection, motion recording, and intrusion triggers | | Toggle Away Mode | Manual away on/off (away forces the whiteout) | | Toggle White Screen | Disable the whiteout while still monitoring | | Open Snapshots Folder | Browse all captured photos | | View Motion Clips | Open `motion_clips/` (post-auth in practice) | | Open Log File | View `events.log` | | **Send Test Email** | Sanity-check SMTP without triggering an intrusion | | Settings | Opens `config.json` in Notepad (restart to apply) | | Exit | Stops everything cleanly | --- ## Intrusion Response Flow 1. **Detect** — Idle ≥ `idle_timeout_seconds` (or you pressed `Ctrl+Alt+L`) → away mode + whiteout up. 2. **Trigger** — Any keyboard, mouse, USB, or camera-obscured event during away fires an intrusion: - Snapshot captured (saved to `snapshots/`) - `intrusion_detected` event logged - Email alert sent with photo - Whiteout stays up with the password / face-unlock prompt 3. **Locked state** — `manual_lock` is set; ordinary activity **cannot** clear away mode. Only a correct unlock does. 4. **Password gate** — Cannot be cancelled or closed. After `max_unlock_attempts` (default 3) wrong passwords, Windows workstation lock kicks in. When the user returns from the Windows lock screen the **ICEYOU whiteout is still there** — unlocking Windows alone is not enough. 5. **Success** — Whiteout dismisses, failure counter resets, auto-away is snoozed briefly so you can work. --- ## Unlock Attempt Audit Trail Every interaction with the unlock prompt is recorded: - **Snapshot** of whoever is at the keyboard: `snapshots/snapshot__unlock__.jpg` - **Structured log entry** appended to `events.log` (one JSON object per line): - `method` — `"password"` or `"face"` - `success` — boolean - `snapshot` — path to the photo - `entered` — **only on failed password attempts** — the literal text the intruder typed - `label`, `confidence` — for face attempts - **Email alert** (if `email.enabled`) with the snapshot attached: - Failed password attempts include the typed text in the body - Successful unlocks confirm but **never** include your real password - Auto face attempts (every 4 s) are silent (no log / no email) to avoid flooding. Only **manual** `Unlock by Face` clicks and **successful** matches are recorded. If alerts aren't arriving: tray → **Send Test Email** (or `python test_email.py`). SMTP errors land in `events.log` as `email_failed`. Gmail → external-domain alerts often hit **Spam** — check there first and mark "Not spam" to whitelist. --- ## Face Recognition Unlock Optional second unlock path next to the password. 1. **Install the contrib OpenCV build** (required for `cv2.face`): ```powershell pip install --upgrade --force-reinstall opencv-contrib-python ``` 2. **Enroll** your face — multi-pose, multi-look: ```powershell python face_enrollment.py --name owner python face_enrollment.py --camera 1 --list-cameras ``` The capture window cycles through 5 poses (straight, left, right, up, down). Controls: - **Click** the preview window — most reliable capture - **SPACE / ENTER / C** — capture (window must have focus) - Hold a steady face ≥ 2 s — auto-capture - **R** restart, **Q / ESC** quit For glasses / headphones / hats, **re-run with the same `--name`** so LBPH learns all your looks under one identity. Each session appends to `faces/