# mandiant/flare-fakenet-ng architecture

> Architecture diagram of the GitHub repository mandiant/flare-fakenet-ng, 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/mandiant/flare-fakenet-ng
- Repository: https://github.com/mandiant/flare-fakenet-ng

## Overview

FakeNet-NG intercepts network traffic generated by software under analysis and redirects it to simulated services, capturing the resulting requests and network signatures. Its runtime entry point reads configuration, starts listeners, and can select a platform-specific diverter. The diverter layer parses and redirects packets; listener implementations emulate protocol services, with HTTP response customization and TLS support as notable capabilities. The README documents the product workflow, while several wiring details and listener implementations were not sampled, so uncertain connections are omitted.

Main entry points: [`fakenet/listeners/__init__.py`](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/__init__.py) (Listener providers), [`fakenet/fakenet.py`](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/fakenet.py) (FakeNet runtime), [`fakenet/diverters/diverterbase.py`](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/diverterbase.py) (Diverter logic), [`fakenet/diverters/linux.py`](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/linux.py) (Linux diverter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime control"]
  node_runtime["FakeNet runtime<br/>[fakenet.py]"]
  node_config["Runtime configuration<br/>[default.ini]"]
end

subgraph group_traffic["Traffic interception"]
  node_diverter_base["Diverter logic<br/>[diverterbase.py]"]
  node_packet_context["Packet parsing<br/>[fnpacket.py]"]
  node_debug_levels["Diverter diagnostics<br/>[debuglevels.py]"]
  node_linux_diverter["Linux diverter<br/>[linux.py]"]
  node_linux_util["Linux networking<br/>[linutil.py]"]
  node_windows_diverter["Windows diverter<br/>[windows.py]"]
  node_windows_util["Windows networking<br/>[winutil.py]"]
end

subgraph group_services["Simulated services"]
  node_listener_registry["Listener providers<br/>[__init__.py]"]
  node_listener_base["Listener base<br/>[ListenerBase.py]"]
  node_dns["DNS service<br/>[DNSListener.py]"]
  node_http["HTTP service<br/>[HTTPListener.py]"]
  node_ftp["FTP service<br/>[FTPListener.py]"]
  node_irc["IRC service<br/>[IRCListener.py]"]
  node_pop["POP service<br/>[POPListener.py]"]
  node_smtp["SMTP service<br/>[SMTPListener.py]"]
  node_tftp["TFTP service<br/>[TFTPListener.py]"]
  node_raw["Raw service<br/>[RawListener.py]"]
  node_proxy["Proxy service<br/>[ProxyListener.py]"]
  node_banner["Protocol banners<br/>[BannerFactory.py]"]
end

subgraph group_security["TLS support"]
  node_tls["TLS certificates<br/>[__init__.py]"]
  node_tls_detector["TLS detection<br/>[ssl_detector.py]"]
end

node_analyst(("Analyst"))
node_software(("Analyzed software"))

node_analyst -->|"starts"| node_runtime
node_analyst -->|"configures"| node_config
node_software -->|"generates traffic"| node_runtime
node_runtime -->|"starts providers"| node_listener_registry
node_runtime -->|"configures diversion"| node_diverter_base
node_runtime -->|"selects on Linux"| node_linux_diverter
node_runtime -->|"selects on Windows"| node_windows_diverter
node_listener_registry -->|"imports"| node_listener_base
node_listener_registry -->|"imports"| node_dns
node_listener_registry -->|"imports"| node_http
node_listener_registry -->|"imports"| node_ftp
node_listener_registry -->|"imports"| node_irc
node_listener_registry -->|"imports"| node_pop
node_listener_registry -->|"imports"| node_smtp
node_listener_registry -->|"imports"| node_tftp
node_listener_registry -->|"imports"| node_raw
node_listener_registry -->|"imports"| node_proxy
node_diverter_base -->|"parses packets with"| node_packet_context
node_linux_diverter -->|"extends"| node_diverter_base
node_linux_diverter -->|"uses packet context"| node_packet_context
node_linux_diverter -->|"uses networking"| node_linux_util
node_windows_diverter -->|"extends"| node_diverter_base
node_windows_diverter -->|"uses packet context"| node_packet_context
node_windows_diverter -->|"uses networking"| node_windows_util
node_diverter_base -->|"uses diagnostics"| node_debug_levels
node_ftp -->|"uses banners"| node_banner
node_irc -->|"uses banners"| node_banner
node_http -->|"uses TLS support"| node_tls
node_proxy -->|"uses TLS detection"| node_tls_detector
node_software -.->|"traffic intercepted by"| node_diverter_base

click node_runtime "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/fakenet.py"
click node_config "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/configs/default.ini"
click node_listener_registry "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/__init__.py"
click node_listener_base "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/ListenerBase.py"
click node_diverter_base "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/diverterbase.py"
click node_packet_context "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/fnpacket.py"
click node_debug_levels "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/debuglevels.py"
click node_linux_diverter "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/linux.py"
click node_linux_util "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/linutil.py"
click node_windows_diverter "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/windows.py"
click node_windows_util "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/winutil.py"
click node_dns "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/DNSListener.py"
click node_http "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/HTTPListener.py"
click node_ftp "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/FTPListener.py"
click node_irc "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/IRCListener.py"
click node_pop "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/POPListener.py"
click node_smtp "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/SMTPListener.py"
click node_tftp "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/TFTPListener.py"
click node_raw "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/RawListener.py"
click node_proxy "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/ProxyListener.py"
click node_banner "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/BannerFactory.py"
click node_tls "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/ssl_utils/__init__.py"
click node_tls_detector "https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/ssl_utils/ssl_detector.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_runtime,node_config toneBlue
class node_diverter_base,node_packet_context,node_debug_levels,node_linux_diverter,node_linux_util,node_windows_diverter,node_windows_util toneAmber
class node_listener_registry,node_listener_base,node_dns,node_http,node_ftp,node_irc,node_pop,node_smtp,node_tftp,node_raw,node_proxy,node_banner toneMint
class node_tls,node_tls_detector toneRose
class node_analyst,node_software toneIndigo
```

## Components

### Runtime control

- [FakeNet runtime](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/fakenet.py): `fakenet/fakenet.py`
- [Runtime configuration](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/configs/default.ini): `fakenet/configs/default.ini`

### Traffic interception

- [Diverter logic](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/diverterbase.py): `fakenet/diverters/diverterbase.py`
- [Packet parsing](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/fnpacket.py): `fakenet/diverters/fnpacket.py`
- [Diverter diagnostics](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/debuglevels.py): `fakenet/diverters/debuglevels.py`
- [Linux diverter](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/linux.py): `fakenet/diverters/linux.py`
- [Linux networking](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/linutil.py): `fakenet/diverters/linutil.py`
- [Windows diverter](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/windows.py): `fakenet/diverters/windows.py`
- [Windows networking](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/diverters/winutil.py): `fakenet/diverters/winutil.py`

### Simulated services

- [Listener providers](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/__init__.py): `fakenet/listeners/__init__.py`
- [Listener base](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/ListenerBase.py): `fakenet/listeners/ListenerBase.py`
- [DNS service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/DNSListener.py): `fakenet/listeners/DNSListener.py`
- [HTTP service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/HTTPListener.py): `fakenet/listeners/HTTPListener.py`
- [FTP service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/FTPListener.py): `fakenet/listeners/FTPListener.py`
- [IRC service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/IRCListener.py): `fakenet/listeners/IRCListener.py`
- [POP service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/POPListener.py): `fakenet/listeners/POPListener.py`
- [SMTP service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/SMTPListener.py): `fakenet/listeners/SMTPListener.py`
- [TFTP service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/TFTPListener.py): `fakenet/listeners/TFTPListener.py`
- [Raw service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/RawListener.py): `fakenet/listeners/RawListener.py`
- [Proxy service](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/ProxyListener.py): `fakenet/listeners/ProxyListener.py`
- [Protocol banners](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/BannerFactory.py): `fakenet/listeners/BannerFactory.py`

### TLS support

- [TLS certificates](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/ssl_utils/__init__.py): `fakenet/listeners/ssl_utils/__init__.py`
- [TLS detection](https://github.com/mandiant/flare-fakenet-ng/blob/master/fakenet/listeners/ssl_utils/ssl_detector.py): `fakenet/listeners/ssl_utils/ssl_detector.py`

### Other components

- **Analyst**
- **Analyzed software**

## Connections

- Analyst → FakeNet runtime: starts (evidence: `README.md`)
- Analyst → Runtime configuration: configures (evidence: `README.md`)
- Analyzed software → FakeNet runtime: generates traffic (evidence: `README.md`)
- FakeNet runtime → Listener providers: starts providers (evidence: `fakenet/fakenet.py`)
- FakeNet runtime → Diverter logic: configures diversion (evidence: `fakenet/fakenet.py`)
- FakeNet runtime → Linux diverter: selects on Linux (evidence: `fakenet/fakenet.py`)
- FakeNet runtime → Windows diverter: selects on Windows (evidence: `fakenet/fakenet.py`)
- Listener providers → Listener base: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → DNS service: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → HTTP service: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → FTP service: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → IRC service: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → POP service: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → SMTP service: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → TFTP service: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → Raw service: imports (evidence: `fakenet/listeners/__init__.py`)
- Listener providers → Proxy service: imports (evidence: `fakenet/listeners/__init__.py`)
- Diverter logic → Packet parsing: parses packets with (evidence: `fakenet/diverters/diverterbase.py`)
- Linux diverter → Diverter logic: extends (evidence: `fakenet/diverters/linux.py`)
- Linux diverter → Packet parsing: uses packet context (evidence: `fakenet/diverters/linux.py`)
- Linux diverter → Linux networking: uses networking (evidence: `fakenet/diverters/linux.py`)
- Windows diverter → Diverter logic: extends (evidence: `fakenet/diverters/windows.py`)
- Windows diverter → Packet parsing: uses packet context (evidence: `fakenet/diverters/windows.py`)
- Windows diverter → Windows networking: uses networking (evidence: `fakenet/diverters/windows.py`)
- Diverter logic → Diverter diagnostics: uses diagnostics (evidence: `fakenet/diverters/diverterbase.py`)
- FTP service → Protocol banners: uses banners (evidence: `fakenet/listeners/FTPListener.py`)
- IRC service → Protocol banners: uses banners (evidence: `fakenet/listeners/IRCListener.py`)
- HTTP service → TLS certificates: uses TLS support (evidence: `fakenet/listeners/HTTPListener.py`)
- Proxy service → TLS detection: uses TLS detection (evidence: `fakenet/listeners/ProxyListener.py`)
- Analyzed software → Diverter logic: traffic intercepted by (evidence: `README.md`)
