# rakesh-dogga/phishing-detection-project architecture

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

- Interactive diagram: https://gitdiagram.com/rakesh-dogga/phishing-detection-project
- Repository: https://github.com/rakesh-dogga/phishing-detection-project

## Overview

This Flask application accepts a URL and model choice, extracts URL characteristics, predicts phishing risk, and presents results, confidence, security indicators, WHOIS details, and model metrics. Users can compare Decision Tree and Random Forest predictions. A separate data-preparation and training path builds the feature dataset, trains/evaluates both models, and saves their artifacts and metrics. The sampled source supports the main calls and reads; some template interactions and validation details are documented but not shown in the excerpts.

Main entry points: [`app.py`](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/app.py) (Flask request handler), [`model.py`](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/model.py) (Model training and evaluation), [`static/style.css`](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/static/style.css) (Web styling), [`convert_dataset.py`](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/convert_dataset.py) (Dataset conversion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_flask["Flask request handler<br/>[app.py]"]
  node_home["URL input page<br/>[index.html]"]
  node_result["Prediction results<br/>[result.html]"]
  node_comparison["Model comparison<br/>[comparison.html]"]
  node_styles["Web styling<br/>[style.css]"]
end

subgraph group_analysis["URL analysis"]
  node_extractor["URL feature extraction<br/>[features.py]"]
  node_security["Security indicators<br/>[app.py]"]
  node_whois["Domain registration lookup<br/>[whois_utils.py]"]
end

subgraph group_models["Models and metrics"]
  node_dt_model["Decision Tree model<br/>[dt_model.pkl]"]
  node_rf_model["Random Forest model<br/>[rf_model.pkl]"]
  node_metrics["Model metrics<br/>[accuracy.txt]"]
end

subgraph group_training["Dataset and training"]
  node_dataset_builder["Dataset conversion<br/>[convert_dataset.py]"]
  node_dataset["Feature dataset"]
  node_trainer["Model training and evaluation<br/>[model.py]"]
end

node_user(("URL tester"))
node_whois_service["WHOIS service"]

node_user -->|"submits URL"| node_flask
node_flask -->|"renders home"| node_home
node_flask -->|"extracts features"| node_extractor
node_flask -->|"requests domain data"| node_whois
node_whois -->|"queries WHOIS"| node_whois_service
node_flask -->|"loads and predicts"| node_dt_model
node_flask -->|"loads and predicts"| node_rf_model
node_flask -->|"reads metrics"| node_metrics
node_flask -->|"assesses indicators"| node_security
node_flask -->|"renders result"| node_result
node_flask -->|"renders comparison"| node_comparison
node_styles -.->|"styles page"| node_home
node_styles -.->|"styles page"| node_result
node_styles -.->|"styles page"| node_comparison
node_dataset_builder -->|"extracts dataset features"| node_extractor
node_dataset_builder -->|"writes dataset"| node_dataset
node_trainer -->|"reads dataset"| node_dataset
node_trainer -->|"saves model"| node_dt_model
node_trainer -->|"saves model"| node_rf_model
node_trainer -->|"writes metrics"| node_metrics

click node_flask "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/app.py"
click node_home "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/templates/index.html"
click node_result "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/templates/result.html"
click node_comparison "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/templates/comparison.html"
click node_styles "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/static/style.css"
click node_extractor "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/features.py"
click node_security "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/app.py"
click node_whois "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/whois_utils.py"
click node_dt_model "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/dt_model.pkl"
click node_rf_model "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/rf_model.pkl"
click node_metrics "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/accuracy.txt"
click node_dataset_builder "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/convert_dataset.py"
click node_trainer "https://github.com/rakesh-dogga/phishing-detection-project/blob/master/model.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_flask,node_home,node_result,node_comparison,node_styles toneBlue
class node_extractor,node_security,node_whois toneAmber
class node_dt_model,node_rf_model,node_metrics toneMint
class node_dataset_builder,node_dataset,node_trainer toneRose
class node_user,node_whois_service toneIndigo
```

## Components

### Web experience

- [Flask request handler](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/app.py): `app.py`
- [URL input page](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/templates/index.html): `templates/index.html`
- [Prediction results](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/templates/result.html): `templates/result.html`
- [Model comparison](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/templates/comparison.html): `templates/comparison.html`
- [Web styling](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/static/style.css): `static/style.css`

### URL analysis

- [URL feature extraction](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/features.py): `features.py`
- [Security indicators](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/app.py): `app.py`
- [Domain registration lookup](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/whois_utils.py): `whois_utils.py`

### Models and metrics

- [Decision Tree model](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/dt_model.pkl): `dt_model.pkl`
- [Random Forest model](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/rf_model.pkl): `rf_model.pkl`
- [Model metrics](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/accuracy.txt): `accuracy.txt`

### Dataset and training

- [Dataset conversion](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/convert_dataset.py): `convert_dataset.py`
- **Feature dataset**
- [Model training and evaluation](https://github.com/rakesh-dogga/phishing-detection-project/blob/master/model.py): `model.py`

### Other components

- **URL tester**
- **WHOIS service**

## Connections

- URL tester → Flask request handler: submits URL (evidence: `README.md`)
- Flask request handler → URL input page: renders home (evidence: `app.py`)
- Flask request handler → URL feature extraction: extracts features (evidence: `app.py`)
- Flask request handler → Domain registration lookup: requests domain data (evidence: `app.py`)
- Domain registration lookup → WHOIS service: queries WHOIS (evidence: `whois_utils.py`)
- Flask request handler → Decision Tree model: loads and predicts (evidence: `app.py`)
- Flask request handler → Random Forest model: loads and predicts (evidence: `app.py`)
- Flask request handler → Model metrics: reads metrics (evidence: `app.py`)
- Flask request handler → Security indicators: assesses indicators (evidence: `app.py`)
- Flask request handler → Prediction results: renders result (evidence: `README.md`)
- Flask request handler → Model comparison: renders comparison (evidence: `app.py`)
- Web styling → URL input page: styles page
- Web styling → Prediction results: styles page
- Web styling → Model comparison: styles page
- Dataset conversion → URL feature extraction: extracts dataset features (evidence: `convert_dataset.py`)
- Dataset conversion → Feature dataset: writes dataset (evidence: `convert_dataset.py`)
- Model training and evaluation → Feature dataset: reads dataset (evidence: `model.py`)
- Model training and evaluation → Decision Tree model: saves model (evidence: `model.py`)
- Model training and evaluation → Random Forest model: saves model (evidence: `model.py`)
- Model training and evaluation → Model metrics: writes metrics (evidence: `model.py`)
