# PhishGuard Kenya 🛡️
A real-time phishing URL detection and reporting platform built for the Kenyan digital ecosystem. PhishGuard combines machine learning with a hard rule engine to detect phishing sites targeting M-Pesa, KRA, banking portals, and other commonly impersonated Kenyan and global brands.
---
## Features
- **URL Scanner** — Paste any URL and get an instant verdict: Safe, Suspicious, or Phishing
- **ML + Rule Engine** — Random Forest classifier combined with 11 deterministic security rules (catches typosquatting, brand impersonation, homoglyph attacks, and more)
- **Fuzzy Brand Matching** — Detects typosquatted domains like `microsft.com`, `safaric0m.co.ke`, `paypa1.com`
- **Community Reporting** — Logged-in users can report phishing URLs for admin review
- **Threat Database** — Public dashboard of confirmed phishing threats
- **Admin Panel** — Approve/reject community reports, manually add threats
- **Education Centre** — Guides and interactive quiz on spotting phishing attacks
- **JWT Authentication** — Secure login/register with bcrypt password hashing
---
## Tech Stack
| Layer | Technology |
|-------|-----------|
| Frontend | Vanilla HTML/CSS/JS (single file) |
| Backend | Python 3, Flask, Flask-JWT-Extended |
| Database | MySQL (SQLAlchemy ORM) |
| ML Model | scikit-learn Random Forest |
| Auth | Flask-Bcrypt + JWT |
---
## Project Structure
```
phishguard/
├── backend/
│ ├── routes/
│ │ ├── analyze.py # Core URL analysis endpoint + rule engine
│ │ ├── auth.py # Register, login, /me
│ │ ├── reports.py # Community phishing reports
│ │ ├── threats.py # Public threat database
│ │ └── admin.py # Admin moderation endpoints
│ ├── models.py # SQLAlchemy database models
│ ├── extensions.py # Flask extensions (db, bcrypt, jwt)
│ └── app.py # App factory
├── ml/
│ ├── features.py # 30-feature URL extractor
│ ├── train_model.py # Model training pi …