A complete Anamoly Detection project using Hybrid approach Rule Based + ML to classify url as Safe or Malicious. The project includes data preprocessing, Feature Engineering, training ML model, API development and Chrome Extension.
It automatically flags malicious URLs and shows safe URLs with a ✅, providing users with a safer browsing experience.
-
Real-time phishing detection in Chrome
-
Legitimate websites are marked safe
-
Suspicious/phishing URLs are flagged automatically
-
Hybrid model: Isolation Forest + Whitelist
-
Confusion matrix & evaluation metrics included
- Load Dataset
- Clean Text
- Train Model →
preprocessing/train.py - Evaluate Model →
preprocessing/evaluate.py - Select Model & Save →
models/model.pkl - Visualize Metrics → Confusion Matrix
- Deploy with API and Chrome Extension
- Download the extension from GitHub
- Extract the folder
- Open
chrome://extensions/ - Enable Developer mode
- Click Load unpacked and select the MalGuard folder
MalGuard will start protecting you immediately.
MalGuard communicates with a backend API for real-time predictions.
GET https://malguard.onrender.com/predict?url=
<encoded_url>{
"prediction": "Malicious",
"raw_value": -1,
"url": "url"
}Metrics calculated for test data:
| Metric | Score |
|---|---|
| Accuracy | 0.90 |
| Precision | 0.90 |
| Recall | 0.99 |
| F1 Score | 0.94 |
Class-wise performane
| Class | Precision | Recall | F1-score | Support |
|---|---|---|---|---|
| -1 (Phishing) | 1.00 | 0.66 | 0.79 | 126 |
| 1 (Legitimate) | 0.93 | 1.00 | 0.96 | 569 |
Visualizations Saved in reports/plots/:
- Confusion Matrix
# Clone the repo
git clone https://github.com/roshan-acharya/MalGuard.git
cd MalGuard
# Create virtual environment (optional)
python -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
-
Run Training Pipeline
python -m pipeline
-
Run Flask App
python -m Api.main
-
Python
-
Pandas
-
NumPy
-
Scikit-learn
-
Matplotlib, Seaborn
-
Flask
-
Pickle (for saving models)
Roshan Acharya
AI/ML Enthusiast

