# hfiref0x/kdu architecture

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

- Interactive diagram: https://gitdiagram.com/hfiref0x/kdu
- Repository: https://github.com/hfiref0x/kdu

## Overview

KDU is a Windows kernel driver utility. Its principal workflow parses a command, selects a vulnerable-driver provider, and dispatches an operation such as process-protection modification, DSE control, or driver mapping. Provider-backed kernel access, shellcode mapping, diagnostics, and provider listing are distinct product capabilities. The graph follows documented behavior and sampled command dispatch; some implementation links are documented in the README rather than verified in unsampled source.

Main entry points: [`Source/Hamakaze/main.cpp`](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/main.cpp) (KDU command dispatcher), [`Source/Hamakaze/sup.cpp`](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/sup.cpp) (Kernel and system helpers), [`Source/Hamakaze/kduprov.cpp`](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/kduprov.cpp) (Provider selection), [`Source/Hamakaze/drvmap.cpp`](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/drvmap.cpp) (Driver mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command workflow"]
  node_cli["KDU command dispatcher<br/>[main.cpp]"]
  node_diagnostics["System diagnostics<br/>[diag.cpp]"]
  node_provider_listing["Provider listing<br/>[provlist.cpp]"]
end

subgraph group_operations["Kernel operations"]
  node_process_ops["Process protection and handles<br/>[ps.cpp]"]
  node_dse_ops["DSE control<br/>[dsefix.cpp]"]
  node_driver_map["Driver mapping<br/>[drvmap.cpp]"]
  node_shellcode["Mapping shellcode<br/>[shellcode.cpp]"]
  node_victim["Victim driver support<br/>[victim.h]"]
end

subgraph group_providers["Provider access"]
  node_provider_factory["Provider selection<br/>[kduprov.cpp]"]
  node_provider_catalog["Provider catalog<br/>[tanikaze.h]"]
  node_provider_drivers["Provider drivers"]
  node_taigei["Taigei companion<br/>[main.cpp]"]
end

subgraph group_support["Runtime support"]
  node_support["Kernel and system helpers<br/>[sup.cpp]"]
  node_ntos["Windows kernel definitions<br/>[ntos.h]"]
  node_loader["Image loader<br/>[ldr.cpp]"]
  node_decoder["Instruction decoder<br/>[hde64.c]"]
  node_minimal_runtime["Minimal runtime"]
  node_common_types["Shared base types<br/>[kdubase.h]"]
  node_provider_shell["Driver loader definitions<br/>[ldrsc.h]"]
  node_wdk_support["WDK support<br/>[wdksup.h]"]
  node_aes["AES implementation<br/>[aes.c]"]
end

subgraph group_tools["Companion tools"]
  node_si_checker["Signature policy checker<br/>[Program.cs]"]
  node_si_policy["Policy comparison<br/>[CSiPolicy.cs]"]
  node_provider_xml["Provider metadata model<br/>[CProviders.cs]"]
end

node_user(("Administrator"))

node_user -->|"runs command"| node_cli
node_cli -->|"selects provider"| node_provider_factory
node_cli -->|"dispatches process action"| node_process_ops
node_cli -->|"dispatches DSE action"| node_dse_ops
node_cli -->|"dispatches mapping"| node_driver_map
node_cli -->|"runs diagnostics"| node_diagnostics
node_cli -->|"lists providers"| node_provider_listing
node_provider_factory -.->|"uses catalog"| node_provider_catalog
node_provider_factory -.->|"dispatches provider"| node_provider_drivers
node_process_ops -.->|"uses provider access"| node_provider_factory
node_dse_ops -.->|"uses provider access"| node_provider_factory
node_driver_map -.->|"uses provider access"| node_provider_factory
node_driver_map -->|"uses shellcode"| node_shellcode
node_driver_map -->|"hijacks victim driver"| node_victim
node_provider_drivers -.->|"uses system helpers"| node_support
node_support -->|"uses kernel definitions"| node_ntos
node_support -->|"uses image loader"| node_loader
node_support -->|"uses instruction decoder"| node_decoder
node_support -->|"uses runtime routines"| node_minimal_runtime
node_support -->|"uses shared types"| node_common_types
node_shellcode -.->|"uses loader definitions"| node_provider_shell
node_provider_drivers -->|"uses encryption"| node_aes
node_si_checker -->|"reads policy model"| node_si_policy
node_si_checker -->|"reads provider model"| node_provider_xml
node_taigei -.->|"supports provider access"| node_provider_drivers

click node_cli "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/main.cpp"
click node_provider_factory "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/kduprov.cpp"
click node_provider_catalog "https://github.com/hfiref0x/kdu/blob/master/Source/Tanikaze/tanikaze.h"
click node_provider_drivers "https://github.com/hfiref0x/kdu/tree/master/Source/Hamakaze/idrv"
click node_process_ops "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/ps.cpp"
click node_dse_ops "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/dsefix.cpp"
click node_driver_map "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/drvmap.cpp"
click node_shellcode "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/shellcode.cpp"
click node_victim "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/victim.h"
click node_diagnostics "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/diag.cpp"
click node_provider_listing "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/provlist.cpp"
click node_support "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/sup.cpp"
click node_ntos "https://github.com/hfiref0x/kdu/blob/master/Source/Shared/ntos/ntos.h"
click node_loader "https://github.com/hfiref0x/kdu/blob/master/Source/Shared/ldr/ldr.cpp"
click node_decoder "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/hde/hde64.c"
click node_minimal_runtime "https://github.com/hfiref0x/kdu/tree/master/Source/Shared/minirtl"
click node_common_types "https://github.com/hfiref0x/kdu/blob/master/Source/Shared/kdubase.h"
click node_provider_shell "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/idrv/ldrsc.h"
click node_wdk_support "https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/wdksup.h"
click node_aes "https://github.com/hfiref0x/kdu/blob/master/Source/Shared/thirdparty/tinyaes/aes.c"
click node_taigei "https://github.com/hfiref0x/kdu/blob/master/Source/Taigei/main.cpp"
click node_si_checker "https://github.com/hfiref0x/kdu/blob/master/Source/Utils/SiPolicyChecker/Program.cs"
click node_si_policy "https://github.com/hfiref0x/kdu/blob/master/Source/Utils/SiPolicyChecker/CSiPolicy.cs"
click node_provider_xml "https://github.com/hfiref0x/kdu/blob/master/Source/Utils/SiPolicyChecker/CProviders.cs"

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_diagnostics,node_provider_listing toneBlue
class node_process_ops,node_dse_ops,node_driver_map,node_shellcode,node_victim toneAmber
class node_provider_factory,node_provider_catalog,node_provider_drivers,node_taigei toneMint
class node_support,node_ntos,node_loader,node_decoder,node_minimal_runtime,node_common_types,node_provider_shell,node_wdk_support,node_aes toneRose
class node_si_checker,node_si_policy,node_provider_xml,node_user toneIndigo
```

## Components

### Command workflow

- [KDU command dispatcher](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/main.cpp): `Source/Hamakaze/main.cpp`
- [System diagnostics](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/diag.cpp): `Source/Hamakaze/diag.cpp`
- [Provider listing](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/provlist.cpp): `Source/Hamakaze/provlist.cpp`

### Kernel operations

- [Process protection and handles](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/ps.cpp): `Source/Hamakaze/ps.cpp`
- [DSE control](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/dsefix.cpp): `Source/Hamakaze/dsefix.cpp`
- [Driver mapping](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/drvmap.cpp): `Source/Hamakaze/drvmap.cpp`
- [Mapping shellcode](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/shellcode.cpp): `Source/Hamakaze/shellcode.cpp`
- [Victim driver support](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/victim.h): `Source/Hamakaze/victim.h`

### Provider access

- [Provider selection](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/kduprov.cpp): `Source/Hamakaze/kduprov.cpp`
- [Provider catalog](https://github.com/hfiref0x/kdu/blob/master/Source/Tanikaze/tanikaze.h): `Source/Tanikaze/tanikaze.h`
- [Provider drivers](https://github.com/hfiref0x/kdu/tree/master/Source/Hamakaze/idrv): `Source/Hamakaze/idrv`
- [Taigei companion](https://github.com/hfiref0x/kdu/blob/master/Source/Taigei/main.cpp): `Source/Taigei/main.cpp`

### Runtime support

- [Kernel and system helpers](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/sup.cpp): `Source/Hamakaze/sup.cpp`
- [Windows kernel definitions](https://github.com/hfiref0x/kdu/blob/master/Source/Shared/ntos/ntos.h): `Source/Shared/ntos/ntos.h`
- [Image loader](https://github.com/hfiref0x/kdu/blob/master/Source/Shared/ldr/ldr.cpp): `Source/Shared/ldr/ldr.cpp`
- [Instruction decoder](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/hde/hde64.c): `Source/Hamakaze/hde/hde64.c`
- [Minimal runtime](https://github.com/hfiref0x/kdu/tree/master/Source/Shared/minirtl): `Source/Shared/minirtl`
- [Shared base types](https://github.com/hfiref0x/kdu/blob/master/Source/Shared/kdubase.h): `Source/Shared/kdubase.h`
- [Driver loader definitions](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/idrv/ldrsc.h): `Source/Hamakaze/idrv/ldrsc.h`
- [WDK support](https://github.com/hfiref0x/kdu/blob/master/Source/Hamakaze/wdksup.h): `Source/Hamakaze/wdksup.h`
- [AES implementation](https://github.com/hfiref0x/kdu/blob/master/Source/Shared/thirdparty/tinyaes/aes.c): `Source/Shared/thirdparty/tinyaes/aes.c`

### Companion tools

- [Signature policy checker](https://github.com/hfiref0x/kdu/blob/master/Source/Utils/SiPolicyChecker/Program.cs): `Source/Utils/SiPolicyChecker/Program.cs`
- [Policy comparison](https://github.com/hfiref0x/kdu/blob/master/Source/Utils/SiPolicyChecker/CSiPolicy.cs): `Source/Utils/SiPolicyChecker/CSiPolicy.cs`
- [Provider metadata model](https://github.com/hfiref0x/kdu/blob/master/Source/Utils/SiPolicyChecker/CProviders.cs): `Source/Utils/SiPolicyChecker/CProviders.cs`

### Other components

- **Administrator**

## Connections

- Administrator → KDU command dispatcher: runs command
- KDU command dispatcher → Provider selection: selects provider (evidence: `Source/Hamakaze/main.cpp`)
- KDU command dispatcher → Process protection and handles: dispatches process action (evidence: `Source/Hamakaze/main.cpp`)
- KDU command dispatcher → DSE control: dispatches DSE action (evidence: `Source/Hamakaze/main.cpp`)
- KDU command dispatcher → Driver mapping: dispatches mapping (evidence: `Source/Hamakaze/main.cpp`)
- KDU command dispatcher → System diagnostics: runs diagnostics
- KDU command dispatcher → Provider listing: lists providers
- Provider selection → Provider catalog: uses catalog
- Provider selection → Provider drivers: dispatches provider
- Process protection and handles → Provider selection: uses provider access
- DSE control → Provider selection: uses provider access
- Driver mapping → Provider selection: uses provider access
- Driver mapping → Mapping shellcode: uses shellcode
- Driver mapping → Victim driver support: hijacks victim driver
- Provider drivers → Kernel and system helpers: uses system helpers
- Kernel and system helpers → Windows kernel definitions: uses kernel definitions
- Kernel and system helpers → Image loader: uses image loader
- Kernel and system helpers → Instruction decoder: uses instruction decoder
- Kernel and system helpers → Minimal runtime: uses runtime routines
- Kernel and system helpers → Shared base types: uses shared types
- Mapping shellcode → Driver loader definitions: uses loader definitions
- Provider drivers → AES implementation: uses encryption (evidence: `Source/Hamakaze/idrv/winio.cpp`)
- Signature policy checker → Policy comparison: reads policy model (evidence: `Source/Utils/SiPolicyChecker/Program.cs`)
- Signature policy checker → Provider metadata model: reads provider model (evidence: `Source/Utils/SiPolicyChecker/Program.cs`)
- Taigei companion → Provider drivers: supports provider access
