# dilesh591/ai-phishing-detection-engine- architecture

> Architecture diagram of the GitHub repository dilesh591/ai-phishing-detection-engine-, 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/dilesh591/ai-phishing-detection-engine-
- Repository: https://github.com/dilesh591/ai-phishing-detection-engine-

## Overview

The repository contains two distinct interfaces: the README-described phishing inspector in `app.py` and a separate local binary scanner in `gui_ver.py`. The phishing workflow accepts email and URL input, analyzes signals, optionally fingerprints a live site, and presents risk and MITRE results. The README documents several capabilities whose implementation is in omitted portions of `app.py`; those links are cited to the README. The sampled `gui_ver.py` instead hashes uploaded files, checks byte-string patterns, and records scan history. `index.html` and `url_model.zip` are not described by the available evidence, so their roles and connections are omitted.

Main entry points: [`app.py`](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py) (Email and URL scan), [`gui_ver.py`](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.py) (Desktop scanner UI), [`email_model.pkl`](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/email_model.pkl) (Email classifier), [`email_vec.pkl`](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/email_vec.pkl) (Email vectorizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_phishing["Phishing analysis"]
  node_scan["Email and URL scan<br/>[app.py]"]
  node_email_model["Email classifier<br/>[email_model.pkl]"]
  node_email_vectorizer["Email vectorizer<br/>[email_vec.pkl]"]
  node_url_analysis["URL analysis<br/>[app.py]"]
  node_heuristics["Heuristic signals<br/>[app.py]"]
  node_risk["Risk scoring<br/>[app.py]"]
end

subgraph group_intel["Threat intelligence"]
  node_fingerprint["Website fingerprinting<br/>[app.py]"]
  node_mitre["MITRE mapping<br/>[app.py]"]
end

subgraph group_phishing_ui["Phishing interface"]
  node_phishing_ui["Streamlit dashboard<br/>[app.py]"]
  node_results["Scan results and history<br/>[app.py]"]
  node_bulk["Bulk URL scan<br/>[app.py]"]
end

subgraph group_binary["Binary scanner"]
  node_binary_ui["Desktop scanner UI<br/>[gui_ver.py]"]
  node_local_scanner["LocalScanner<br/>[gui_ver.py]"]
  node_scan_db[("Scan history database<br/>[gui_ver.py]")]
  node_history_view["Recent scans<br/>[gui_ver.py]"]
end

node_analyst(("Analyst"))
node_website["Target website"]
node_whois["WHOIS lookup"]
node_file_user(("File uploader"))

node_analyst -->|"provides input"| node_phishing_ui
node_phishing_ui -->|"invokes scan"| node_scan
node_scan -->|"scores email"| node_email_model
node_scan -->|"vectorizes email"| node_email_vectorizer
node_scan -->|"analyzes URL"| node_url_analysis
node_scan -->|"falls back to"| node_heuristics
node_scan -->|"combines scores"| node_risk
node_scan -->|"optionally runs"| node_fingerprint
node_fingerprint -->|"fetches page"| node_website
node_fingerprint -.->|"checks domain age"| node_whois
node_scan -->|"maps signals"| node_mitre
node_phishing_ui -->|"renders findings"| node_results
node_phishing_ui -->|"offers bulk scans"| node_bulk
node_analyst -->|"uploads file"| node_binary_ui
node_binary_ui -->|"creates and runs"| node_local_scanner
node_local_scanner -->|"returns findings"| node_binary_ui
node_binary_ui -->|"writes scan record"| node_scan_db
node_binary_ui -->|"renders recent scans"| node_history_view
node_history_view -->|"reads recent records"| node_scan_db

click node_phishing_ui "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_scan "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_email_model "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/email_model.pkl"
click node_email_vectorizer "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/email_vec.pkl"
click node_url_analysis "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_heuristics "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_risk "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_fingerprint "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_mitre "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_results "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_bulk "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py"
click node_binary_ui "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.py"
click node_local_scanner "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.py"
click node_scan_db "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.py"
click node_history_view "https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.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_scan,node_email_model,node_email_vectorizer,node_url_analysis,node_heuristics,node_risk toneBlue
class node_fingerprint,node_mitre toneAmber
class node_phishing_ui,node_results,node_bulk toneMint
class node_binary_ui,node_local_scanner,node_scan_db,node_history_view toneRose
class node_analyst,node_website,node_whois,node_file_user toneIndigo
```

## Components

### Phishing analysis

- [Email and URL scan](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`
- [Email classifier](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/email_model.pkl): `email_model.pkl`
- [Email vectorizer](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/email_vec.pkl): `email_vec.pkl`
- [URL analysis](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`
- [Heuristic signals](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`
- [Risk scoring](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`

### Threat intelligence

- [Website fingerprinting](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`
- [MITRE mapping](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`

### Phishing interface

- [Streamlit dashboard](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`
- [Scan results and history](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`
- [Bulk URL scan](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/app.py): `app.py`

### Binary scanner

- [Desktop scanner UI](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.py): `gui_ver.py`
- [LocalScanner](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.py): `gui_ver.py`
- [Scan history database](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.py): `gui_ver.py`
- [Recent scans](https://github.com/dilesh591/ai-phishing-detection-engine-/blob/main/gui_ver.py): `gui_ver.py`

### Other components

- **Analyst**
- **Target website**
- **WHOIS lookup**
- **File uploader**

## Connections

- Analyst → Streamlit dashboard: provides input (evidence: `README.md`)
- Streamlit dashboard → Email and URL scan: invokes scan (evidence: `README.md`)
- Email and URL scan → Email classifier: scores email (evidence: `README.md`)
- Email and URL scan → Email vectorizer: vectorizes email (evidence: `README.md`)
- Email and URL scan → URL analysis: analyzes URL (evidence: `README.md`)
- Email and URL scan → Heuristic signals: falls back to (evidence: `README.md`)
- Email and URL scan → Risk scoring: combines scores (evidence: `README.md`)
- Email and URL scan → Website fingerprinting: optionally runs (evidence: `README.md`)
- Website fingerprinting → Target website: fetches page (evidence: `app.py`)
- Website fingerprinting → WHOIS lookup: checks domain age (evidence: `README.md`)
- Email and URL scan → MITRE mapping: maps signals (evidence: `README.md`)
- Streamlit dashboard → Scan results and history: renders findings (evidence: `README.md`)
- Streamlit dashboard → Bulk URL scan: offers bulk scans (evidence: `README.md`)
- Analyst → Desktop scanner UI: uploads file (evidence: `gui_ver.py`)
- Desktop scanner UI → LocalScanner: creates and runs (evidence: `gui_ver.py`)
- LocalScanner → Desktop scanner UI: returns findings (evidence: `gui_ver.py`)
- Desktop scanner UI → Scan history database: writes scan record (evidence: `gui_ver.py`)
- Desktop scanner UI → Recent scans: renders recent scans (evidence: `gui_ver.py`)
- Recent scans → Scan history database: reads recent records (evidence: `gui_ver.py`)
