Skip to content

Repository files navigation

πŸ›‘οΈ Phishing Dataset for Machine Learning

πŸ“Œ Project Overview

This project focuses on building a Machine Learning model capable of accurately detecting phishing websites using URL and webpage-based features. By leveraging supervised learning algorithms and comprehensive exploratory data analysis (EDA), the project aims to improve cybersecurity by automatically distinguishing phishing websites from legitimate ones.

The complete workflow includes data preprocessing, visualization, feature engineering, model training, evaluation, cross-validation, and feature importance analysis to identify the most effective phishing detection model.


🧠 About the Dataset

Context

Anti-phishing refers to techniques used to prevent phishing attacks.

Phishing is a type of cybercrime where attackers impersonate trusted organizations through emails, SMS, or websites to trick users into revealing sensitive information such as:

  • Login credentials
  • Banking information
  • Credit card details
  • Personal identity information

Once collected, attackers may steal identities, compromise accounts, or install malware.


Dataset Information

The dataset contains:

  • 10,000 total webpages
    • 5,000 Phishing Websites
    • 5,000 Legitimate Websites

Feature extraction was performed using Selenium WebDriver, providing a more robust and reliable approach than traditional regex-based extraction methods.

  • Collection Period:
    • January–May 2015
    • May–June 2017

The dataset contains:

  • 48 engineered features
  • Binary classification target
  • Suitable for:
    • Machine Learning
    • Cybersecurity Research
    • Classification Benchmarking
    • Feature Importance Analysis

🎯 Project Goal

Develop a Machine Learning model that accurately identifies phishing websites using URL-based and webpage features to improve cybersecurity and protect users from malicious attacks.


πŸš€ Project Workflow

1️⃣ Import Libraries

  • NumPy
  • Pandas
  • Matplotlib
  • Seaborn
  • Scikit-Learn

2️⃣ Load Dataset

  • Import phishing dataset
  • Inspect dataset dimensions
  • Verify successful loading

3️⃣ Data Audit

Performed:

  • Missing Value Analysis
  • Duplicate Check
  • Data Types
  • Dataset Information
  • Statistical Summary

4️⃣ Target Detection

Identified the dependent variable:

  • Phishing
  • Legitimate

Verified class labels before training.


5️⃣ Data Cleaning

Performed:

  • Feature Encoding
  • Standardization
  • Data Validation
  • Feature Selection Preparation

6️⃣ Exploratory Data Analysis (EDA)

Analyzed:

  • Class Distribution
  • Dataset Balance
  • Feature Relationships
  • Outliers
  • Feature Trends

Visualizations included:

  • Countplots
  • Histograms
  • Boxplots
  • Heatmaps
  • Correlation Matrix

7️⃣ Correlation Analysis

Studied relationships among numerical features using:

  • Pearson Correlation
  • Correlation Heatmap

This helped identify:

  • Highly correlated variables
  • Redundant features
  • Strong predictive indicators

8️⃣ Feature Distribution

Compared major phishing indicators such as:

  • URL Length
  • HTTPS Presence
  • Domain Features
  • Redirects
  • Suspicious URL Patterns

9️⃣ Feature Selection

Reduced noise by retaining the most informative predictors to improve:

  • Model accuracy
  • Generalization
  • Training efficiency

πŸ”Ÿ Train-Test Split

Prepared the dataset using:

  • Training Set
  • Testing Set

Ensuring unbiased evaluation.


1️⃣1️⃣ Machine Learning Models

Implemented multiple classification models:

  • Logistic Regression
  • Decision Tree Classifier
  • Random Forest Classifier

Each model was trained using a consistent preprocessing pipeline.


1️⃣2️⃣ Model Evaluation

Evaluated using:

  • Accuracy
  • Precision
  • Recall
  • F1-Score
  • ROC-AUC Score
  • Confusion Matrix
  • Classification Report

Best Performing Model: πŸ† Random Forest Classifier


1️⃣3️⃣ Cross Validation

Compared model consistency using Cross Validation.

Random Forest demonstrated the highest and most stable validation performance.


1️⃣4️⃣ Feature Importance

Tree-based feature importance identified the strongest phishing indicators, including:

  • URL Length
  • HTTPS Status
  • Domain Characteristics
  • URL Structure
  • Security Features

1️⃣5️⃣ Model Saving

Saved the best-performing model for future deployment and real-time phishing website detection.


πŸ“Š Model Performance Summary

Model Performance
Logistic Regression Good Baseline Performance
Decision Tree Strong Performance
⭐ Random Forest Best Overall Performance

Random Forest achieved the highest F1-Score and ROC-AUC, making it the most reliable model for phishing website detection.


πŸ“ˆ Key Insights

  • The dataset is well-balanced with equal phishing and legitimate samples.
  • URL characteristics are among the strongest indicators of phishing.
  • HTTPS usage significantly influences website legitimacy.
  • Tree-based ensemble methods outperform simpler linear models.
  • Feature engineering substantially improves classification performance.
  • Cross-validation confirms Random Forest's robustness and stability.
  • Feature importance analysis enhances model interpretability.

πŸ›  Tech Stack


πŸ“‚ Project Structure

Phishing-Dataset-for-Machine-Learning/
β”‚
β”œβ”€β”€ Dataset/
β”‚   └── phishing_dataset.csv
β”‚
β”œβ”€β”€ Notebook/
β”‚   └── Phishing_Detection.ipynb
β”‚
β”œβ”€β”€ Images/
β”‚   β”œβ”€β”€ Class_Distribution.png
β”‚   β”œβ”€β”€ Correlation_Heatmap.png
β”‚   β”œβ”€β”€ Feature_Importance.png
β”‚   └── Confusion_Matrix.png
β”‚
β”œβ”€β”€ Model/
β”‚   └── phishing_model.pkl
β”‚
β”œβ”€β”€ requirements.txt
└── README.md

πŸ’‘ Future Improvements

  • XGBoost & LightGBM implementation
  • Hyperparameter Optimization
  • Explainable AI using SHAP
  • Real-time URL Prediction API
  • Flask/FastAPI Deployment
  • Streamlit Dashboard
  • Browser Extension for Live Phishing Detection

πŸ“š Libraries Used

  • Python
  • NumPy
  • Pandas
  • Matplotlib
  • Seaborn
  • Scikit-learn
  • Joblib

⭐ Conclusion

This project demonstrates an end-to-end Machine Learning pipeline for phishing website detection, from raw data analysis to deployment-ready model creation. Among all evaluated algorithms, Random Forest Classifier consistently delivered the strongest performance across F1-score, ROC-AUC, and cross-validation, making it the optimal choice for phishing classification. The project showcases practical applications of data preprocessing, EDA, feature engineering, model evaluation, and cybersecurity analytics, forming a strong portfolio project for Data Science and Machine Learning roles.


πŸ‘¨β€πŸ’» Author

Arpan Ghosal
Junior Data Scientist

If you found this project helpful, consider ⭐ starring the repository to support the project.

About

𝐏𝐑𝐒𝐬𝐑𝐒𝐧𝐠 πƒπšπ­πšπ¬πžπ­ 𝐟𝐨𝐫 𝐌𝐚𝐜𝐑𝐒𝐧𝐞 π‹πžπšπ«π§π’π§π 

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages