# pennyw0rth/netexec architecture

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

- Interactive diagram: https://gitdiagram.com/pennyw0rth/netexec
- Repository: https://github.com/pennyw0rth/netexec

## Overview

NetExec is a command-line network execution and reconnaissance tool. A user invokes the CLI with targets, credentials, protocol choices, and optional modules; the application selects protocol implementations and modules to interact with remote services, then presents findings and retains protocol-specific state. The tree documents broad protocol and module coverage, but the sampled excerpts do not show the main dispatch flow, so uncertain call wiring is omitted. Database components are shown as persistence responsibilities rather than a detailed storage pipeline.

Main entry points: [`nxc/netexec.py`](https://github.com/pennyw0rth/netexec/blob/main/nxc/netexec.py) (Application entry), [`nxc/protocols`](https://github.com/pennyw0rth/netexec/tree/main/nxc/protocols) (Protocol handlers), [`nxc/modules`](https://github.com/pennyw0rth/netexec/tree/main/nxc/modules) (Plugin modules), [`nxc/loaders/protocolloader.py`](https://github.com/pennyw0rth/netexec/blob/main/nxc/loaders/protocolloader.py) (Protocol loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command interface"]
  node_netexec["Application entry<br/>[netexec.py]"]
  node_cli["CLI options<br/>[cli.py]"]
  node_config["Configuration<br/>[config.py]"]
end

subgraph group_runtime["Execution runtime"]
  node_loader["Protocol loader<br/>[protocolloader.py]"]
  node_moduleloader["Module loader<br/>[moduleloader.py]"]
  node_modules["Plugin modules"]
  node_context["Execution context<br/>[context.py]"]
  node_connection["Connection handling<br/>[connection.py]"]
  node_helpers["Shared helpers"]
end

subgraph group_protocols["Network protocols"]
  node_protocols["Protocol handlers"]
  node_smb["SMB handler<br/>[smb.py]"]
  node_ldap["LDAP handler<br/>[ldap.py]"]
  node_other_protocols["Other handlers"]
end

subgraph group_state["Results and state"]
  node_console["Console output<br/>[console.py]"]
  node_database["Workspace setup<br/>[database.py]"]
  node_protocol_db[("Protocol databases")]
  node_db_cli["Database CLI<br/>[nxcdb.py]"]
end

node_user(("Operator"))
node_targets(("Remote services"))

node_user -->|"invokes"| node_netexec
node_netexec -->|"parses options"| node_cli
node_netexec -->|"loads settings"| node_config
node_netexec -->|"selects protocol"| node_loader
node_loader -->|"loads handler"| node_protocols
node_netexec -->|"loads plugins"| node_moduleloader
node_moduleloader -->|"discovers modules"| node_modules
node_netexec -->|"provides context"| node_context
node_netexec -->|"manages connections"| node_connection
node_connection -->|"uses handler"| node_protocols
node_protocols -->|"connects to"| node_targets
node_modules -->|"extends operations"| node_protocols
node_protocols -->|"records results"| node_protocol_db
node_database -->|"initializes workspaces"| node_protocol_db
node_db_cli -->|"queries state"| node_protocol_db
node_netexec -->|"reports results"| node_console
node_modules -->|"uses utilities"| node_helpers

click node_netexec "https://github.com/pennyw0rth/netexec/blob/main/nxc/netexec.py"
click node_cli "https://github.com/pennyw0rth/netexec/blob/main/nxc/cli.py"
click node_config "https://github.com/pennyw0rth/netexec/blob/main/nxc/config.py"
click node_loader "https://github.com/pennyw0rth/netexec/blob/main/nxc/loaders/protocolloader.py"
click node_moduleloader "https://github.com/pennyw0rth/netexec/blob/main/nxc/loaders/moduleloader.py"
click node_modules "https://github.com/pennyw0rth/netexec/tree/main/nxc/modules"
click node_context "https://github.com/pennyw0rth/netexec/blob/main/nxc/context.py"
click node_connection "https://github.com/pennyw0rth/netexec/blob/main/nxc/connection.py"
click node_protocols "https://github.com/pennyw0rth/netexec/tree/main/nxc/protocols"
click node_smb "https://github.com/pennyw0rth/netexec/blob/main/nxc/protocols/smb.py"
click node_ldap "https://github.com/pennyw0rth/netexec/blob/main/nxc/protocols/ldap.py"
click node_other_protocols "https://github.com/pennyw0rth/netexec/tree/main/nxc/protocols"
click node_console "https://github.com/pennyw0rth/netexec/blob/main/nxc/console.py"
click node_database "https://github.com/pennyw0rth/netexec/blob/main/nxc/database.py"
click node_protocol_db "https://github.com/pennyw0rth/netexec/tree/main/nxc/protocols"
click node_db_cli "https://github.com/pennyw0rth/netexec/blob/main/nxc/nxcdb.py"
click node_helpers "https://github.com/pennyw0rth/netexec/tree/main/nxc/helpers"

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_netexec,node_cli,node_config toneBlue
class node_loader,node_moduleloader,node_modules,node_context,node_connection,node_helpers toneAmber
class node_protocols,node_smb,node_ldap,node_other_protocols toneMint
class node_console,node_database,node_protocol_db,node_db_cli toneRose
class node_user,node_targets toneIndigo
```

## Components

### Command interface

- [Application entry](https://github.com/pennyw0rth/netexec/blob/main/nxc/netexec.py): `nxc/netexec.py`
- [CLI options](https://github.com/pennyw0rth/netexec/blob/main/nxc/cli.py): `nxc/cli.py`
- [Configuration](https://github.com/pennyw0rth/netexec/blob/main/nxc/config.py): `nxc/config.py`

### Execution runtime

- [Protocol loader](https://github.com/pennyw0rth/netexec/blob/main/nxc/loaders/protocolloader.py): `nxc/loaders/protocolloader.py`
- [Module loader](https://github.com/pennyw0rth/netexec/blob/main/nxc/loaders/moduleloader.py): `nxc/loaders/moduleloader.py`
- [Plugin modules](https://github.com/pennyw0rth/netexec/tree/main/nxc/modules): `nxc/modules`
- [Execution context](https://github.com/pennyw0rth/netexec/blob/main/nxc/context.py): `nxc/context.py`
- [Connection handling](https://github.com/pennyw0rth/netexec/blob/main/nxc/connection.py): `nxc/connection.py`
- [Shared helpers](https://github.com/pennyw0rth/netexec/tree/main/nxc/helpers): `nxc/helpers`

### Network protocols

- [Protocol handlers](https://github.com/pennyw0rth/netexec/tree/main/nxc/protocols): `nxc/protocols`
- [SMB handler](https://github.com/pennyw0rth/netexec/blob/main/nxc/protocols/smb.py): `nxc/protocols/smb.py`
- [LDAP handler](https://github.com/pennyw0rth/netexec/blob/main/nxc/protocols/ldap.py): `nxc/protocols/ldap.py`
- [Other handlers](https://github.com/pennyw0rth/netexec/tree/main/nxc/protocols): `nxc/protocols`

### Results and state

- [Console output](https://github.com/pennyw0rth/netexec/blob/main/nxc/console.py): `nxc/console.py`
- [Workspace setup](https://github.com/pennyw0rth/netexec/blob/main/nxc/database.py): `nxc/database.py`
- [Protocol databases](https://github.com/pennyw0rth/netexec/tree/main/nxc/protocols): `nxc/protocols`
- [Database CLI](https://github.com/pennyw0rth/netexec/blob/main/nxc/nxcdb.py): `nxc/nxcdb.py`

### Other components

- **Operator**
- **Remote services**

## Connections

- Operator → Application entry: invokes
- Application entry → CLI options: parses options
- Application entry → Configuration: loads settings
- Application entry → Protocol loader: selects protocol
- Protocol loader → Protocol handlers: loads handler
- Application entry → Module loader: loads plugins
- Module loader → Plugin modules: discovers modules
- Application entry → Execution context: provides context
- Application entry → Connection handling: manages connections
- Connection handling → Protocol handlers: uses handler
- Protocol handlers → Remote services: connects to
- Plugin modules → Protocol handlers: extends operations
- Protocol handlers → Protocol databases: records results
- Workspace setup → Protocol databases: initializes workspaces
- Database CLI → Protocol databases: queries state
- Application entry → Console output: reports results
- Plugin modules → Shared helpers: uses utilities
