
CodeB: Phishing URL Detection System
End-to-end ML solution for identifying malicious URLs with explainable AI
Timeline
Completed
Role
ML Engineer
Status
CompletedTechnology Stack
CodeB: Phishing URL Detection System
An end-to-end Machine Learning solution designed to identify and classify malicious URLs. This project bridges the gap between high-accuracy classification and model transparency in cybersecurity.
Project Overview
CodeB is a production-ready system that detects phishing URLs with 93-95% accuracy while providing explainable predictions through SHAP and LIME analysis. The system features a modular architecture with a FastAPI backend and interactive Streamlit dashboard.
Performance: 93-95% accuracy Key Feature: Explainable AI (XAI) for transparency Deployment: Fully containerized with Docker
Key Highlights
- High Performance: Achieved 93-95% accuracy using optimized classification algorithms
- Explainable AI (XAI): Integrated SHAP and LIME to provide "why" behind every prediction, making the model trustworthy for non-technical stakeholders
- Production Ready: Features a modular FastAPI backend and an interactive Streamlit dashboard
- Full Containerization: Dockerized for 100% environment consistency
System Architecture
The system follows a modern ML-Ops pipeline:
- Data Preprocessing: Feature extraction from raw URLs (checking for length, special characters, domain age, etc.)
- ML Engine: Classification model trained on curated phishing datasets
- Explainability Layer: SHAP/LIME analysis to highlight specific URL features that triggered the "Phishing" alert
- Interface: Real-time inference via a web-based UI
Tech Stack
- Machine Learning: Scikit-learn, SHAP, LIME, Pandas, NumPy
- API Framework: FastAPI (Python)
- Frontend: Streamlit
- DevOps: Docker, Git
Getting Started
Using Docker (Recommended)
Ensure you have Docker installed, then run:
docker-compose up --build- API Documentation: http://localhost:8000/docs
- Web UI: http://localhost:8501
Local Setup
- Clone the Repository:
git clone https://github.com/SHREY275/codeb.git
cd codeb- Install Dependencies:
pip install -r requirements.txt- Run the Backend:
uvicorn backend.app:app --reload- Run the Frontend:
streamlit run frontend/ui.pyEvaluation and Explainability
The project doesn't just provide a label (Safe/Phishing); it provides a Feature Importance Map. By using SHAP, we can see which part of the URL (e.g., a suspicious subdomain or an IP-based host) contributed most to the risk score.
Key Metrics
- Accuracy: 93-95%
- Precision: High confidence in phishing predictions
- Recall: Effective at catching malicious URLs
- Explainability: SHAP/LIME feature importance analysis
Features
- Real-time URL classification
- Feature importance visualization
- SHAP and LIME explainability analysis
- RESTful API with comprehensive documentation
- Interactive web dashboard
- Batch processing capability
- Docker containerization for easy deployment
Internship Contributions
- Engineered a robust feature extraction pipeline to reduce overfitting
- Automated the deployment workflow using Docker
- Collaborated on improving model interpretability for end-users
- Implemented SHAP/LIME integration for explainable predictions
API Endpoints
POST /predict- Classify a single URLPOST /predict-batch- Classify multiple URLsGET /explain/{url_id}- Get SHAP/LIME explanation for a predictionGET /docs- Interactive API documentation
Model Performance
The model achieves consistent performance across different URL types:
- Legitimate URLs: High true negative rate
- Phishing URLs: High true positive rate with clear feature attribution
- Suspicious URLs: Detailed risk scoring with explainability
Repository: github.com/SHREY275/codeb
