How regcyb1/safesurf works
Project Type and Purpose
• SafeSurf is a browser extension that classifies web pages (e.g., phishing vs. safe) using machine-learning models.
• It includes:
• A training pipeline (Python scripts, datasets)
• Model artifacts (pickled Random Forest and MLP models)
• A browser extension (HTML/JS/CSS) for end-user interaction
• Lightweight testing modules
Main Components
A. Training Pipeline (Offline)
1. Raw datasets (ARFF files in train/data, plus combined_dataset.csv)
2. Feature extraction module (test/features_extraction.py & patterns.py)
3. Model training scripts (train/train_rf.py, train/train_mlp.py)
4. Output: model artifacts (models/random_forest.pkl, models/mlp_model.pkl)
B. Deployment Runtime
1. Browser Extension (extension/manifest.json, popup.html, popup.js, style.css)
• UI popup for user to trigger classification
• JS sends the current URL/content for analysis
2. Local Classification Service (invoked via run.sh)
• A minimal Python HTTP server or CLI that:
• Loads the pickled models
• Applies the same feature-extraction logic
• Returns classification results (safe/phishing)
3. Optional Logging/Storage (not yet implemented, could be added)
Relationships & Data Flows
• Offline: Dataset → Feature Extraction → Training Scripts → Model Artifacts
• Runtime: User clicks extension popup → JS sends URL → Classification Service loads Model → Returns verdict → Extension displays result
Architectural Patterns & Design Principles
• Clear separation of concerns:
• Offline training vs. online serving
• UI (extension) vs. business logic (classification service)
• Reuse of code: feature extraction logic is shared between test suite, training, and serving
• Extensibility: New models can be added to /models and automatically served