# 4steroth/terasploit architecture

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

- Interactive diagram: https://gitdiagram.com/4steroth/terasploit
- Repository: https://github.com/4steroth/terasploit

## Overview

Terasploit is a Python red-team exploitation framework. Its product workflow is to enter through the console, select and configure a module, run an exploit or auxiliary check against a target, and use payloads or sessions for follow-on work. The tree also shows payload staging, encoding, NOP generation, and post-exploitation as distinct capabilities. The README documents the framework’s purpose but not internal wiring; dashed, uncited edges indicate likely workflow relationships that the excerpts do not establish. Unread module families are represented by their existing directories.

Main entry points: [`teralibs/terasploit/framework/console`](https://github.com/4steroth/terasploit/tree/master/teralibs/terasploit/framework/console) (Interactive console), [`modules/exploit/multi/http`](https://github.com/4steroth/terasploit/tree/master/modules/exploit/multi/http) (HTTP exploits), [`teralibs/tsf/base/encoder.py`](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/base/encoder.py) (Encoder lifecycle), [`modules/exploit/windows/smb/ms17_010_eternalblue.py`](https://github.com/4steroth/terasploit/blob/master/modules/exploit/windows/smb/ms17_010_eternalblue.py) (EternalBlue exploit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Console and configuration"]
  node_console["Interactive console"]
  node_module_store["Module discovery<br/>[module_storage.py]"]
  node_options["Option storage<br/>[storage.py]"]
end

subgraph group_modules["Security modules"]
  node_http_exploits["HTTP exploits"]
  node_smb_exploit["EternalBlue exploit"]
  node_smb_scanner["SMB scanner"]
  node_handler["Session handler<br/>[handler.py]"]
  node_post["Post-exploitation"]
end

subgraph group_payloads["Payload and encoding"]
  node_payload_modules["Payload modules"]
  node_payload_api["Payload base<br/>[payload.py]"]
  node_payload_assembly["Payload assembly<br/>[assembler.py]"]
  node_encoder_modules["Encoder modules"]
  node_encoder_api["Encoder lifecycle<br/>[encoder.py]"]
  node_encoder_factory["Encoder factory<br/>[factory.py]"]
  node_badchars["Bad-character rules<br/>[badchars.py]"]
  node_nop_modules["NOP modules"]
end

subgraph group_transport["Network transport"]
  node_http_api["HTTP exploit client<br/>[http_client.py]"]
  node_http_wire["HTTP socket client<br/>[client.py]"]
  node_http_request["HTTP request builder<br/>[client_request.py]"]
  node_smb_client["SMB client<br/>[client.py]"]
end

subgraph group_runtime["Framework runtime"]
  node_module_base["Module base<br/>[base.py]"]
  node_exploit_base["Exploit API<br/>[exploit.py]"]
  node_sessions["Session management<br/>[session.py]"]
  node_threading["Worker and output<br/>[handler.py]"]
end

node_operator(("Operator"))
node_target(("Target system"))

node_operator -.->|"uses"| node_console
node_console -.->|"discovers modules"| node_module_store
node_console -.->|"sets options"| node_options
node_console -.->|"dispatches work"| node_threading
node_http_exploits -.->|"extends"| node_exploit_base
node_smb_exploit -->|"extends"| node_exploit_base
node_smb_scanner -->|"uses"| node_smb_client
node_http_exploits -->|"sends requests"| node_http_api
node_http_api -->|"creates client"| node_http_wire
node_http_wire -->|"builds requests"| node_http_request
node_smb_exploit -.->|"tests target"| node_target
node_http_exploits -.->|"attacks target"| node_target
node_smb_scanner -.->|"scans target"| node_target
node_payload_modules -.->|"extends"| node_payload_api
node_payload_api -.->|"assembled by"| node_payload_assembly
node_encoder_modules -->|"extends"| node_encoder_api
node_encoder_factory -->|"loads encoders"| node_encoder_api
node_encoder_factory -->|"uses rules"| node_badchars
node_encoder_api -.->|"filters bytes"| node_badchars
node_handler -.->|"manages sessions"| node_sessions
node_post -.->|"uses sessions"| node_sessions
node_console -.->|"runs modules"| node_module_base

click node_console "https://github.com/4steroth/terasploit/tree/master/teralibs/terasploit/framework/console"
click node_module_store "https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/modules/module_storage.py"
click node_options "https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/options/storage.py"
click node_http_exploits "https://github.com/4steroth/terasploit/tree/master/modules/exploit/multi/http"
click node_smb_exploit "https://github.com/4steroth/terasploit/blob/master/modules/exploit/windows/smb/ms17_010_eternalblue.py"
click node_smb_scanner "https://github.com/4steroth/terasploit/blob/master/modules/auxiliary/scanner/smb/smb_ms17_010_doublepulsar.py"
click node_handler "https://github.com/4steroth/terasploit/blob/master/modules/exploit/multi/handler.py"
click node_post "https://github.com/4steroth/terasploit/tree/master/modules/post"
click node_module_base "https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/core/module/base.py"
click node_exploit_base "https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/base/exploit.py"
click node_http_api "https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/core/exploit/remote/http_client.py"
click node_http_wire "https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/pex/proto/http/client.py"
click node_http_request "https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/pex/proto/http/client_request.py"
click node_smb_client "https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/pex/proto/smb/client.py"
click node_payload_modules "https://github.com/4steroth/terasploit/tree/master/modules/payload"
click node_payload_api "https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/base/payload.py"
click node_payload_assembly "https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/payload/assembler.py"
click node_encoder_modules "https://github.com/4steroth/terasploit/tree/master/modules/encoder"
click node_encoder_api "https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/base/encoder.py"
click node_encoder_factory "https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/encoder/factory.py"
click node_badchars "https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/payload/badchars.py"
click node_nop_modules "https://github.com/4steroth/terasploit/tree/master/modules/nop"
click node_sessions "https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/exploit/session.py"
click node_threading "https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/thread/handler.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_console,node_module_store,node_options toneBlue
class node_http_exploits,node_smb_exploit,node_smb_scanner,node_handler,node_post toneAmber
class node_payload_modules,node_payload_api,node_payload_assembly,node_encoder_modules,node_encoder_api,node_encoder_factory,node_badchars,node_nop_modules toneMint
class node_http_api,node_http_wire,node_http_request,node_smb_client toneRose
class node_module_base,node_exploit_base,node_sessions,node_threading,node_operator,node_target toneIndigo
```

## Components

### Console and configuration

- [Interactive console](https://github.com/4steroth/terasploit/tree/master/teralibs/terasploit/framework/console): `teralibs/terasploit/framework/console`
- [Module discovery](https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/modules/module_storage.py): `teralibs/terasploit/framework/modules/module_storage.py`
- [Option storage](https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/options/storage.py): `teralibs/terasploit/framework/options/storage.py`

### Security modules

- [HTTP exploits](https://github.com/4steroth/terasploit/tree/master/modules/exploit/multi/http): `modules/exploit/multi/http`
- [EternalBlue exploit](https://github.com/4steroth/terasploit/blob/master/modules/exploit/windows/smb/ms17_010_eternalblue.py): `modules/exploit/windows/smb/ms17_010_eternalblue.py`
- [SMB scanner](https://github.com/4steroth/terasploit/blob/master/modules/auxiliary/scanner/smb/smb_ms17_010_doublepulsar.py): `modules/auxiliary/scanner/smb/smb_ms17_010_doublepulsar.py`
- [Session handler](https://github.com/4steroth/terasploit/blob/master/modules/exploit/multi/handler.py): `modules/exploit/multi/handler.py`
- [Post-exploitation](https://github.com/4steroth/terasploit/tree/master/modules/post): `modules/post`

### Payload and encoding

- [Payload modules](https://github.com/4steroth/terasploit/tree/master/modules/payload): `modules/payload`
- [Payload base](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/base/payload.py): `teralibs/tsf/base/payload.py`
- [Payload assembly](https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/payload/assembler.py): `teralibs/terasploit/framework/payload/assembler.py`
- [Encoder modules](https://github.com/4steroth/terasploit/tree/master/modules/encoder): `modules/encoder`
- [Encoder lifecycle](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/base/encoder.py): `teralibs/tsf/base/encoder.py`
- [Encoder factory](https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/encoder/factory.py): `teralibs/terasploit/framework/encoder/factory.py`
- [Bad-character rules](https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/payload/badchars.py): `teralibs/terasploit/framework/payload/badchars.py`
- [NOP modules](https://github.com/4steroth/terasploit/tree/master/modules/nop): `modules/nop`

### Network transport

- [HTTP exploit client](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/core/exploit/remote/http_client.py): `teralibs/tsf/core/exploit/remote/http_client.py`
- [HTTP socket client](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/pex/proto/http/client.py): `teralibs/tsf/pex/proto/http/client.py`
- [HTTP request builder](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/pex/proto/http/client_request.py): `teralibs/tsf/pex/proto/http/client_request.py`
- [SMB client](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/pex/proto/smb/client.py): `teralibs/tsf/pex/proto/smb/client.py`

### Framework runtime

- [Module base](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/core/module/base.py): `teralibs/tsf/core/module/base.py`
- [Exploit API](https://github.com/4steroth/terasploit/blob/master/teralibs/tsf/base/exploit.py): `teralibs/tsf/base/exploit.py`
- [Session management](https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/exploit/session.py): `teralibs/terasploit/framework/exploit/session.py`
- [Worker and output](https://github.com/4steroth/terasploit/blob/master/teralibs/terasploit/framework/thread/handler.py): `teralibs/terasploit/framework/thread/handler.py`

### Other components

- **Operator**
- **Target system**

## Connections

- Operator → Interactive console: uses
- Interactive console → Module discovery: discovers modules
- Interactive console → Option storage: sets options
- Interactive console → Worker and output: dispatches work
- HTTP exploits → Exploit API: extends (evidence: `modules/exploit/multi/http/cpanel_whm_auth_bypass_rce.py`)
- EternalBlue exploit → Exploit API: extends (evidence: `modules/exploit/windows/smb/ms17_010_eternalblue.py`)
- SMB scanner → SMB client: uses (evidence: `modules/auxiliary/scanner/smb/smb_ms17_010_doublepulsar.py`)
- HTTP exploits → HTTP exploit client: sends requests (evidence: `modules/exploit/multi/http/cpanel_whm_auth_bypass_rce.py`)
- HTTP exploit client → HTTP socket client: creates client (evidence: `teralibs/tsf/core/exploit/remote/http_client.py`)
- HTTP socket client → HTTP request builder: builds requests (evidence: `teralibs/tsf/pex/proto/http/client.py`)
- EternalBlue exploit → Target system: tests target
- HTTP exploits → Target system: attacks target
- SMB scanner → Target system: scans target
- Payload modules → Payload base: extends (evidence: `modules/payload/stages/php/shell.py`)
- Payload base → Payload assembly: assembled by
- Encoder modules → Encoder lifecycle: extends (evidence: `modules/encoder/x64/xor_dynamic.py`)
- Encoder factory → Encoder lifecycle: loads encoders (evidence: `teralibs/terasploit/framework/encoder/factory.py`)
- Encoder factory → Bad-character rules: uses rules (evidence: `teralibs/terasploit/framework/encoder/factory.py`)
- Encoder lifecycle → Bad-character rules: filters bytes
- Session handler → Session management: manages sessions
- Post-exploitation → Session management: uses sessions
- Interactive console → Module base: runs modules
