AI-Driven Phishing Detection Platform
URL phishing detection Β· Email analysis via Claude AI Β· Domain reputation (URLhaus) Β· Screenshot brand-similarity Β· Chrome extension
| Feature | Engine | Size |
|---|---|---|
| π URL Analyzer | Random Forest + custom feature attribution | Core |
| βοΈ Email Analyzer | Claude API (claude-haiku) / keyword fallback | Core |
| π Domain Reputation | URLhaus (abuse.ch), free, no API key needed | Core |
| πΌοΈ Screenshot Analysis | Playwright + perceptual hash (pHash) | Optional +280MB |
| π Browser Extension | Chrome MV3, calls FastAPI backend | No extra install |
Linux / macOS:
git clone https://github.com/dedsechack-1337/PhishGuardAI.git
cd PhishGuardAI
chmod +x setup_and_run.sh run.sh run_api.sh
./setup_and_run.shWindows:
git clone https://github.com/dedsechack-1337/PhishGuardAI.git
cd PhishGuardAI
setup_and_run.batThe script will:
- Create a Python virtual environment
- Install all core dependencies (~510MB)
- Ask if you want the Screenshot Analysis add-on (+280MB, optional)
- Generate the URL training dataset
- Train the Random Forest model
- Launch the web UI and open your browser
First run takes 3β5 minutes. Subsequent runs use
./run.shand launch instantly.
./run.sh # Linux/macOS β just opens the dashboard
run.bat # Windows| Component | Size | Required |
|---|---|---|
| Python core ML (scikit-learn, pandas, numpy) | ~290MB | β Yes |
| Streamlit web UI | ~30MB | β Yes |
| FastAPI + uvicorn | ~8MB | β Yes |
| anthropic SDK | ~2MB | β Yes |
| requests, pillow, imagehash | ~9MB | β Yes |
| Core total | ~510MB | |
| Playwright + Chromium browser | +280MB | Optional |
| With screenshot add-on | ~790MB |
XGBoost (~250MB) and SHAP (~340MB) are not installed by default. Install
requirements-dev.txtonly if you want to retrain with XGBoost.
The Chrome extension scans the page you're currently viewing using the FastAPI backend.
-
Start the API backend:
./run_api.sh # Linux/macOS run_api.bat # Windows
Backend runs at
http://localhost:8000β docs athttp://localhost:8000/docs -
Open Chrome and go to
chrome://extensions/ -
Enable Developer mode (top-right toggle)
-
Click Load unpacked and select the
extension/folder
Click the π‘οΈ PhishGuard icon in your toolbar on any page β SCAN THIS PAGE β instant risk verdict + breakdown.
For AI-powered email phishing detection, set your Anthropic API key:
# Linux/macOS
export ANTHROPIC_API_KEY=sk-ant-...
# Windows
set ANTHROPIC_API_KEY=sk-ant-...Without a key, the email analyzer uses a built-in keyword-based fallback that still catches common phishing patterns.
Get a free API key at console.anthropic.com.
Install after the main setup:
# Linux/macOS
pip install playwright==1.48.0
python -m playwright install chromium
# Windows (in venv)
venv\Scripts\pip install playwright==1.48.0
venv\Scripts\python -m playwright install chromiumThen rebuild the brand reference database (captures screenshots of major brands once):
python src/build_brand_reference.pyRestart the UI β the Screenshot Analysis tab will now be fully functional.
PhishGuardAI/
βββ setup_and_run.sh / .bat # First-time setup + launch
βββ run.sh / run.bat # Daily launch (fast)
βββ run_api.sh / run_api.bat # FastAPI backend for browser extension
βββ requirements.txt # Core deps (~510MB)
βββ requirements-screenshot.txt # Screenshot add-on (+280MB)
βββ requirements-dev.txt # Optional: XGBoost for retraining
β
βββ src/
β βββ app.py # Streamlit web UI (4 tabs)
β βββ api.py # FastAPI backend (5 endpoints)
β βββ feature_extraction.py # 25 URL feature signals
β βββ train.py # RF model training pipeline
β βββ predict.py # URL inference + explanations
β βββ predict_email.py # Email inference (Claude API / fallback)
β βββ domain_reputation.py # URLhaus threat intel lookup
β βββ screenshot_analysis.py # Playwright capture + pHash comparison
β βββ build_brand_reference.py# Build brand reference hash database
β βββ generate_dataset.py # Synthetic URL training dataset
β
βββ extension/ # Chrome browser extension (MV3)
β βββ manifest.json
β βββ popup.html
β βββ popup.js
β βββ icons/
β
βββ models/ # Trained model artifacts (auto-generated)
β βββ random_forest.joblib
β βββ explainer.joblib # Lightweight feature attribution data
β βββ feature_names.joblib
β
βββ data/ # Datasets (auto-generated)
β βββ urls_dataset.csv
β βββ brand_reference_hashes.json
β
βββ screenshots/ # README screenshots
The FastAPI backend (http://localhost:8000) provides:
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Health check + model status |
/analyze/url |
POST | URL risk score + explanation |
/analyze/email |
POST | Email risk score + signals |
/analyze/reputation |
POST | URLhaus domain/URL lookup |
/analyze/screenshot |
POST | Capture screenshot + brand comparison |
/analyze/full |
POST | Combined URL + reputation analysis |
Interactive docs: http://localhost:8000/docs
Replace the synthetic training data with real phishing datasets for production-quality accuracy:
URLs (aim for 90β97% accuracy on real data):
- PhiUSIIL Phishing URL Dataset β 235K URLs
- PhishTank β live phishing feed
Emails:
- Nazario Phishing Corpus β phishing emails
- Enron Email Dataset β legitimate emails
All datasets just need url,label or text,label CSV columns β the training scripts work unchanged.
| Problem | Fix |
|---|---|
streamlit: not found |
Activate venv: source venv/bin/activate |
ANTHROPIC_API_KEY not set |
Email uses keyword fallback β works fine without key |
URLhaus timeout/blocked |
Domain reputation returns "unknown" gracefully β check your network allows urlhaus-api.abuse.ch |
| Screenshot tab says "not installed" | Run pip install playwright && python -m playwright install chromium |
| Extension shows "β offline" | Start API first: ./run_api.sh |
| Models not found error | Run python src/train.py from the project root |
| Package | Version |
|---|---|
| Python | 3.10β3.12 |
| scikit-learn | 1.5.2 |
| pandas | 2.2.3 |
| numpy | 1.26.4 |
| streamlit | 1.39.0 |
| fastapi | 0.115.5 |
| anthropic | 0.39.0 |
| playwright | 1.48.0 (optional) |
dedsechack-1337 π GitHub Β· π PhoenixSIEM





