How ah74n/ism works
Purpose and Entry Points
IsMalicious is a URL threat-intelligence application: it accepts URLs, gathers network/domain evidence, applies heuristic and ML analysis, optionally executes browser-based sandbox inspection, and returns structured risk findings. The backend FastAPI application starts at backend/app/main.py; the Vite/React client starts at frontend/src/main.jsx and renders frontend/src/App.jsx.
API and Request Boundary
HTTP routes form the public control boundary. Scan submission and analysis results are centered on backend/app/api/routes/scan.py; retained scan lookup is exposed through backend/app/api/routes/history.py. Supporting operational surfaces include authentication, administration, health, and sandbox routes under backend/app/api/routes/auth.py, backend/app/api/routes/admin.py, backend/app/api/routes/health.py, and backend/app/api/routes/sandbox.py.
Scan Orchestration
The scan route should coordinate analysis rather than embed detection logic. URL validation occurs before service invocation in backend/app/utils/validators.py; request/response contracts and scan persistence types live in backend/app/models/schemas.py and backend/app/models/scan_model.py. The resulting flow is: client URL → validation → enrichment/detection services → normalized threat response → persisted history.
Domain and DNS Enrichment
backend/app/services/dns_service.py is the external-network intelligence boundary for DNS and likely domain-record collection. Its output feeds the decision pipeline alongside URL characteristics, keeping remote lookup behavior separate from API handlers and response formatting.
Detection Pipeline
Two complementary detection stages provide risk signals:
• Rule/indicator analysis in backend/app/services/heuristic_service.py, for suspicious URL/domain patterns and deterministic findings.
• Model inference in backend/app/services/ml_service.py, backed by extracted URL features from backend/app/ml/feature_extractor.py and the committed model artifact backend/url_model.pkl.
backend/app/ml/live_feature_extractor.py indicates a distinct feature path for runtime/live inspection, which should remain compatible with the trained model’s expected feature schema. Model training is an offline workflow in backend/train_model.py, not part of request handling.
Sandbox and Automation Boundary
backend/app/services/sandbox_service.py encapsulates active target inspection, consistent with the documented Playwright and media-processing capabilities. It is exposed separately at backend/app/api/routes/sandbox.py, allowing potentially slower or higher-risk browser automation to remain isolated from lightweight URL scoring. This layer may involve external untrusted pages and must be treated as the strongest execution/network boundary.
Persistence, Configuration, and Deployment
Database initialization and session infrastructure are centralized in backend/app/core/database.py; the repository includes a local SQLite database at backend/ismalicious.db, while the design is described as PostgreSQL-ready. Runtime settings and environment-derived service endpoints belong in backend/app/core/config.py; logging is centralized in backend/app/core/logging.py. Redis and PostgreSQL are intended optional infrastructure dependencies, configured via environment variables rather than embedded in route logic. Container deployment is represented by Dockerfile; backend Python dependencies are declared in backend/requirements.txt.
Presentation Layer
The frontend is a thin client boundary rather than analysis infrastructure. frontend/src/App.jsx presents scan interactions and consumes backend APIs, while frontend/src/main.jsx bootstraps the application. Deployment is independently compatible with Vercel for the frontend and Uvicorn/Gunicorn-style Python hosting for the API.
Main entry points: main.py FastAPI application · scan.py Scan API · validators.py URL validation · database.py Database sessions
Components 21
Frontend
- React bootstrap
frontend/src/main.jsx - Scan UI · Collects URLs and displays risk findings.
frontend/src/App.jsx
API boundary
- FastAPI application
backend/app/main.py - Scan API · Coordinates synchronous URL analysis and response creation.
backend/app/api/routes/scan.py - History API
backend/app/api/routes/history.py - Sandbox API · Separates active inspection from lightweight scoring.
backend/app/api/routes/sandbox.py - Operational routes
backend/app/api/routes/auth.py
Analysis pipeline
- URL validation
backend/app/utils/validators.py - Scan contracts
backend/app/models/schemas.py - Scan record
backend/app/models/scan_model.py - DNS enrichment · Collects remote DNS and domain-record evidence.
backend/app/services/dns_service.py - Heuristic analysis · Produces deterministic URL and domain indicators.
backend/app/services/heuristic_service.py - ML inference
backend/app/services/ml_service.py - URL features
backend/app/ml/feature_extractor.py - Live features · Maintains compatibility with the model feature schema.
backend/app/ml/live_feature_extractor.py - Trained URL model
backend/url_model.pkl - Browser sandbox · Executes browser-based inspection against untrusted pages.
backend/app/services/sandbox_service.py - Offline model training · Builds the committed model outside request handling.
backend/train_model.py
Platform & storage
- Database sessions · Centralizes initialization and session access.
backend/app/core/database.py - Scan history store · Local SQLite is present; PostgreSQL is supported by configuration.
backend/ismalicious.db - Runtime settings · Configures optional Redis and PostgreSQL endpoints.
backend/app/core/config.py
Connections 24
- React bootstrap → Scan UI: renders
- Scan UI → FastAPI application: API requests
- FastAPI application → Scan API: mounts
- FastAPI application → History API: mounts
- FastAPI application → Sandbox API: mounts
- FastAPI application → Operational routes: mounts
- Scan API → URL validation: validates URL
- Scan API → Scan contracts: uses contracts
- URL validation → DNS enrichment: valid URL
- URL validation → Heuristic analysis: valid URL
- URL validation → ML inference: valid URL
- DNS enrichment → Heuristic analysis: domain evidence
- URL features → ML inference: feature vector
- Live features → ML inference: live feature vector
- Trained URL model → ML inference: loaded model
- Scan API → Scan record: normalizes result
- Scan record → Database sessions: persists through
- Database sessions → Scan history store: stores scans
- History API → Database sessions: queries
- Sandbox API → Browser sandbox: starts inspection
- Runtime settings → FastAPI application: runtime configuration
- Runtime settings → Database sessions: database endpoint
- URL features → Offline model training: training features
- Offline model training → Trained URL model: produces