# d3ext/hooka architecture

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

- Interactive diagram: https://gitdiagram.com/d3ext/hooka
- Repository: https://github.com/d3ext/hooka

## Overview

Hooka is a command-line shellcode-loader generator, with a Go library exposing related capabilities. Its principal workflow is to select or obtain a payload, configure encoding and evasion options, and generate an EXE or DLL loader using a chosen execution technique. The README documents the generator’s capabilities; the excerpts show CLI-side generation and library wrappers, but not the complete dispatch path. The graph therefore uses documented relationships for that workflow and avoids inferring unshown internal calls.

Main entry points: [`cmd/main.go`](https://github.com/d3ext/hooka/blob/main/cmd/main.go) (Generator CLI), [`pkg/hooka/shellcode.go`](https://github.com/d3ext/hooka/blob/main/pkg/hooka/shellcode.go) (Execution API), [`pkg/hooka`](https://github.com/d3ext/hooka/tree/main/pkg/hooka) (Public library), [`utils/shellcode.go`](https://github.com/d3ext/hooka/blob/main/utils/shellcode.go) (Payload input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Loader generation"]
  node_cli["Generator CLI<br/>[main.go]"]
  node_loader["Generated loader<br/>[main.go]"]
end

subgraph group_payload["Payload handling"]
  node_payload_input["Payload input<br/>[shellcode.go]"]
  node_dll_convert["DLL conversion<br/>[dll.go]"]
  node_crypto["Payload encryption<br/>[aes.go]"]
  node_crypto_3des["3DES encryption<br/>[3des.go]"]
  node_crypto_rc4["RC4 encryption<br/>[rc4.go]"]
  node_crypto_xor["XOR encryption<br/>[xor.go]"]
end

subgraph group_execution["Execution techniques"]
  node_execution_api["Execution API<br/>[shellcode.go]"]
  node_suspended["Suspended process<br/>[createprocess.go]"]
  node_hollowing["Process hollowing"]
  node_threadex["NtCreateThreadEx"]
  node_etwthread["ETW thread"]
  node_apc["APC injection"]
  node_norwx["No-RWX technique<br/>[no-rwx.go]"]
end

subgraph group_evasion["Evasion and inspection"]
  node_evasion_methods["Evasion capabilities"]
  node_sandbox["Sandbox checks<br/>[sandbox.go]"]
  node_unhook["Hook removal<br/>[unhook.go]"]
  node_hashing["API hashing<br/>[hashing.go]"]
end

subgraph group_library["Library and utilities"]
  node_library_api["Public library"]
  node_utils["Utility functions"]
end

node_user(("CLI user"))

node_user -->|"configures"| node_cli
node_cli -->|"accepts payload"| node_payload_input
node_cli -->|"generates"| node_loader
node_cli -->|"selects technique"| node_execution_api
node_cli -->|"configures"| node_evasion_methods
node_cli -->|"encrypts payload"| node_crypto
node_cli -->|"encrypts payload"| node_crypto_3des
node_cli -->|"encrypts payload"| node_crypto_rc4
node_cli -->|"encrypts payload"| node_crypto_xor
node_execution_api -->|"delegates to"| node_suspended
node_execution_api -->|"delegates to"| node_hollowing
node_execution_api -->|"delegates to"| node_threadex
node_execution_api -->|"delegates to"| node_etwthread
node_execution_api -->|"delegates to"| node_apc
node_execution_api -->|"delegates to"| node_norwx
node_library_api -->|"exposes"| node_execution_api
node_library_api -->|"exposes"| node_dll_convert
node_library_api -->|"exposes"| node_sandbox
node_library_api -->|"exposes"| node_unhook
node_library_api -->|"exposes"| node_hashing
node_cli -->|"uses helpers"| node_utils

click node_cli "https://github.com/d3ext/hooka/blob/main/cmd/main.go"
click node_loader "https://github.com/d3ext/hooka/blob/main/cmd/main.go"
click node_payload_input "https://github.com/d3ext/hooka/blob/main/utils/shellcode.go"
click node_dll_convert "https://github.com/d3ext/hooka/blob/main/utils/dll.go"
click node_crypto "https://github.com/d3ext/hooka/blob/main/utils/aes.go"
click node_crypto_3des "https://github.com/d3ext/hooka/blob/main/utils/3des.go"
click node_crypto_rc4 "https://github.com/d3ext/hooka/blob/main/utils/rc4.go"
click node_crypto_xor "https://github.com/d3ext/hooka/blob/main/utils/xor.go"
click node_execution_api "https://github.com/d3ext/hooka/blob/main/pkg/hooka/shellcode.go"
click node_suspended "https://github.com/d3ext/hooka/blob/main/shellcode/createprocess.go"
click node_hollowing "https://github.com/d3ext/hooka/blob/main/shellcode/processhollowing.go"
click node_threadex "https://github.com/d3ext/hooka/blob/main/shellcode/ntcreatethreadex.go"
click node_etwthread "https://github.com/d3ext/hooka/blob/main/shellcode/etwpcreateetwthread.go"
click node_apc "https://github.com/d3ext/hooka/blob/main/shellcode/ntqueueapcthreadex.go"
click node_norwx "https://github.com/d3ext/hooka/blob/main/shellcode/no-rwx.go"
click node_evasion_methods "https://github.com/d3ext/hooka/tree/main/evasion"
click node_sandbox "https://github.com/d3ext/hooka/blob/main/evasion/sandbox.go"
click node_unhook "https://github.com/d3ext/hooka/blob/main/evasion/unhook.go"
click node_hashing "https://github.com/d3ext/hooka/blob/main/evasion/hashing.go"
click node_library_api "https://github.com/d3ext/hooka/tree/main/pkg/hooka"
click node_utils "https://github.com/d3ext/hooka/tree/main/utils"

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,node_loader,node_user toneBlue
class node_payload_input,node_dll_convert,node_crypto,node_crypto_3des,node_crypto_rc4,node_crypto_xor toneAmber
class node_execution_api,node_suspended,node_hollowing,node_threadex,node_etwthread,node_apc,node_norwx toneMint
class node_evasion_methods,node_sandbox,node_unhook,node_hashing toneRose
class node_library_api,node_utils toneIndigo
```

## Components

### Loader generation

- [Generator CLI](https://github.com/d3ext/hooka/blob/main/cmd/main.go): `cmd/main.go`
- [Generated loader](https://github.com/d3ext/hooka/blob/main/cmd/main.go): `cmd/main.go`

### Payload handling

- [Payload input](https://github.com/d3ext/hooka/blob/main/utils/shellcode.go): `utils/shellcode.go`
- [DLL conversion](https://github.com/d3ext/hooka/blob/main/utils/dll.go): `utils/dll.go`
- [Payload encryption](https://github.com/d3ext/hooka/blob/main/utils/aes.go): `utils/aes.go`
- [3DES encryption](https://github.com/d3ext/hooka/blob/main/utils/3des.go): `utils/3des.go`
- [RC4 encryption](https://github.com/d3ext/hooka/blob/main/utils/rc4.go): `utils/rc4.go`
- [XOR encryption](https://github.com/d3ext/hooka/blob/main/utils/xor.go): `utils/xor.go`

### Execution techniques

- [Execution API](https://github.com/d3ext/hooka/blob/main/pkg/hooka/shellcode.go): `pkg/hooka/shellcode.go`
- [Suspended process](https://github.com/d3ext/hooka/blob/main/shellcode/createprocess.go): `shellcode/createprocess.go`
- [Process hollowing](https://github.com/d3ext/hooka/blob/main/shellcode/processhollowing.go): `shellcode/processhollowing.go`
- [NtCreateThreadEx](https://github.com/d3ext/hooka/blob/main/shellcode/ntcreatethreadex.go): `shellcode/ntcreatethreadex.go`
- [ETW thread](https://github.com/d3ext/hooka/blob/main/shellcode/etwpcreateetwthread.go): `shellcode/etwpcreateetwthread.go`
- [APC injection](https://github.com/d3ext/hooka/blob/main/shellcode/ntqueueapcthreadex.go): `shellcode/ntqueueapcthreadex.go`
- [No-RWX technique](https://github.com/d3ext/hooka/blob/main/shellcode/no-rwx.go): `shellcode/no-rwx.go`

### Evasion and inspection

- [Evasion capabilities](https://github.com/d3ext/hooka/tree/main/evasion): `evasion`
- [Sandbox checks](https://github.com/d3ext/hooka/blob/main/evasion/sandbox.go): `evasion/sandbox.go`
- [Hook removal](https://github.com/d3ext/hooka/blob/main/evasion/unhook.go): `evasion/unhook.go`
- [API hashing](https://github.com/d3ext/hooka/blob/main/evasion/hashing.go): `evasion/hashing.go`

### Library and utilities

- [Public library](https://github.com/d3ext/hooka/tree/main/pkg/hooka): `pkg/hooka`
- [Utility functions](https://github.com/d3ext/hooka/tree/main/utils): `utils`

### Other components

- **CLI user**

## Connections

- CLI user → Generator CLI: configures (evidence: `README.md`)
- Generator CLI → Payload input: accepts payload (evidence: `README.md`)
- Generator CLI → Generated loader: generates (evidence: `README.md`)
- Generator CLI → Execution API: selects technique (evidence: `README.md`)
- Generator CLI → Evasion capabilities: configures (evidence: `README.md`)
- Generator CLI → Payload encryption: encrypts payload (evidence: `cmd/main.go`)
- Generator CLI → 3DES encryption: encrypts payload (evidence: `README.md`)
- Generator CLI → RC4 encryption: encrypts payload (evidence: `README.md`)
- Generator CLI → XOR encryption: encrypts payload (evidence: `README.md`)
- Execution API → Suspended process: delegates to (evidence: `pkg/hooka/shellcode.go`)
- Execution API → Process hollowing: delegates to (evidence: `pkg/hooka/shellcode.go`)
- Execution API → NtCreateThreadEx: delegates to (evidence: `pkg/hooka/shellcode.go`)
- Execution API → ETW thread: delegates to (evidence: `pkg/hooka/shellcode.go`)
- Execution API → APC injection: delegates to (evidence: `pkg/hooka/shellcode.go`)
- Execution API → No-RWX technique: delegates to (evidence: `pkg/hooka/shellcode.go`)
- Public library → Execution API: exposes (evidence: `pkg/hooka/shellcode.go`)
- Public library → DLL conversion: exposes (evidence: `pkg/hooka/dll.go`)
- Public library → Sandbox checks: exposes (evidence: `pkg/hooka/sandbox.go`)
- Public library → Hook removal: exposes (evidence: `pkg/hooka/unhook.go`)
- Public library → API hashing: exposes (evidence: `pkg/hooka/hashing.go`)
- Generator CLI → Utility functions: uses helpers (evidence: `cmd/main.go`)
