# zeroq/amun architecture

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

- Interactive diagram: https://gitdiagram.com/zeroq/amun
- Repository: https://github.com/zeroq/amun

## Overview

Amun is a Python low-interaction honeypot that emulates vulnerable network services to observe exploit attempts and malware downloads. Its main workflow accepts network traffic, routes connection data through vulnerability emulation, recognizes shellcode or download behavior, and records or submits collected results. The README also describes offline shellcode analysis and configurable logging/submission plugins. The excerpts establish several core calls; plugin dispatch and some subsystem wiring are not shown, so those relationships are omitted or marked unverified.

Main entry points: [`amun_server.py`](https://github.com/zeroq/amun/blob/master/amun_server.py) (Server and listeners), [`core/download_core.py`](https://github.com/zeroq/amun/blob/master/core/download_core.py) (Download handling), [`core/amun_logging.py`](https://github.com/zeroq/amun/blob/master/core/amun_logging.py) (Logging core), [`core/amun_request_handler.py`](https://github.com/zeroq/amun/blob/master/core/amun_request_handler.py) (Connection handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Honeypot runtime"]
  node_server["Server and listeners<br/>[amun_server.py]"]
  node_handler["Connection handler"]
  node_config["Configuration parser"]
end

subgraph group_emulation["Protocol emulation"]
  node_bindport["Bind-port emulation"]
  node_smb_protocol["SMB protocol engine<br/>[amun_smb_core.py]"]
  node_vuln_modules["Vulnerability emulators"]
  node_http_vuln["HTTP emulator<br/>[http_modul.py]"]
  node_dcom_vuln["DCOM emulator<br/>[dcom_modul.py]"]
  node_wins_vuln["WINS emulator<br/>[wins_modul.py]"]
end

subgraph group_collection["Analysis and downloads"]
  node_decoder_patterns["Shellcode patterns<br/>[decoders.py]"]
  node_shell_manager["Shellcode analysis"]
  node_ip_ranges["Local IP ranges<br/>[iprange.py]"]
  node_download_manager["Download handling<br/>[download_core.py]"]
  node_ftp_download["FTP downloads"]
  node_tftp_download["TFTP downloads"]
end

subgraph group_outputs["Logging and reporting"]
  node_logger["Logging core<br/>[amun_logging.py]"]
  node_log_plugins["Logging plugins"]
  node_submit_plugins["Submission plugins"]
  node_sarcophagus[("Sarcophagus database<br/>[log_sarcophagus.py]")]
  node_mysql_log[("MySQL logging<br/>[log_mysql.py]")]
  node_hpfeeds["HPFeeds reporting<br/>[log_hpfeeds.py]"]
end

node_attacker(("Network attacker"))

node_attacker -->|"connects to"| node_server
node_server -->|"dispatches connections"| node_handler
node_server -->|"loads patterns"| node_decoder_patterns
node_server -.->|"uses configuration"| node_config
node_server -.->|"starts listeners"| node_bindport
node_handler -->|"analyzes payload"| node_shell_manager
node_handler -->|"handles downloads"| node_download_manager
node_handler -.->|"dispatches stages"| node_vuln_modules
node_download_manager -->|"uses analysis"| node_shell_manager
node_download_manager -->|"logs activity"| node_logger
node_download_manager -.->|"delegates FTP"| node_ftp_download
node_download_manager -.->|"delegates TFTP"| node_tftp_download
node_bindport -->|"analyzes payload"| node_shell_manager
node_bindport -->|"logs activity"| node_logger
node_smb_protocol -->|"supports emulation"| node_wins_vuln
node_http_vuln -->|"logs activity"| node_logger
node_dcom_vuln -.->|"implements stage"| node_vuln_modules
node_logger -.->|"feeds events"| node_log_plugins
node_logger -.->|"feeds samples"| node_submit_plugins
node_log_plugins -.->|"includes backend"| node_sarcophagus
node_log_plugins -.->|"includes backend"| node_mysql_log
node_log_plugins -.->|"includes reporter"| node_hpfeeds
node_shell_manager -.->|"checks local ranges"| node_ip_ranges

click node_server "https://github.com/zeroq/amun/blob/master/amun_server.py"
click node_handler "https://github.com/zeroq/amun/blob/master/core/amun_request_handler.py"
click node_config "https://github.com/zeroq/amun/blob/master/core/amun_config_parser.py"
click node_decoder_patterns "https://github.com/zeroq/amun/blob/master/shellcodes/decoders.py"
click node_shell_manager "https://github.com/zeroq/amun/blob/master/core/shellcode_mgr_core.py"
click node_ip_ranges "https://github.com/zeroq/amun/blob/master/core/iprange.py"
click node_download_manager "https://github.com/zeroq/amun/blob/master/core/download_core.py"
click node_ftp_download "https://github.com/zeroq/amun/blob/master/core/ftp_download_core.py"
click node_tftp_download "https://github.com/zeroq/amun/blob/master/core/tftp_download_core.py"
click node_bindport "https://github.com/zeroq/amun/blob/master/core/amun_bindport_core.py"
click node_smb_protocol "https://github.com/zeroq/amun/blob/master/core/amun_smb_core.py"
click node_vuln_modules "https://github.com/zeroq/amun/tree/master/vuln_modules"
click node_http_vuln "https://github.com/zeroq/amun/blob/master/vuln_modules/vuln-http/http_modul.py"
click node_dcom_vuln "https://github.com/zeroq/amun/blob/master/vuln_modules/vuln-dcom/dcom_modul.py"
click node_wins_vuln "https://github.com/zeroq/amun/blob/master/vuln_modules/vuln-wins/wins_modul.py"
click node_logger "https://github.com/zeroq/amun/blob/master/core/amun_logging.py"
click node_log_plugins "https://github.com/zeroq/amun/tree/master/log_modules"
click node_submit_plugins "https://github.com/zeroq/amun/tree/master/submit_modules"
click node_sarcophagus "https://github.com/zeroq/amun/blob/master/log_modules/log-sarcophagus/log_sarcophagus.py"
click node_mysql_log "https://github.com/zeroq/amun/blob/master/log_modules/log-mysql/log_mysql.py"
click node_hpfeeds "https://github.com/zeroq/amun/blob/master/log_modules/log-hpfeeds/log_hpfeeds.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_server,node_handler,node_config toneBlue
class node_bindport,node_smb_protocol,node_vuln_modules,node_http_vuln,node_dcom_vuln,node_wins_vuln toneAmber
class node_decoder_patterns,node_shell_manager,node_ip_ranges,node_download_manager,node_ftp_download,node_tftp_download toneMint
class node_logger,node_log_plugins,node_submit_plugins,node_sarcophagus,node_mysql_log,node_hpfeeds toneRose
class node_attacker toneIndigo
```

## Components

### Honeypot runtime

- [Server and listeners](https://github.com/zeroq/amun/blob/master/amun_server.py): `amun_server.py`
- [Connection handler](https://github.com/zeroq/amun/blob/master/core/amun_request_handler.py): `core/amun_request_handler.py`
- [Configuration parser](https://github.com/zeroq/amun/blob/master/core/amun_config_parser.py): `core/amun_config_parser.py`

### Protocol emulation

- [Bind-port emulation](https://github.com/zeroq/amun/blob/master/core/amun_bindport_core.py): `core/amun_bindport_core.py`
- [SMB protocol engine](https://github.com/zeroq/amun/blob/master/core/amun_smb_core.py): `core/amun_smb_core.py`
- [Vulnerability emulators](https://github.com/zeroq/amun/tree/master/vuln_modules): `vuln_modules`
- [HTTP emulator](https://github.com/zeroq/amun/blob/master/vuln_modules/vuln-http/http_modul.py): `vuln_modules/vuln-http/http_modul.py`
- [DCOM emulator](https://github.com/zeroq/amun/blob/master/vuln_modules/vuln-dcom/dcom_modul.py): `vuln_modules/vuln-dcom/dcom_modul.py`
- [WINS emulator](https://github.com/zeroq/amun/blob/master/vuln_modules/vuln-wins/wins_modul.py): `vuln_modules/vuln-wins/wins_modul.py`

### Analysis and downloads

- [Shellcode patterns](https://github.com/zeroq/amun/blob/master/shellcodes/decoders.py): `shellcodes/decoders.py`
- [Shellcode analysis](https://github.com/zeroq/amun/blob/master/core/shellcode_mgr_core.py): `core/shellcode_mgr_core.py`
- [Local IP ranges](https://github.com/zeroq/amun/blob/master/core/iprange.py): `core/iprange.py`
- [Download handling](https://github.com/zeroq/amun/blob/master/core/download_core.py): `core/download_core.py`
- [FTP downloads](https://github.com/zeroq/amun/blob/master/core/ftp_download_core.py): `core/ftp_download_core.py`
- [TFTP downloads](https://github.com/zeroq/amun/blob/master/core/tftp_download_core.py): `core/tftp_download_core.py`

### Logging and reporting

- [Logging core](https://github.com/zeroq/amun/blob/master/core/amun_logging.py): `core/amun_logging.py`
- [Logging plugins](https://github.com/zeroq/amun/tree/master/log_modules): `log_modules`
- [Submission plugins](https://github.com/zeroq/amun/tree/master/submit_modules): `submit_modules`
- [Sarcophagus database](https://github.com/zeroq/amun/blob/master/log_modules/log-sarcophagus/log_sarcophagus.py): `log_modules/log-sarcophagus/log_sarcophagus.py`
- [MySQL logging](https://github.com/zeroq/amun/blob/master/log_modules/log-mysql/log_mysql.py): `log_modules/log-mysql/log_mysql.py`
- [HPFeeds reporting](https://github.com/zeroq/amun/blob/master/log_modules/log-hpfeeds/log_hpfeeds.py): `log_modules/log-hpfeeds/log_hpfeeds.py`

### Other components

- **Network attacker**

## Connections

- Network attacker → Server and listeners: connects to
- Server and listeners → Connection handler: dispatches connections (evidence: `amun_server.py`)
- Server and listeners → Shellcode patterns: loads patterns (evidence: `amun_server.py`)
- Server and listeners → Configuration parser: uses configuration (evidence: `amun_server.py`)
- Server and listeners → Bind-port emulation: starts listeners (evidence: `amun_server.py`)
- Connection handler → Shellcode analysis: analyzes payload (evidence: `core/amun_request_handler.py`)
- Connection handler → Download handling: handles downloads (evidence: `core/amun_request_handler.py`)
- Connection handler → Vulnerability emulators: dispatches stages
- Download handling → Shellcode analysis: uses analysis (evidence: `core/download_core.py`)
- Download handling → Logging core: logs activity (evidence: `core/download_core.py`)
- Download handling → FTP downloads: delegates FTP
- Download handling → TFTP downloads: delegates TFTP
- Bind-port emulation → Shellcode analysis: analyzes payload (evidence: `core/amun_bindport_core.py`)
- Bind-port emulation → Logging core: logs activity (evidence: `core/amun_bindport_core.py`)
- SMB protocol engine → WINS emulator: supports emulation (evidence: `vuln_modules/vuln-wins/wins_modul.py`)
- HTTP emulator → Logging core: logs activity (evidence: `vuln_modules/vuln-http/http_modul.py`)
- DCOM emulator → Vulnerability emulators: implements stage (evidence: `vuln_modules/vuln-dcom/dcom_modul.py`)
- Logging core → Logging plugins: feeds events (evidence: `log_modules/log-hpfeeds/log_hpfeeds.py`)
- Logging core → Submission plugins: feeds samples (evidence: `submit_modules/submit-anubis/submit_anubis.py`)
- Logging plugins → Sarcophagus database: includes backend
- Logging plugins → MySQL logging: includes backend
- Logging plugins → HPFeeds reporting: includes reporter
- Shellcode analysis → Local IP ranges: checks local ranges (evidence: `core/shellcode_mgr_core.py`)
