A simple, practical machine learning project to detect phishing URLs using URL-based features and a lightweight ML model, wrapped with a Flask web interface.
This project is meant to demonstrate how classical ML techniques can be applied to real-world cybersecurity problems, with a clean and easy to understand codebase.
Phishing attacks rely heavily on malicious URLs that look legitimate at first glance. This project analyzes different characteristics of a URL and predicts whether it is phishing or legitimate.
The focus is on:
- Feature engineering from raw URLs
- Using a trained ML model for prediction
- Serving predictions via a Flask web app
phishing_url_detection/
│
├── app.py # Flask application entry point
├── features.py # URL feature extraction logic
├── templates/ # HTML templates for the web interface
├── README.md # Project documentation
├── LICENSE # MIT License
└── .gitignore # Ignored files and folders
- User inputs a URL through the web interface
- The URL is passed to
features.py - Multiple lexical and structural features are extracted
- These features are fed into a trained ML model
- The model predicts whether the URL is Phishing or Safe
-
The model is trained on a labeled phishing URL dataset
-
It uses URL-based features such as:
- Length of URL
- Presence of special characters
- Use of IP address instead of domain
- Suspicious keywords
- Number of subdomains
Note on Model File
The trained ML model file (
.pkl/.joblib) is not included in this repository because it exceeds GitHub’s file size limit.
You have two recommended options:
Option 1: Cloud Storage (Recommended)
-
Upload the trained model to:
- Google Drive
- Dropbox
- AWS S3
-
Download it locally before running the app
Option 2: Retrain Locally
- Use the same feature extraction logic
- Train the model again using your dataset
- Save it locally and load it inside
app.py
git clone https://github.com/akshitago01/phishing_url_detection.git
cd phishing_url_detectionpip install -r requirements.txt(If requirements.txt is missing, install Flask, scikit-learn, numpy, pandas manually.)
python app.pyhttp://127.0.0.1:5000/
- Educational ML & cybersecurity project
- Demonstrating feature engineering on text data
- Foundation for a larger phishing detection platform
- Can be extended into a browser extension or API
Built with curiosity, learning, and a focus on cybersecurity.