# 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 β¦