# b4rtik/sharpkatz architecture

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

- Interactive diagram: https://gitdiagram.com/b4rtik/sharpkatz
- Repository: https://github.com/b4rtik/sharpkatz

## Overview

SharpKatz is a Windows credential and security-operation tool exposing command-line workflows for reading logon credentials and keys, extracting SAM or directory data, and running several named security operations. The main workflow parses a command, prepares Windows-version and LSASS context, then dispatches to a command-specific module; credential collection walks sessions and provider data. The README also documents standalone shadow-copy, DCSync, Zerologon, PrintNightmare, and pass-the-hash capabilities. Edges reflect README statements and SOURCE INDEX references; unsampled implementation details are not asserted.

Main entry points: [`SharpKatz/Program.cs`](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Program.cs) (Command dispatcher), [`SharpKatz/Module/LogonSessions.cs`](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/LogonSessions.cs) (Logon sessions), [`SharpKatz/Module/Msv1.cs`](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Msv1.cs) (MSV provider), [`SharpKatz/Module/DCSync.cs`](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/DCSync.cs) (Directory replication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command entry"]
  node_program["Command dispatcher<br/>[Program.cs]"]
end

subgraph group_credentials["Credential collection"]
  node_sessions["Logon sessions<br/>[LogonSessions.cs]"]
  node_msv["MSV provider<br/>[Msv1.cs]"]
  node_kerberos["Kerberos provider<br/>[Kerberos.cs]"]
  node_tspkg["TSPKG provider<br/>[Tspkg.cs]"]
  node_credman["Credman provider<br/>[CredMan.cs]"]
  node_wdigest["WDigest provider<br/>[WDigest.cs]"]
  node_ssp["SSP provider<br/>[Ssp.cs]"]
  node_credential["Credential records<br/>[Credential.cs]"]
  node_keys["LSA key discovery<br/>[Keys.cs]"]
end

subgraph group_operations["Security operations"]
  node_pth["Pass-the-hash<br/>[Pth.cs]"]
  node_sam["SAM extraction<br/>[Sam.cs]"]
  node_shadow["Shadow copies<br/>[Shadow.cs]"]
  node_dcsync["Directory replication<br/>[DCSync.cs]"]
  node_zerologon["Zerologon<br/>[Zerologon.cs]"]
  node_printnightmare["PrintNightmare<br/>[PrintNightmare.cs]"]
end

subgraph group_platform["Windows internals"]
  node_osversion["Build adaptation<br/>[OSVersionHelper.cs]"]
  node_winbuild["Build layouts"]
  node_utility["Memory utilities<br/>[Utility.cs]"]
  node_natives["Windows API bindings<br/>[Natives.cs]"]
  node_crypto["Credential crypto<br/>[BCrypt.cs]"]
  node_aes["AES routines<br/>[GenericAes128.cs]"]
end

node_user(("Operator"))
node_lsass(("LSASS process"))
node_domaincontroller(("Domain controller"))
node_output[("Temporary export")]

node_user -->|"selects command"| node_program
node_program -->|"collects sessions"| node_sessions
node_program -->|"dispatches provider"| node_msv
node_program -->|"dispatches provider"| node_kerberos
node_program -->|"dispatches provider"| node_tspkg
node_program -->|"dispatches provider"| node_credman
node_program -->|"dispatches provider"| node_wdigest
node_program -.->|"dispatches provider"| node_ssp
node_program -->|"retrieves keys"| node_keys
node_program -->|"dispatches command"| node_pth
node_program -->|"dispatches command"| node_sam
node_program -->|"dispatches command"| node_shadow
node_program -->|"dispatches command"| node_dcsync
node_program -->|"dispatches command"| node_zerologon
node_program -->|"dispatches command"| node_printnightmare
node_program -->|"initializes build"| node_osversion
node_program -->|"opens process"| node_lsass
node_sessions -.->|"reads provider data"| node_msv
node_sessions -->|"creates records"| node_credential
node_msv -->|"creates records"| node_credential
node_kerberos -->|"creates records"| node_credential
node_tspkg -->|"creates records"| node_credential
node_sessions -->|"reads memory"| node_lsass
node_msv -->|"uses memory helpers"| node_utility
node_kerberos -->|"uses memory helpers"| node_utility
node_tspkg -->|"uses memory helpers"| node_utility
node_credman -->|"decrypts credentials"| node_crypto
node_wdigest -->|"uses crypto"| node_crypto
node_sam -->|"uses AES routines"| node_aes
node_osversion -->|"selects layout"| node_winbuild
node_utility -->|"uses native calls"| node_natives
node_dcsync -->|"replicates directory"| node_domaincontroller
node_dcsync -->|"writes export"| node_output
node_zerologon -->|"can trigger dump"| node_dcsync
node_shadow -.->|"supplies hive source"| node_sam

click node_program "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Program.cs"
click node_sessions "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/LogonSessions.cs"
click node_msv "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Msv1.cs"
click node_kerberos "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Kerberos.cs"
click node_tspkg "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Tspkg.cs"
click node_credman "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/CredMan.cs"
click node_wdigest "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/WDigest.cs"
click node_ssp "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Ssp.cs"
click node_credential "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Credential/Credential.cs"
click node_keys "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Keys.cs"
click node_pth "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Pth.cs"
click node_sam "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Sam.cs"
click node_shadow "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Shadow.cs"
click node_dcsync "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/DCSync.cs"
click node_zerologon "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Zerologon.cs"
click node_printnightmare "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/PrintNightmare.cs"
click node_osversion "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/OSVersionHelper.cs"
click node_winbuild "https://github.com/b4rtik/sharpkatz/tree/master/SharpKatz/WinBuild"
click node_utility "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Utility.cs"
click node_natives "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Win32/Natives.cs"
click node_crypto "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Crypto/BCrypt.cs"
click node_aes "https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Crypto/GenericAes128.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_program toneBlue
class node_sessions,node_msv,node_kerberos,node_tspkg,node_credman,node_wdigest,node_ssp,node_credential,node_keys,node_output toneAmber
class node_pth,node_sam,node_shadow,node_dcsync,node_zerologon,node_printnightmare toneMint
class node_osversion,node_winbuild,node_utility,node_natives,node_crypto,node_aes toneRose
class node_user,node_lsass,node_domaincontroller toneIndigo
```

## Components

### Command entry

- [Command dispatcher](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Program.cs): `SharpKatz/Program.cs`

### Credential collection

- [Logon sessions](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/LogonSessions.cs): `SharpKatz/Module/LogonSessions.cs`
- [MSV provider](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Msv1.cs): `SharpKatz/Module/Msv1.cs`
- [Kerberos provider](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Kerberos.cs): `SharpKatz/Module/Kerberos.cs`
- [TSPKG provider](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Tspkg.cs): `SharpKatz/Module/Tspkg.cs`
- [Credman provider](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/CredMan.cs): `SharpKatz/Module/CredMan.cs`
- [WDigest provider](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/WDigest.cs): `SharpKatz/Module/WDigest.cs`
- [SSP provider](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Ssp.cs): `SharpKatz/Module/Ssp.cs`
- [Credential records](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Credential/Credential.cs): `SharpKatz/Credential/Credential.cs`
- [LSA key discovery](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Keys.cs): `SharpKatz/Keys.cs`

### Security operations

- [Pass-the-hash](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Pth.cs): `SharpKatz/Module/Pth.cs`
- [SAM extraction](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Sam.cs): `SharpKatz/Module/Sam.cs`
- [Shadow copies](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Shadow.cs): `SharpKatz/Module/Shadow.cs`
- [Directory replication](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/DCSync.cs): `SharpKatz/Module/DCSync.cs`
- [Zerologon](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/Zerologon.cs): `SharpKatz/Module/Zerologon.cs`
- [PrintNightmare](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Module/PrintNightmare.cs): `SharpKatz/Module/PrintNightmare.cs`

### Windows internals

- [Build adaptation](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/OSVersionHelper.cs): `SharpKatz/OSVersionHelper.cs`
- [Build layouts](https://github.com/b4rtik/sharpkatz/tree/master/SharpKatz/WinBuild): `SharpKatz/WinBuild`
- [Memory utilities](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Utility.cs): `SharpKatz/Utility.cs`
- [Windows API bindings](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Win32/Natives.cs): `SharpKatz/Win32/Natives.cs`
- [Credential crypto](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Crypto/BCrypt.cs): `SharpKatz/Crypto/BCrypt.cs`
- [AES routines](https://github.com/b4rtik/sharpkatz/blob/master/SharpKatz/Crypto/GenericAes128.cs): `SharpKatz/Crypto/GenericAes128.cs`

### Other components

- **Operator**
- **LSASS process**
- **Domain controller**
- **Temporary export**

## Connections

- Operator → Command dispatcher: selects command (evidence: `README.md`)
- Command dispatcher → Logon sessions: collects sessions (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → MSV provider: dispatches provider (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → Kerberos provider: dispatches provider (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → TSPKG provider: dispatches provider (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → Credman provider: dispatches provider (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → WDigest provider: dispatches provider (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → SSP provider: dispatches provider
- Command dispatcher → LSA key discovery: retrieves keys (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → Pass-the-hash: dispatches command (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → SAM extraction: dispatches command (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → Shadow copies: dispatches command (evidence: `README.md`)
- Command dispatcher → Directory replication: dispatches command (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → Zerologon: dispatches command (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → PrintNightmare: dispatches command (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → Build adaptation: initializes build (evidence: `SharpKatz/Program.cs`)
- Command dispatcher → LSASS process: opens process (evidence: `SharpKatz/Program.cs`)
- Logon sessions → MSV provider: reads provider data
- Logon sessions → Credential records: creates records (evidence: `SharpKatz/Module/LogonSessions.cs`)
- MSV provider → Credential records: creates records (evidence: `SharpKatz/Module/Msv1.cs`)
- Kerberos provider → Credential records: creates records (evidence: `SharpKatz/Module/Kerberos.cs`)
- TSPKG provider → Credential records: creates records (evidence: `SharpKatz/Module/Tspkg.cs`)
- Logon sessions → LSASS process: reads memory (evidence: `SharpKatz/Module/LogonSessions.cs`)
- MSV provider → Memory utilities: uses memory helpers (evidence: `SharpKatz/Module/Msv1.cs`)
- Kerberos provider → Memory utilities: uses memory helpers (evidence: `SharpKatz/Module/Kerberos.cs`)
- TSPKG provider → Memory utilities: uses memory helpers (evidence: `SharpKatz/Module/Tspkg.cs`)
- Credman provider → Credential crypto: decrypts credentials (evidence: `SharpKatz/Module/CredMan.cs`)
- WDigest provider → Credential crypto: uses crypto (evidence: `SharpKatz/Module/WDigest.cs`)
- SAM extraction → AES routines: uses AES routines (evidence: `SharpKatz/Module/Sam.cs`)
- Build adaptation → Build layouts: selects layout (evidence: `SharpKatz/OSVersionHelper.cs`)
- Memory utilities → Windows API bindings: uses native calls (evidence: `SharpKatz/Utility.cs`)
- Directory replication → Domain controller: replicates directory (evidence: `README.md`)
- Directory replication → Temporary export: writes export (evidence: `SharpKatz/Module/DCSync.cs`)
- Zerologon → Directory replication: can trigger dump (evidence: `SharpKatz/Module/Zerologon.cs`)
- Shadow copies → SAM extraction: supplies hive source
