# beichendream/godpotato architecture

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

- Interactive diagram: https://gitdiagram.com/beichendream/godpotato
- Repository: https://github.com/beichendream/godpotato

## Overview

GodPotato is a Windows privilege-escalation command-line tool. Its documented workflow accepts a command, initializes a DCOM/RPC trigger and named-pipe context, attempts to obtain a SYSTEM impersonation token, then uses that token to launch the command. The graph separates CLI handling, DCOM activation, token handling, and Windows interop. Relationships are based on the shown excerpts, SOURCE INDEX references, and README; unsampled implementation details are not expanded.

Main entry points: [`Program.cs`](https://github.com/beichendream/godpotato/blob/main/Program.cs) (CLI workflow), [`NativeAPI/GodPotatoContext.cs`](https://github.com/beichendream/godpotato/blob/main/NativeAPI/GodPotatoContext.cs) (RPC context), [`NativeAPI/GodPotatoUnmarshalTrigger.cs`](https://github.com/beichendream/godpotato/blob/main/NativeAPI/GodPotatoUnmarshalTrigger.cs) (Unmarshal trigger), [`NativeAPI/UnmarshalDCOM.cs`](https://github.com/beichendream/godpotato/blob/main/NativeAPI/UnmarshalDCOM.cs) (DCOM unmarshal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_program["CLI workflow<br/>[Program.cs]"]
  node_args["Argument parsing<br/>[ArgsParse.cs]"]
end

subgraph group_dcom["DCOM activation"]
  node_context["RPC context"]
  node_trigger["Unmarshal trigger"]
  node_objref["OBJREF codec<br/>[ObjRef.cs]"]
  node_unmarshal["DCOM unmarshal<br/>[UnmarshalDCOM.cs]"]
  node_istream["COM stream adapter<br/>[IStreamImpl.cs]"]
end

subgraph group_token["Token handling"]
  node_sharp["Token utilities<br/>[SharpToken.cs]"]
end

subgraph group_platform["Windows interop"]
  node_native["Native API bindings<br/>[NativeMethods.cs]"]
end

node_operator(("Service operator"))
node_rpcss["Windows RPCSS"]
node_command["Requested command"]

node_operator -->|"supplies command"| node_program
node_program -->|"parses arguments"| node_args
node_program -->|"initializes and starts"| node_context
node_program -->|"invokes trigger"| node_trigger
node_trigger -->|"parses and builds"| node_objref
node_trigger -->|"unmarshals object"| node_unmarshal
node_unmarshal -->|"wraps stream"| node_istream
node_unmarshal -->|"calls COM unmarshal"| node_native
node_context -->|"uses native bindings"| node_native
node_context -->|"checks process tokens"| node_sharp
node_program -->|"requests token"| node_context
node_context -->|"returns identity"| node_program
node_program -->|"launches command"| node_sharp
node_sharp -->|"creates process"| node_command
node_trigger -->|"triggers DCOM/RPCSS"| node_rpcss
node_native -.->|"uses Windows COM APIs"| node_rpcss

click node_program "https://github.com/beichendream/godpotato/blob/main/Program.cs"
click node_args "https://github.com/beichendream/godpotato/blob/main/ArgsParse.cs"
click node_context "https://github.com/beichendream/godpotato/blob/main/NativeAPI/GodPotatoContext.cs"
click node_trigger "https://github.com/beichendream/godpotato/blob/main/NativeAPI/GodPotatoUnmarshalTrigger.cs"
click node_objref "https://github.com/beichendream/godpotato/blob/main/NativeAPI/ObjRef.cs"
click node_unmarshal "https://github.com/beichendream/godpotato/blob/main/NativeAPI/UnmarshalDCOM.cs"
click node_istream "https://github.com/beichendream/godpotato/blob/main/NativeAPI/IStreamImpl.cs"
click node_sharp "https://github.com/beichendream/godpotato/blob/main/SharpToken.cs"
click node_native "https://github.com/beichendream/godpotato/blob/main/NativeAPI/NativeMethods.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,node_args toneBlue
class node_context,node_trigger,node_objref,node_unmarshal,node_istream toneAmber
class node_sharp,node_command toneMint
class node_native toneRose
class node_operator,node_rpcss toneIndigo
```

## Components

### Command line

- [CLI workflow](https://github.com/beichendream/godpotato/blob/main/Program.cs): `Program.cs`
- [Argument parsing](https://github.com/beichendream/godpotato/blob/main/ArgsParse.cs): `ArgsParse.cs`

### DCOM activation

- [RPC context](https://github.com/beichendream/godpotato/blob/main/NativeAPI/GodPotatoContext.cs): `NativeAPI/GodPotatoContext.cs`
- [Unmarshal trigger](https://github.com/beichendream/godpotato/blob/main/NativeAPI/GodPotatoUnmarshalTrigger.cs): `NativeAPI/GodPotatoUnmarshalTrigger.cs`
- [OBJREF codec](https://github.com/beichendream/godpotato/blob/main/NativeAPI/ObjRef.cs): `NativeAPI/ObjRef.cs`
- [DCOM unmarshal](https://github.com/beichendream/godpotato/blob/main/NativeAPI/UnmarshalDCOM.cs): `NativeAPI/UnmarshalDCOM.cs`
- [COM stream adapter](https://github.com/beichendream/godpotato/blob/main/NativeAPI/IStreamImpl.cs): `NativeAPI/IStreamImpl.cs`

### Token handling

- [Token utilities](https://github.com/beichendream/godpotato/blob/main/SharpToken.cs): `SharpToken.cs`

### Windows interop

- [Native API bindings](https://github.com/beichendream/godpotato/blob/main/NativeAPI/NativeMethods.cs): `NativeAPI/NativeMethods.cs`

### Other components

- **Service operator**
- **Windows RPCSS**
- **Requested command**

## Connections

- Service operator → CLI workflow: supplies command (evidence: `README.md`)
- CLI workflow → Argument parsing: parses arguments (evidence: `Program.cs`)
- CLI workflow → RPC context: initializes and starts (evidence: `Program.cs`)
- CLI workflow → Unmarshal trigger: invokes trigger (evidence: `Program.cs`)
- Unmarshal trigger → OBJREF codec: parses and builds (evidence: `NativeAPI/GodPotatoUnmarshalTrigger.cs`)
- Unmarshal trigger → DCOM unmarshal: unmarshals object (evidence: `NativeAPI/GodPotatoUnmarshalTrigger.cs`)
- DCOM unmarshal → COM stream adapter: wraps stream (evidence: `NativeAPI/UnmarshalDCOM.cs`)
- DCOM unmarshal → Native API bindings: calls COM unmarshal (evidence: `NativeAPI/UnmarshalDCOM.cs`)
- RPC context → Native API bindings: uses native bindings (evidence: `NativeAPI/GodPotatoContext.cs`)
- RPC context → Token utilities: checks process tokens (evidence: `NativeAPI/GodPotatoContext.cs`)
- CLI workflow → RPC context: requests token (evidence: `Program.cs`)
- RPC context → CLI workflow: returns identity (evidence: `Program.cs`)
- CLI workflow → Token utilities: launches command (evidence: `Program.cs`)
- Token utilities → Requested command: creates process (evidence: `SharpToken.cs`)
- Unmarshal trigger → Windows RPCSS: triggers DCOM/RPCSS (evidence: `README.md`)
- Native API bindings → Windows RPCSS: uses Windows COM APIs
