# elceef/dnstwist architecture

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

- Interactive diagram: https://gitdiagram.com/elceef/dnstwist
- Repository: https://github.com/elceef/dnstwist

## Overview

dnstwist is a domain-lookalike and threat-intelligence scanner: a user supplies a domain, the tool generates permutations, checks them through DNS, and presents or exports scan results. Optional analysis adds GeoIP, rogue-MX checks, HTML fuzzy-hash comparison, and screenshot perceptual hashes. The web app wraps the scanner in managed scan sessions and HTTP endpoints. Core scanner internals were not sampled, so their decomposition and links rely on README statements; the web-app links are visible in its source.

Main entry points: [`webapp/webapp.py`](https://github.com/elceef/dnstwist/blob/master/webapp/webapp.py) (Scan session), [`dnstwist.py`](https://github.com/elceef/dnstwist/blob/master/dnstwist.py) (Domain fuzzer), [`webapp/webapp.html`](https://github.com/elceef/dnstwist/blob/master/webapp/webapp.html) (Web interface), [`dictionaries`](https://github.com/elceef/dnstwist/tree/master/dictionaries) (Word and TLD lists)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scan["Domain scanning"]
  node_cli_api["CLI and API<br/>[dnstwist.py]"]
  node_url["URL parsing<br/>[dnstwist.py]"]
  node_fuzzer["Domain fuzzer<br/>[dnstwist.py]"]
  node_algorithms["Fuzz algorithms<br/>[dnstwist.py]"]
  node_workers["Scan workers<br/>[dnstwist.py]"]
  node_dns["DNS lookups<br/>[dnstwist.py]"]
end

subgraph group_analysis["Threat analysis"]
  node_mx["Rogue MX checks<br/>[dnstwist.py]"]
  node_geoip["GeoIP lookup<br/>[dnstwist.py]"]
  node_http_fetch["Webpage fetch<br/>[dnstwist.py]"]
  node_html_hash["HTML similarity<br/>[dnstwist.py]"]
  node_screenshot["Screenshot capture<br/>[dnstwist.py]"]
  node_visual_hash["Visual similarity<br/>[dnstwist.py]"]
end

subgraph group_output["Results"]
  node_formatter["Result formatting<br/>[dnstwist.py]"]
end

subgraph group_web["Web application"]
  node_web_ui["Web interface<br/>[webapp.html]"]
  node_web_api["Scan API<br/>[webapp.py]"]
  node_session["Scan session<br/>[webapp.py]"]
end

subgraph group_data["Permutation data"]
  node_dictionaries["Word and TLD lists"]
end

node_user(("User"))
node_dns_service(("DNS resolvers"))
node_geoip_data[("GeoIP database")]
node_web_sites(("Candidate websites"))
node_browser["Chromium"]
node_web_client(("Browser user"))

node_user -->|"provides domain"| node_cli_api
node_cli_api -->|"parses input"| node_url
node_url -->|"supplies domain"| node_fuzzer
node_fuzzer -->|"generates variants"| node_algorithms
node_fuzzer -->|"uses word lists"| node_dictionaries
node_fuzzer -->|"distributes variants"| node_workers
node_workers -->|"checks domains"| node_dns
node_dns -->|"queries"| node_dns_service
node_dns -->|"checks mail hosts"| node_mx
node_dns -->|"locates addresses"| node_geoip
node_geoip -->|"reads database"| node_geoip_data
node_workers -->|"fetches pages"| node_http_fetch
node_http_fetch -->|"requests pages"| node_web_sites
node_http_fetch -.->|"compares content"| node_html_hash
node_http_fetch -.->|"captures pages"| node_screenshot
node_screenshot -.->|"uses headless mode"| node_browser
node_screenshot -.->|"produces image"| node_visual_hash
node_cli_api -->|"formats results"| node_formatter
node_formatter -->|"exports results"| node_user
node_web_client -.->|"uses interface"| node_web_ui
node_web_ui -.->|"requests scans"| node_web_api
node_web_api -->|"creates session"| node_session
node_session -->|"parses URL"| node_url
node_session -->|"generates variants"| node_fuzzer
node_session -->|"starts workers"| node_workers
node_session -->|"formats exports"| node_formatter
node_web_api -->|"serves status and results"| node_session

click node_cli_api "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_url "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_fuzzer "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_algorithms "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_dictionaries "https://github.com/elceef/dnstwist/tree/master/dictionaries"
click node_workers "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_dns "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_mx "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_geoip "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_http_fetch "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_html_hash "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_screenshot "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_visual_hash "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_formatter "https://github.com/elceef/dnstwist/blob/master/dnstwist.py"
click node_web_ui "https://github.com/elceef/dnstwist/blob/master/webapp/webapp.html"
click node_web_api "https://github.com/elceef/dnstwist/blob/master/webapp/webapp.py"
click node_session "https://github.com/elceef/dnstwist/blob/master/webapp/webapp.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_cli_api,node_url,node_fuzzer,node_algorithms,node_workers,node_dns,node_user,node_web_client toneBlue
class node_mx,node_geoip,node_http_fetch,node_html_hash,node_screenshot,node_visual_hash,node_geoip_data toneAmber
class node_formatter toneMint
class node_web_ui,node_web_api,node_session toneRose
class node_dictionaries,node_dns_service,node_web_sites,node_browser toneIndigo
```

## Components

### Domain scanning

- [CLI and API](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [URL parsing](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [Domain fuzzer](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [Fuzz algorithms](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [Scan workers](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [DNS lookups](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`

### Threat analysis

- [Rogue MX checks](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [GeoIP lookup](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [Webpage fetch](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [HTML similarity](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [Screenshot capture](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`
- [Visual similarity](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`

### Results

- [Result formatting](https://github.com/elceef/dnstwist/blob/master/dnstwist.py): `dnstwist.py`

### Web application

- [Web interface](https://github.com/elceef/dnstwist/blob/master/webapp/webapp.html): `webapp/webapp.html`
- [Scan API](https://github.com/elceef/dnstwist/blob/master/webapp/webapp.py): `webapp/webapp.py`
- [Scan session](https://github.com/elceef/dnstwist/blob/master/webapp/webapp.py): `webapp/webapp.py`

### Permutation data

- [Word and TLD lists](https://github.com/elceef/dnstwist/tree/master/dictionaries): `dictionaries`

### Other components

- **User**
- **DNS resolvers**
- **GeoIP database**
- **Candidate websites**
- **Chromium**
- **Browser user**

## Connections

- User → CLI and API: provides domain (evidence: `README.md`)
- CLI and API → URL parsing: parses input (evidence: `README.md`)
- URL parsing → Domain fuzzer: supplies domain (evidence: `README.md`)
- Domain fuzzer → Fuzz algorithms: generates variants (evidence: `README.md`)
- Domain fuzzer → Word and TLD lists: uses word lists (evidence: `README.md`)
- Domain fuzzer → Scan workers: distributes variants (evidence: `README.md`)
- Scan workers → DNS lookups: checks domains (evidence: `README.md`)
- DNS lookups → DNS resolvers: queries (evidence: `README.md`)
- DNS lookups → Rogue MX checks: checks mail hosts (evidence: `README.md`)
- DNS lookups → GeoIP lookup: locates addresses (evidence: `README.md`)
- GeoIP lookup → GeoIP database: reads database (evidence: `README.md`)
- Scan workers → Webpage fetch: fetches pages (evidence: `README.md`)
- Webpage fetch → Candidate websites: requests pages (evidence: `README.md`)
- Webpage fetch → HTML similarity: compares content (evidence: `README.md`)
- Webpage fetch → Screenshot capture: captures pages (evidence: `README.md`)
- Screenshot capture → Chromium: uses headless mode (evidence: `README.md`)
- Screenshot capture → Visual similarity: produces image (evidence: `README.md`)
- CLI and API → Result formatting: formats results (evidence: `README.md`)
- Result formatting → User: exports results (evidence: `README.md`)
- Browser user → Web interface: uses interface
- Web interface → Scan API: requests scans
- Scan API → Scan session: creates session (evidence: `webapp/webapp.py`)
- Scan session → URL parsing: parses URL (evidence: `webapp/webapp.py`)
- Scan session → Domain fuzzer: generates variants (evidence: `webapp/webapp.py`)
- Scan session → Scan workers: starts workers (evidence: `webapp/webapp.py`)
- Scan session → Result formatting: formats exports (evidence: `webapp/webapp.py`)
- Scan API → Scan session: serves status and results (evidence: `webapp/webapp.py`)
