How ananya-vastare/scamslam works
Project type and purpose
• ScamSlam is a full-stack web application (built in Python/Flask) whose purpose is real-time phishing detection for URLs, emails, and QR codes by combining rule-based heuristics with a trained machine-learning model.
File structure
• Top-level files:
• app.py – the Flask application entry point and routing logic
• model.py – code to load and invoke the ML model and vectorizer
• requirements.txt – Python dependencies (Flask, scikit-learn, etc.)
• sms_model.pkl & sms_vectorizer.pkl – serialized ML artifacts
• spam.csv & SMSSpamCollection – sample/train data for the ML pipeline
• Directories:
• templates/ – Jinja2 HTML templates (HomePage.html, MainHub.html, Pagenotfound.html)
• static/ – front-end assets:
– js/ (homepage.js, mainpage.js)
– images/
– music/ (alert/success audio cues)
README for additional insights
• The detection engine exposes multiple flows: URL checks, email text analysis, QR code scanning.
• Privacy-focused: no data persisted beyond in-memory processing.
• Responsive, minimalist UI served by Flask’s template/static architecture.
Main components and interactions
a. Components
• Web Browser (User Interface)
• Frontend Assets (HTML templates + CSS/JS under static/)
• Flask Web Server (app.py)
• Phishing Detection Service
– Rule-Based Engine (blacklist lookups, heuristics)
– ML Model Pipeline (vectorizer + classifier loaded from .pkl)
• External Services (if any – e.g., QR code library or third-party blacklist API)
• Data Store (optional – sample data CSV, but in production none persists user data)
b. Relationships and data flow
1. User submits URL/email/QR through the browser UI
2. Request hits Flask endpoints in app.py
3. Flask routes dispatch to either rule-based checks or ML model (via model.py)
4. model.py loads and applies sms_vectorizer.pkl → sms_model.pkl
5. Decision returned to Flask → Flask renders JSON or injects result into MainHub.html
6. Browser displays result and plays appropriate audio cue (Success.mp3 or Alert.mp3)
c. Architectural patterns/design principles
• MVC-like separation:
– View layer (templates + static)
– Controller layer (app.py routes)
– Model layer (model.py + ML artifacts)
• Single process monolith (all functions in one Flask app)
• Real-time stateless request processing (privacy-focused)
d. Key technologies/frameworks
• Python 3.x, Flask
• scikit-learn (machine-learning pipeline)
• Jinja2 templating
• Vanilla JavaScript for client interactivity
• HTML5/CSS3 (responsive design)
• Optional: pyzbar or similar for QR code parsing
Elements
• Labels:
• “Browser / User Interface”
• “Flask Server (app.py)”
• “Rule-Based Engine”
• “ML Model Pipeline”
• “External Blacklist API”, “QR Code Library” (if applicable)
• Request flows from UI → Flask
• Internal calls from Flask → Rule Engine / Model Pipeline
• Responses from engines → Flask → UI
• Rectangles for components (frontend/backend/ML)
Final recommendations
• Be very detailed: break the Flask app into “Routing Layer” and “Service Layer” if desired.
• Sample data files (.csv) off to the side under “Development / Training Resources.”