A web application that helps detect phishing URLs using machine learning. Submit a URL to get a risk assessment (Suspicious or Legitimate) along with supporting analysis such as WHOIS data, HTTPS status, and reputation checks.
- URL phishing detection — Classifies URLs as Suspicious or Legitimate using trained Random Forest models
- Detailed analysis — URL length, special characters, digit/letter counts, shortening services, HTTPS, IP in domain, Google indexing, domain age (WHOIS), free hosting indicators, GeoIP data, DNS records, and more
- User accounts — Sign up, login, and role-based access (admin vs regular user)
- Admin dashboard — Manage sub-users, view reports, and see prediction statistics
- Prediction history — Save and view past URL checks and results
- Backend: Flask, Flask-SQLAlchemy, Flask-Login, Flask-Bcrypt
- ML: scikit-learn (Random Forest), NumPy
- Data: SQLite (default), WHOIS, DNS lookups, tldextract, GeoIP2
- Frontend: Jinja2 templates, Bootstrap-style UI
- Additional libraries: beautifulsoup4, requests, nltk, dnspython, geoip2, python-whois
- Python 3.8+
- pip
-
Clone the repository (or navigate to the project folder):
cd smephishdefender -
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure the app (optional but recommended):
- Set a strong
secret_keyinapp.pyfor production (replace'your_secret_key'). - If you use external APIs (e.g. AbuseIPDB, IPQualityScore), set your keys via environment variables or config and avoid committing them.
- Set a strong
-
From the project root, run:
python app.py
-
Open a browser and go to:
http://127.0.0.1:5000 -
Sign up or log in, then use the dashboard to enter a URL and run a phishing check.
smephishdefender/
├── app.py # Flask app, routes, ML prediction logic
├── requirements.txt # Python dependencies
├── machine_train_model.pkl # Trained phishing-detection model (primary)
├── fmodel.pkl # Additional trained phishing-detection model
├── 2020 machie (2).ipynb # Jupyter notebook with model training code
├── instance/
│ └── app.db # SQLite database (created on first run)
├── static/ # CSS, JS, images
├── templates/ # HTML templates (login, dashboards, reports, etc.)
└── README.md
The phishing classifiers are trained on URL features (length, special characters, shortening services, HTTPS, IP in URL, Google index, domain length, free hosting, etc.). Serialized models are stored in machine_train_model.pkl (primary) and fmodel.pkl (additional). Training code is available in the included Jupyter notebook (2020 machie (2).ipynb) for reference or retraining.
Use and modify as needed for your project. Consider adding a specific license file if you plan to publish.