Phishing Website Detection: Machine Learning Classification Pipeline
Supervised machine learning classification engine engineered to detect fraudulent and phishing URLs through lexical pattern recognition, statistical web feature extraction, and decision tree ensembles.
graph TD
Raw[Raw URL / Webpage Record] --> FeatureExt[Lexical & Structural Feature Extractor]
FeatureExt --> Clean[Preprocessing & Missing Value Imputation]
Clean --> Train[Ensemble Model Training: Random Forest / Decision Trees]
Train --> Eval[Performance Metrics & ROC Evaluation]
Eval --> Inference[Production Classification Service]
Inference --> Result{Classification: Legitimate vs Phishing}Methodology & Feature Engineering
The detection system evaluates URLs across distinctive structural markers that differentiate legitimate web domains from deceptive credential harvesting sites:
- Lexical Dimensions: URL length, directory depth, token counts, entropy, and domain name character distributions.
- Syntactic Indicators: Presence of IP address replacements, suspicious sub-domains, non-standard port specifications, and hyphen densities.
- Security Artifacts: HTTPS anchor protocols, certificate authority matching, and abnormal URL shortening redirects.
Pipeline Architecture
src/model.py: Model serialization, feature vector transformations, and inference evaluation routines.src/main.py: Prediction pipeline handling single URL scoring and batch classification requests.notebooks/phishing_website_detection.py: Complete exploratory data analysis (EDA), dataset distributions, correlation heatmaps, and hyperparameter tuning experiments.
Technology Stack
- Language: Python 3.10+
- Machine Learning: Scikit-Learn (Decision Trees, Random Forest Ensembles)
- Data Engineering: Pandas, NumPy
- Visualization: Matplotlib, Seaborn
Setup and Execution
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install requirements
pip install -r requirements.txt
# Run inference service
python -m src.main