# ustayready/sharphose architecture

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

- Interactive diagram: https://gitdiagram.com/ustayready/sharphose
- Repository: https://github.com/ustayready/sharphose

## Overview

SharpHose is a command-line Active Directory password-spraying and account-policy inspection tool. Its main workflow parses CLI options, configures the LDAP nozzle, discovers users and password policies, classifies users for lockout safety, applies exclusions, and attempts asynchronous password checks; it also reports policies, policy users, and enabled users. The graph includes the shared nozzle/configuration layer and output logging. Some LDAP implementation details are unsampled, so internal links beyond excerpted or documented behavior are omitted.

Main entry points: [`SharpHose/Nozzles/LDAP/LDAPNozzle.cs`](https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPNozzle.cs) (LDAP nozzle), [`SharpHose/Program.cs`](https://github.com/ustayready/sharphose/blob/master/SharpHose/Program.cs) (Command routing), [`SharpHose/Common/Objects/CLIOptions.cs`](https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Objects/CLIOptions.cs) (CLI options), [`SharpHose/Nozzles/LDAP/LDAPConfig.cs`](https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPConfig.cs) (LDAP configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_cli["CLI options<br/>[CLIOptions.cs]"]
  node_program["Command routing<br/>[Program.cs]"]
end

subgraph group_framework["Shared nozzle framework"]
  node_nozzle_contract["Nozzle contract and states"]
  node_nozzle_base["Nozzle base<br/>[Nozzle.cs]"]
  node_config_base["Base configuration<br/>[NozzleConfig.cs]"]
end

subgraph group_ldap["LDAP operations"]
  node_ldap_config["LDAP configuration<br/>[LDAPConfig.cs]"]
  node_ldap_action["LDAP actions<br/>[LDAPAction.cs]"]
  node_ldap_nozzle["LDAP nozzle<br/>[LDAPNozzle.cs]"]
  node_domain_context["Domain context detection<br/>[ContextHelper.cs]"]
  node_ldap_user["LDAP user records<br/>[LDAPUserInfo.cs]"]
  node_ldap_extensions["LDAP policy helpers<br/>[LDAPExtensions.cs]"]
end

subgraph group_output["Results and logging"]
  node_logger["Console logger"]
end

node_operator(("Operator"))
node_ad[("Active Directory")]
node_exclusions["Exclusion list"]
node_results["Console or output files"]

node_operator -->|"provides options"| node_cli
node_cli -->|"supplies parsed options"| node_program
node_program -->|"builds configuration"| node_ldap_config
node_program -->|"dispatches actions"| node_ldap_nozzle
node_program -->|"routes action values"| node_ldap_action
node_ldap_config -->|"extends"| node_config_base
node_ldap_nozzle -->|"inherits"| node_nozzle_base
node_ldap_nozzle -->|"checks join context"| node_domain_context
node_ldap_nozzle -->|"constructs user records"| node_ldap_user
node_ldap_nozzle -->|"queries policies and users"| node_ad
node_ldap_nozzle -->|"checks credentials"| node_ad
node_ldap_nozzle -->|"filters spray targets"| node_exclusions
node_ldap_nozzle -.->|"uses policy helpers"| node_ldap_extensions
node_ldap_nozzle -->|"logs progress"| node_logger
node_ldap_nozzle -->|"writes reports"| node_results
node_logger -->|"prints messages"| node_results

click node_cli "https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Objects/CLIOptions.cs"
click node_program "https://github.com/ustayready/sharphose/blob/master/SharpHose/Program.cs"
click node_nozzle_contract "https://github.com/ustayready/sharphose/tree/master/SharpHose/Common"
click node_nozzle_base "https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Objects/Nozzle.cs"
click node_config_base "https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Objects/NozzleConfig.cs"
click node_ldap_config "https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPConfig.cs"
click node_ldap_action "https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPAction.cs"
click node_ldap_nozzle "https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPNozzle.cs"
click node_domain_context "https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Helpers/ContextHelper.cs"
click node_ldap_user "https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPUserInfo.cs"
click node_ldap_extensions "https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPExtensions.cs"
click node_logger "https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Helpers/BaseLoggerHelper.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_program toneBlue
class node_nozzle_contract,node_nozzle_base,node_config_base,node_ad toneAmber
class node_ldap_config,node_ldap_action,node_ldap_nozzle,node_domain_context,node_ldap_user,node_ldap_extensions toneMint
class node_logger toneRose
class node_operator,node_exclusions,node_results toneIndigo
```

## Components

### CLI entry

- [CLI options](https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Objects/CLIOptions.cs): `SharpHose/Common/Objects/CLIOptions.cs`
- [Command routing](https://github.com/ustayready/sharphose/blob/master/SharpHose/Program.cs): `SharpHose/Program.cs`

### Shared nozzle framework

- [Nozzle contract and states](https://github.com/ustayready/sharphose/tree/master/SharpHose/Common): `SharpHose/Common`
- [Nozzle base](https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Objects/Nozzle.cs): `SharpHose/Common/Objects/Nozzle.cs`
- [Base configuration](https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Objects/NozzleConfig.cs): `SharpHose/Common/Objects/NozzleConfig.cs`

### LDAP operations

- [LDAP configuration](https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPConfig.cs): `SharpHose/Nozzles/LDAP/LDAPConfig.cs`
- [LDAP actions](https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPAction.cs): `SharpHose/Nozzles/LDAP/LDAPAction.cs`
- [LDAP nozzle](https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPNozzle.cs): `SharpHose/Nozzles/LDAP/LDAPNozzle.cs`
- [Domain context detection](https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Helpers/ContextHelper.cs): `SharpHose/Common/Helpers/ContextHelper.cs`
- [LDAP user records](https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPUserInfo.cs): `SharpHose/Nozzles/LDAP/LDAPUserInfo.cs`
- [LDAP policy helpers](https://github.com/ustayready/sharphose/blob/master/SharpHose/Nozzles/LDAP/LDAPExtensions.cs): `SharpHose/Nozzles/LDAP/LDAPExtensions.cs`

### Results and logging

- [Console logger](https://github.com/ustayready/sharphose/blob/master/SharpHose/Common/Helpers/BaseLoggerHelper.cs): `SharpHose/Common/Helpers/BaseLoggerHelper.cs`

### Other components

- **Operator**
- **Active Directory**
- **Exclusion list**
- **Console or output files**

## Connections

- Operator → CLI options: provides options (evidence: `README.md`)
- CLI options → Command routing: supplies parsed options (evidence: `SharpHose/Program.cs`)
- Command routing → LDAP configuration: builds configuration (evidence: `SharpHose/Program.cs`)
- Command routing → LDAP nozzle: dispatches actions (evidence: `SharpHose/Program.cs`)
- Command routing → LDAP actions: routes action values (evidence: `SharpHose/Program.cs`)
- LDAP configuration → Base configuration: extends (evidence: `SharpHose/Nozzles/LDAP/LDAPConfig.cs`)
- LDAP nozzle → Nozzle base: inherits (evidence: `SharpHose/Nozzles/LDAP/LDAPNozzle.cs`)
- LDAP nozzle → Domain context detection: checks join context (evidence: `SharpHose/Nozzles/LDAP/LDAPNozzle.cs`)
- LDAP nozzle → LDAP user records: constructs user records (evidence: `SharpHose/Nozzles/LDAP/LDAPNozzle.cs`)
- LDAP nozzle → Active Directory: queries policies and users (evidence: `README.md`)
- LDAP nozzle → Active Directory: checks credentials (evidence: `README.md`)
- LDAP nozzle → Exclusion list: filters spray targets (evidence: `SharpHose/Nozzles/LDAP/LDAPNozzle.cs`)
- LDAP nozzle → LDAP policy helpers: uses policy helpers
- LDAP nozzle → Console logger: logs progress (evidence: `SharpHose/Nozzles/LDAP/LDAPNozzle.cs`)
- LDAP nozzle → Console or output files: writes reports (evidence: `SharpHose/Nozzles/LDAP/LDAPNozzle.cs`)
- Console logger → Console or output files: prints messages (evidence: `SharpHose/Common/Helpers/BaseLoggerHelper.cs`)
