How shantanujoshi25/webscout works
Project type and purpose
• WebScout is a hybrid system consisting of a Chrome extension (frontend) and a local Python/Flask backend.
• Its purpose is to scan web pages for common security vulnerabilities by injecting scripts into the page, collecting DOM/data, then performing advanced analysis (including AI‐enhanced detection) on a local server.
File structure
• Top‐level:
• README.md (project overview)
• backend/ (Flask application + virtual environment)
• extension/ (Chrome extension code and assets)
• extension/ contains:
• manifest.json (extension configuration)
• background.js (persistent background script handling messages/events)
• content.js (injected into web pages to scrape DOM/data)
• popup/ (UI layer: popup.html, popup.js, popup.css)
• backend/ contains:
• app.py (Flask app exposing scan API endpoints)
• venv/ (Python dependencies)
Key insights from README
• The extension UI allows manual or auto‐scan via a “Scan Current Page” button.
• The backend server runs at http://127.0.0.1:5000 and processes scan requests, leveraging AI/ML.
• No external cloud services are mentioned—analysis is done locally.
Main components and their interactions
a. Browser with WebScout extension
• Popup UI (popup.html/js/css) for user controls (scan depth, toggles).
• Background script for orchestrating scan events and managing long‐running tasks.
• Content script for DOM inspection and payload collection.
b. Local Flask backend
• Exposes REST endpoints (e.g., /scan) that accept page data.
• Houses the scanning engine and AI models for vulnerability detection.
c. User’s target web page
• The content script is injected into pages the user visits.
d. (Optional) Local storage or file system for exportable reports
Interaction flow:
2. User requests “Scan Current Page.”
3. Popup script signals background script to initiate scan.
4. Background script injects content script (if not already injected).
5. Content script gathers DOM snapshots, form metadata, headers, etc.
6. Background script sends an HTTP POST to Flask backend at localhost:5000/scan with the collected data.
7. Backend processes data (fast checks + AI analysis) → returns JSON report.
8. Background script receives report → forwards it to popup UI.
9. Popup UI displays vulnerabilities and remediation steps.
10. User can export the report (saved locally via extension APIs or download).
Architectural patterns and principles
• Separation of concerns: UI (popup), orchestration (background), data‐collection (content), analysis (backend).
• Client‐server model: lightweight extension as client, Flask server as analysis engine.
• Message‐passing within the extension (Chrome runtime messaging).
• REST API between extension and backend.
Technologies & frameworks
• Chrome Extension APIs (manifest v3 or v2)
• JavaScript for popup, background, and content scripts
• Flask (Python) for backend server and REST endpoints
• AI/ML libraries (in Python environment) for enhanced detection
• Optional: local storage or file export libraries