# kgretzky/evilginx2 architecture

> Architecture diagram of the GitHub repository kgretzky/evilginx2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kgretzky/evilginx2
- Repository: https://github.com/kgretzky/evilginx2

## Overview

Evilginx is a Go-based reverse-proxy phishing framework. Its principal workflow starts with an operator configuring a site and phishlet, then serving DNS/TLS and proxy traffic; the proxy tracks authentication material in sessions, with persistence available through the database. The graph also preserves the command/help interface, blacklist, ACME HTTP endpoint, and documented Gophish integration. Several connections are supported by excerpts or the README; unsampled implementation details are not inferred.

Main entry points: [`main.go`](https://github.com/kgretzky/evilginx2/blob/master/main.go) (Application startup), [`core/terminal.go`](https://github.com/kgretzky/evilginx2/blob/master/core/terminal.go) (Command terminal), [`core/http_proxy.go`](https://github.com/kgretzky/evilginx2/blob/master/core/http_proxy.go) (Reverse proxy), [`core/config.go`](https://github.com/kgretzky/evilginx2/blob/master/core/config.go) (Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Operator control"]
  node_main["Application startup<br/>[main.go]"]
  node_terminal["Command terminal<br/>[terminal.go]"]
  node_help["Command help<br/>[help.go]"]
  node_parser["Input parser<br/>[parser.go]"]
  node_gophish["Gophish integration<br/>[gophish.go]"]
end

subgraph group_site_setup["Site setup"]
  node_config["Configuration<br/>[config.go]"]
  node_phishlet["Phishlet definitions<br/>[phishlet.go]"]
  node_blacklist["IP blacklist<br/>[blacklist.go]"]
end

subgraph group_traffic["Traffic handling"]
  node_dns["DNS server<br/>[nameserver.go]"]
  node_certificates["Certificate manager<br/>[certdb.go]"]
  node_acme_http["ACME HTTP endpoint<br/>[http_server.go]"]
  node_proxy["Reverse proxy<br/>[http_proxy.go]"]
end

subgraph group_state["Session and storage"]
  node_session["Authentication session<br/>[session.go]"]
  node_database[("Persistent database<br/>[database.go]")]
  node_db_sessions["Session persistence<br/>[db_session.go]"]
end

node_operator(("Operator"))
node_browser(("Browser"))
node_site(("Upstream website"))

node_operator -->|"starts"| node_main
node_main -->|"initializes"| node_config
node_main -->|"opens"| node_database
node_main -->|"loads"| node_phishlet
node_main -->|"starts"| node_dns
node_main -->|"initializes"| node_certificates
node_main -->|"starts"| node_proxy
node_main -->|"starts"| node_terminal
node_operator -->|"configures"| node_terminal
node_terminal -->|"updates"| node_config
node_terminal -->|"registers commands"| node_help
node_terminal -->|"uses"| node_parser
node_terminal -->|"tests connection"| node_gophish
node_config -->|"loads definitions"| node_phishlet
node_config -->|"supplies settings"| node_dns
node_certificates -->|"reads settings"| node_config
node_certificates -->|"uses nameserver"| node_dns
node_browser -->|"sends requests"| node_proxy
node_proxy -->|"forwards requests"| node_site
node_proxy -->|"tracks tokens"| node_session
node_proxy -->|"uses storage"| node_database
node_database -->|"persists sessions"| node_db_sessions
node_proxy -.->|"checks addresses"| node_blacklist
node_certificates -.->|"serves challenges"| node_acme_http

click node_main "https://github.com/kgretzky/evilginx2/blob/master/main.go"
click node_terminal "https://github.com/kgretzky/evilginx2/blob/master/core/terminal.go"
click node_help "https://github.com/kgretzky/evilginx2/blob/master/core/help.go"
click node_parser "https://github.com/kgretzky/evilginx2/blob/master/parser/parser.go"
click node_config "https://github.com/kgretzky/evilginx2/blob/master/core/config.go"
click node_phishlet "https://github.com/kgretzky/evilginx2/blob/master/core/phishlet.go"
click node_blacklist "https://github.com/kgretzky/evilginx2/blob/master/core/blacklist.go"
click node_dns "https://github.com/kgretzky/evilginx2/blob/master/core/nameserver.go"
click node_certificates "https://github.com/kgretzky/evilginx2/blob/master/core/certdb.go"
click node_acme_http "https://github.com/kgretzky/evilginx2/blob/master/core/http_server.go"
click node_proxy "https://github.com/kgretzky/evilginx2/blob/master/core/http_proxy.go"
click node_session "https://github.com/kgretzky/evilginx2/blob/master/core/session.go"
click node_database "https://github.com/kgretzky/evilginx2/blob/master/database/database.go"
click node_db_sessions "https://github.com/kgretzky/evilginx2/blob/master/database/db_session.go"
click node_gophish "https://github.com/kgretzky/evilginx2/blob/master/core/gophish.go"

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_main,node_terminal,node_help,node_parser,node_gophish,node_browser toneBlue
class node_config,node_phishlet,node_blacklist toneAmber
class node_dns,node_certificates,node_acme_http,node_proxy toneMint
class node_session,node_database,node_db_sessions toneRose
class node_operator,node_site toneIndigo
```

## Components

### Operator control

- [Application startup](https://github.com/kgretzky/evilginx2/blob/master/main.go): `main.go`
- [Command terminal](https://github.com/kgretzky/evilginx2/blob/master/core/terminal.go): `core/terminal.go`
- [Command help](https://github.com/kgretzky/evilginx2/blob/master/core/help.go): `core/help.go`
- [Input parser](https://github.com/kgretzky/evilginx2/blob/master/parser/parser.go): `parser/parser.go`
- [Gophish integration](https://github.com/kgretzky/evilginx2/blob/master/core/gophish.go): `core/gophish.go`

### Site setup

- [Configuration](https://github.com/kgretzky/evilginx2/blob/master/core/config.go): `core/config.go`
- [Phishlet definitions](https://github.com/kgretzky/evilginx2/blob/master/core/phishlet.go): `core/phishlet.go`
- [IP blacklist](https://github.com/kgretzky/evilginx2/blob/master/core/blacklist.go): `core/blacklist.go`

### Traffic handling

- [DNS server](https://github.com/kgretzky/evilginx2/blob/master/core/nameserver.go): `core/nameserver.go`
- [Certificate manager](https://github.com/kgretzky/evilginx2/blob/master/core/certdb.go): `core/certdb.go`
- [ACME HTTP endpoint](https://github.com/kgretzky/evilginx2/blob/master/core/http_server.go): `core/http_server.go`
- [Reverse proxy](https://github.com/kgretzky/evilginx2/blob/master/core/http_proxy.go): `core/http_proxy.go`

### Session and storage

- [Authentication session](https://github.com/kgretzky/evilginx2/blob/master/core/session.go): `core/session.go`
- [Persistent database](https://github.com/kgretzky/evilginx2/blob/master/database/database.go): `database/database.go`
- [Session persistence](https://github.com/kgretzky/evilginx2/blob/master/database/db_session.go): `database/db_session.go`

### Other components

- **Operator**
- **Browser**
- **Upstream website**

## Connections

- Operator → Application startup: starts (evidence: `README.md`)
- Application startup → Configuration: initializes (evidence: `main.go`)
- Application startup → Persistent database: opens (evidence: `main.go`)
- Application startup → Phishlet definitions: loads (evidence: `main.go`)
- Application startup → DNS server: starts (evidence: `main.go`)
- Application startup → Certificate manager: initializes (evidence: `main.go`)
- Application startup → Reverse proxy: starts (evidence: `main.go`)
- Application startup → Command terminal: starts (evidence: `main.go`)
- Operator → Command terminal: configures (evidence: `README.md`)
- Command terminal → Configuration: updates (evidence: `core/terminal.go`)
- Command terminal → Command help: registers commands (evidence: `core/terminal.go`)
- Command terminal → Input parser: uses (evidence: `core/terminal.go`)
- Command terminal → Gophish integration: tests connection (evidence: `core/terminal.go`)
- Configuration → Phishlet definitions: loads definitions
- Configuration → DNS server: supplies settings (evidence: `core/nameserver.go`)
- Certificate manager → Configuration: reads settings (evidence: `core/certdb.go`)
- Certificate manager → DNS server: uses nameserver (evidence: `core/certdb.go`)
- Browser → Reverse proxy: sends requests (evidence: `README.md`)
- Reverse proxy → Upstream website: forwards requests (evidence: `README.md`)
- Reverse proxy → Authentication session: tracks tokens (evidence: `core/http_proxy.go`)
- Reverse proxy → Persistent database: uses storage (evidence: `core/http_proxy.go`)
- Persistent database → Session persistence: persists sessions (evidence: `database/db_session.go`)
- Reverse proxy → IP blacklist: checks addresses
- Certificate manager → ACME HTTP endpoint: serves challenges
