Dept. of AI & Emerging Technologies
Six-model ensemble (3 classical ML + 3 deep learning) served via FastAPI, packaged in Docker, with a Chrome extension for real-time tab analysis.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Chrome Extension β
β popup.html / popup.js β background.js (SW) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β POST /predict
ββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β FastAPI (api.py) β
β Latency middleware Β· Request/Prediction/Error logs β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β PhishingPredictor (predict.py) β
β β
β βββββββββββββββββββββββ ββββββββββββββββββββββββββββ β
β β Structured ML β β Deep Learning β β
β β (ARFF features) β β (URL char sequences) β β
β β ββ Random Forest β β ββ LSTM (BiDir) β β
β β ββ XGBoost β β ββ Character CNN β β
β β ββ SVM (RBF) β β ββ Transformer encoder β β
β ββββββββββββ¬βββββββββββ ββββββββββββββ¬ββββββββββββββ β
β ββββββββββββββββ¬βββββββββββββ β
β Weighted Fusion β
β (F1-proportional) β
β β β
β SHAP Explainability β
β Top-N Feature Report β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
phishing-detector/
βββ train.py β train all 6 models
βββ predict.py β inference engine (importable)
βββ api.py β FastAPI app
βββ benchmark.py β latency benchmark suite
βββ requirements.txt
βββ Dockerfile
βββ docker-compose.yml
βββ .gitignore / .dockerignore
β
βββ src/
β βββ features.py β URL / WHOIS / DNS / SSL / HTML features
β βββ models/
β βββ dl_models.py β LSTM Β· CNN Β· Transformer (PyTorch)
β βββ artifacts/ β saved .pkl / .pt (git-ignored)
β
βββ data/ β put your CSV + ARFF here (git-ignored)
β βββ phishing_site_urls.csv
β βββ Training_Dataset.arff
β
βββ logs/ β JSONL request / prediction / error logs
β βββ requests.jsonl
β βββ predictions.jsonl
β βββ errors.jsonl
β
βββ extension/ β Chrome / Edge extension (MV3)
βββ manifest.json
βββ background.js
βββ popup.html
βββ popup.js
βββ icons/
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txtdata/phishing_site_urls.csv (549k URLs, columns: URL, Label)
data/Training_Dataset.arff (11k samples, 30 features + Result)
python train.py \
--csv data/phishing_site_urls.csv \
--arff data/Training_Dataset.arff \
--sample 50000 \
--epochs 10 \
--device cpuArtifacts saved to src/models/artifacts/.
uvicorn api:app --host 0.0.0.0 --port 8000 --reloadcurl -s -X POST http://localhost:8000/predict \
-H "Content-Type: application/json" \
-d '{"url":"http://login-paypal-verify.com/update?account=true"}' \
| python -m json.toolpython benchmark.py --requests 200 --concurrency 8# Build
docker build -t phishing-detector:latest .
# Run
docker run -d -p 8000:8000 \
-v $(pwd)/src/models/artifacts:/app/src/models/artifacts:ro \
-v $(pwd)/logs:/app/logs \
--name phishing-api \
phishing-detector:latestdocker compose up -d
docker compose logs -f api| Method | Endpoint | Description |
|---|---|---|
| POST | /predict |
Classify a URL (full ensemble) |
| GET | /health |
Liveness check |
| GET | /metrics |
Aggregate latency stats (last 1000) |
{
"url": "https://example.com",
"include_shap": true,
"fetch_html": false
}{
"url": "...",
"label": "phishing | safe",
"is_phishing": true,
"confidence": 0.87,
"model_votes": {
"rf": {"label":"phishing","confidence":0.91},
"xgb": {"label":"phishing","confidence":0.85},
"svm": {"label":"phishing","confidence":0.79},
"lstm": {"label":"phishing","confidence":0.88},
"cnn": {"label":"phishing","confidence":0.86},
"transformer": {"label":"phishing","confidence":0.92}
},
"top_features": [
{"feature":"has_suspicious_words","value":1.0,"importance":0.23}
],
"shap_values": {"has_suspicious_words": 0.18, "...": "..."},
"metadata": {
"domain": "login-paypal-verify.com",
"domain_age_days": 12,
"ssl_valid": false,
"has_mx": false
},
"latency_ms": 14.3,
"request_id": "a1b2c3d4"
}
- Open Chrome β
chrome://extensions - Enable Developer mode
- Click Load unpacked β select the
extension/folder - Add icons to
extension/icons/(icon16/48/128.png) - Change
API_BASEinbackground.jsto match your server