PhishGuard is a hybrid phishing detection platform that combines rule-based heuristics and machine learning to detect malicious URLs and phishing emails β with explainable risk scoring so users understand why something was flagged.
| Target | Accuracy |
|---|---|
| Malicious URL Detection | 87.8% |
| Phishing Email Detection | 99.2% |
PhishGuard runs two independent detection pipelines β one for URLs, one for emails β each combining a rule engine with a trained ML model.
ββββββββββββββββββββββββββββββββββββββββββ
β Flask Web App β
β app/app.py + templates/ β
βββββββββββββββββ¬βββββββββββββββββββββββββ
β
ββββββββββββββββ΄βββββββββββββββ
β β
ββββββββΌβββββββ ββββββββΌβββββββ
β URL Input β β Email Input β
ββββββββ¬βββββββ ββββββββ¬βββββββ
β β
ββββββββΌβββββββ ββββββββΌβββββββ
β url_rules β β email_rules β β Rule-based heuristics
ββββββββ¬βββββββ ββββββββ¬βββββββ (rules/)
β β
ββββββββΌβββββββ ββββββββΌβββββββ
βurl_features β βemail_featuresβ β Feature extraction
ββββββββ¬βββββββ ββββββββ¬βββββββ (features/)
β β
ββββββββΌβββββββββββββ βββββββββββββΌββββββββββββββ
βphishing_url_model β β phishing_email_model β β Trained ML models
β .pkl β β + email_tfidf_vectorizerβ (model/)
ββββββββ¬βββββββββββββ βββββββββββββ¬ββββββββββββββ
β β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββΌβββββββ
β Risk Score β
β + Verdict β
βββββββββββββββ
URL Detection
url_rules.pyapplies rule-based heuristic checks on the URL structureurl_features.pyextracts numerical features from the URLphishing_url_model.pkl(trained ML model) classifies based on those features- A combined risk score and verdict is returned
Email Detection
email_rules.pyapplies heuristic checks on email headers and contentemail_features.pyextracts features from the email body and metadataemail_tfidf_vectorizer.pklvectorizes the text contentphishing_email_model.pklclassifies the vectorized input- A combined risk score and verdict is returned
| Layer | Technology |
|---|---|
| Web Framework | Python, Flask |
| Frontend | HTML, CSS (served via Flask templates) |
| ML Models | scikit-learn (.pkl β separate models for URL and email) |
| Text Vectorization | TF-IDF (email_tfidf_vectorizer.pkl) |
| Feature Engineering | Custom Python modules (url_features.py, email_features.py) |
| Rule Engine | Custom Python modules (url_rules.py, email_rules.py) |
phishguard/
βββ app/
β βββ app.py # Flask application β routes & detection logic
β βββ static/ # CSS, JS, and static assets
β βββ templates/ # HTML templates
βββ features/
β βββ url_features.py # Feature extraction for URLs
β βββ email_features.py # Feature extraction for emails
β βββ feature_order.txt # Defines feature vector ordering
βββ model/
β βββ phishing_url_model.pkl # Trained URL classifier
β βββ phishing_email_model.pkl # Trained email classifier
β βββ email_tfidf_vectorizer.pkl # TF-IDF vectorizer for email text
β βββ load_model.py # URL model loader
β βββ load_email_model.py # Email model loader
βββ rules/
β βββ url_rules.py # Heuristic rules for URL detection
β βββ email_rules.py # Heuristic rules for email detection
βββ utils/ # Shared utility functions
βββ requirements.txt
βββ runtime.txt
- Python 3.x
- pip
git clone https://github.com/Adnan-commits/phishguard.git
cd phishguard
pip install -r requirements.txtcd app
python app.pyThen open http://localhost:5000 in your browser.
Adnan Bardgujar LinkedIn Β· GitHub
β οΈ PhishGuard is an academic project. It is not intended as a production-grade security tool without further dataset validation and hardening.