# chaithanyabs441-ux/phishing-website-detector architecture

> Architecture diagram of the GitHub repository chaithanyabs441-ux/phishing-website-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chaithanyabs441-ux/phishing-website-detector
- Repository: https://github.com/chaithanyabs441-ux/phishing-website-detector

## Overview

PhishReaper is a phishing-URL triage service backed by a reproducible classical-ML research pipeline. The deployed flow accepts a URL and optional uploaded HTML, extracts URL/HTML features, scores with a calibrated CatBoost model or URL-SVM fallback, and can override the verdict on a Safe Browsing threat match. A separate offline workflow downloads data, creates leakage-controlled splits, builds features, compares models, and calibrates thresholds. Serving relationships are supported by the app excerpt and SOURCE INDEX; broader research-stage links follow the README, since several evaluation modules were not sampled.

Main entry points: [`webapp/app.py`](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/webapp/app.py) (Scan API), [`src/evaluation/phase4_boosting.py`](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase4_boosting.py) (Tree tuning), [`src/features/url_features.py`](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/features/url_features.py) (URL features), [`src/evaluation/phase4_data.py`](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase4_data.py) (Training data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["Online triage"]
  node_webapp["Scan API<br/>[app.py]"]
  node_security["Request guards"]
  node_fetch["Safe HTML fetch<br/>[safe_fetch.py]"]
  node_registry["Model registry<br/>[model_registry.py]"]
  node_verdict["Triage verdict<br/>[app.py]"]
end

subgraph group_features["Feature extraction"]
  node_urlfeat["URL features<br/>[url_features.py]"]
  node_htmlfeat["HTML features"]
end

subgraph group_research["Model research"]
  node_dataset["Dataset download"]
  node_splits["Blocked splits"]
  node_cache["HTML feature cache"]
  node_phase4data["Training data<br/>[phase4_data.py]"]
  node_svm["SVM baselines"]
  node_boosting["Tree tuning<br/>[phase4_boosting.py]"]
  node_text["Text models<br/>[phase5_text.py]"]
  node_stack["OOF stacking<br/>[phase6_stacking.py]"]
  node_calibration["Calibration"]
  node_benchmarks["Benchmark evaluation"]
end

subgraph group_reputation["Threat intelligence"]
  node_safe_browsing["Safe Browsing lookup"]
end

node_analyst(("Analyst"))
node_google["Google Safe Browsing"]

node_analyst -->|"submits scan"| node_webapp
node_webapp -->|"validates request"| node_security
node_webapp -.->|"optionally fetches"| node_fetch
node_webapp -->|"extracts features"| node_urlfeat
node_webapp -->|"parses HTML"| node_htmlfeat
node_webapp -->|"requests prediction"| node_registry
node_registry -->|"returns model score"| node_verdict
node_webapp -->|"checks URL"| node_safe_browsing
node_safe_browsing -->|"queries threat list"| node_google
node_webapp -->|"renders triage"| node_verdict
node_verdict -->|"presents signal"| node_analyst
node_dataset -->|"provides shards"| node_splits
node_splits -->|"defines holdout"| node_svm
node_cache -->|"supplies HTML cache"| node_phase4data
node_urlfeat -->|"computes URL inputs"| node_phase4data
node_phase4data -->|"loads model data"| node_boosting
node_svm -->|"baseline comparison"| node_text
node_boosting -->|"model comparison"| node_text
node_text -->|"provides stack inputs"| node_stack
node_stack -->|"provides OOF scores"| node_calibration
node_boosting -->|"selects finalist"| node_calibration
node_benchmarks -->|"uses shared features"| node_urlfeat
node_benchmarks -->|"uses HTML features"| node_htmlfeat

click node_webapp "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/webapp/app.py"
click node_security "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/serving/request_security.py"
click node_fetch "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/serving/safe_fetch.py"
click node_registry "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/serving/model_registry.py"
click node_verdict "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/webapp/app.py"
click node_urlfeat "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/features/url_features.py"
click node_htmlfeat "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/features/html_features_v2.py"
click node_dataset "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/data/download_dataset.py"
click node_splits "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/create_blocked_splits.py"
click node_cache "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/build_html_features_v2_cache.py"
click node_phase4data "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase4_data.py"
click node_svm "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/evaluate_svm_blocked.py"
click node_boosting "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase4_boosting.py"
click node_text "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase5_text.py"
click node_stack "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase6_stacking.py"
click node_calibration "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase7_calibration.py"
click node_benchmarks "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/evaluate_url_html_official.py"
click node_safe_browsing "https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/reputation/google_safe_browsing.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_security,node_fetch,node_registry,node_verdict toneBlue
class node_urlfeat,node_htmlfeat toneAmber
class node_dataset,node_splits,node_cache,node_phase4data,node_svm,node_boosting,node_text,node_stack,node_calibration,node_benchmarks toneMint
class node_safe_browsing toneRose
class node_analyst,node_google toneIndigo
```

## Components

### Online triage

- [Scan API](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/webapp/app.py): `webapp/app.py`
- [Request guards](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/serving/request_security.py): `src/serving/request_security.py`
- [Safe HTML fetch](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/serving/safe_fetch.py): `src/serving/safe_fetch.py`
- [Model registry](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/serving/model_registry.py): `src/serving/model_registry.py`
- [Triage verdict](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/webapp/app.py): `webapp/app.py`

### Feature extraction

- [URL features](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/features/url_features.py): `src/features/url_features.py`
- [HTML features](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/features/html_features_v2.py): `src/features/html_features_v2.py`

### Model research

- [Dataset download](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/data/download_dataset.py): `src/data/download_dataset.py`
- [Blocked splits](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/create_blocked_splits.py): `src/evaluation/create_blocked_splits.py`
- [HTML feature cache](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/build_html_features_v2_cache.py): `src/evaluation/build_html_features_v2_cache.py`
- [Training data](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase4_data.py): `src/evaluation/phase4_data.py`
- [SVM baselines](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/evaluate_svm_blocked.py): `src/evaluation/evaluate_svm_blocked.py`
- [Tree tuning](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase4_boosting.py): `src/evaluation/phase4_boosting.py`
- [Text models](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase5_text.py): `src/evaluation/phase5_text.py`
- [OOF stacking](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase6_stacking.py): `src/evaluation/phase6_stacking.py`
- [Calibration](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/phase7_calibration.py): `src/evaluation/phase7_calibration.py`
- [Benchmark evaluation](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/evaluation/evaluate_url_html_official.py): `src/evaluation/evaluate_url_html_official.py`

### Threat intelligence

- [Safe Browsing lookup](https://github.com/chaithanyabs441-ux/phishing-website-detector/blob/main/src/reputation/google_safe_browsing.py): `src/reputation/google_safe_browsing.py`

### Other components

- **Analyst**
- **Google Safe Browsing**

## Connections

- Analyst → Scan API: submits scan (evidence: `README.md`)
- Scan API → Request guards: validates request (evidence: `webapp/app.py`)
- Scan API → Safe HTML fetch: optionally fetches (evidence: `webapp/app.py`)
- Scan API → URL features: extracts features (evidence: `webapp/app.py`)
- Scan API → HTML features: parses HTML (evidence: `webapp/app.py`)
- Scan API → Model registry: requests prediction (evidence: `webapp/app.py`)
- Model registry → Triage verdict: returns model score (evidence: `README.md`)
- Scan API → Safe Browsing lookup: checks URL (evidence: `webapp/app.py`)
- Safe Browsing lookup → Google Safe Browsing: queries threat list (evidence: `src/reputation/google_safe_browsing.py`)
- Scan API → Triage verdict: renders triage (evidence: `README.md`)
- Triage verdict → Analyst: presents signal (evidence: `README.md`)
- Dataset download → Blocked splits: provides shards (evidence: `README.md`)
- Blocked splits → SVM baselines: defines holdout (evidence: `README.md`)
- HTML feature cache → Training data: supplies HTML cache (evidence: `src/evaluation/phase4_data.py`)
- URL features → Training data: computes URL inputs (evidence: `src/evaluation/phase4_data.py`)
- Training data → Tree tuning: loads model data (evidence: `src/evaluation/phase4_data.py`)
- SVM baselines → Text models: baseline comparison (evidence: `README.md`)
- Tree tuning → Text models: model comparison (evidence: `README.md`)
- Text models → OOF stacking: provides stack inputs (evidence: `README.md`)
- OOF stacking → Calibration: provides OOF scores (evidence: `README.md`)
- Tree tuning → Calibration: selects finalist (evidence: `README.md`)
- Benchmark evaluation → URL features: uses shared features (evidence: `src/evaluation/evaluate_url_html_official.py`)
- Benchmark evaluation → HTML features: uses HTML features (evidence: `src/evaluation/evaluate_url_html_official.py`)
