# itm4n/printspoofer architecture

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

- Interactive diagram: https://gitdiagram.com/itm4n/printspoofer
- Repository: https://github.com/itm4n/printspoofer

## Overview

PrintSpoofer is a Windows privilege-escalation command-line tool: given SeImpersonatePrivilege, it uses the Print Spooler named-pipe/RPC path to obtain an impersonated SYSTEM token, then launches a requested command interactively, detached, or on a selected session desktop. The main workflow and generated RPC interface are represented; the RPC server stub is included as a substantial core module. Source excerpts omit portions of the main control flow, so only documented or excerpt-visible relationships are connected.

Main entry points: [`PrintSpoofer/PrintSpoofer.cpp`](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp) (CLI and workflow), [`PrintSpoofer/ms-rprn_c.c`](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/ms-rprn_c.c) (RPC client stubs), [`PrintSpoofer/ms-rprn_h.h`](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/ms-rprn_h.h) (Spooler RPC interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command workflow"]
  node_entry["CLI and workflow<br/>[PrintSpoofer.cpp]"]
  node_privilege["Privilege check<br/>[PrintSpoofer.cpp]"]
end

subgraph group_ipc["Spooler IPC"]
  node_pipe["Named pipe setup<br/>[PrintSpoofer.cpp]"]
  node_trigger["Spooler trigger<br/>[PrintSpoofer.cpp]"]
  node_rpcbinding["RPC binding<br/>[PrintSpoofer.cpp]"]
  node_rpcclient["RPC client stubs<br/>[ms-rprn_c.c]"]
  node_rpcinterface["Spooler RPC interface<br/>[ms-rprn_h.h]"]
  node_rpcserver["RPC server stubs<br/>[ms-rprn_s.c]"]
end

subgraph group_execution["SYSTEM execution"]
  node_impersonation["Pipe impersonation<br/>[PrintSpoofer.cpp]"]
  node_systemtoken["SYSTEM token<br/>[PrintSpoofer.cpp]"]
  node_process["Command launch<br/>[PrintSpoofer.cpp]"]
end

node_operator(("Tool operator"))
node_spooler["Windows Print Spooler"]
node_console(("Interactive console"))
node_desktop(("Session desktop"))

node_operator -->|"runs command"| node_entry
node_entry -->|"checks privilege"| node_privilege
node_entry -->|"sets up pipe"| node_pipe
node_entry -->|"starts trigger"| node_trigger
node_trigger -->|"binds RPC"| node_rpcbinding
node_rpcbinding -->|"calls stubs"| node_rpcclient
node_rpcclient -->|"contacts service"| node_spooler
node_rpcclient -->|"uses definitions"| node_rpcinterface
node_pipe -->|"accepts client"| node_impersonation
node_impersonation -->|"duplicates token"| node_systemtoken
node_systemtoken -->|"launches process"| node_process
node_process -->|"interacts with"| node_console
node_process -->|"targets session"| node_desktop

click node_entry "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp"
click node_privilege "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp"
click node_pipe "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp"
click node_trigger "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp"
click node_rpcbinding "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp"
click node_rpcclient "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/ms-rprn_c.c"
click node_rpcinterface "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/ms-rprn_h.h"
click node_rpcserver "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/ms-rprn_s.c"
click node_impersonation "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp"
click node_systemtoken "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp"
click node_process "https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp"

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_entry,node_privilege toneBlue
class node_pipe,node_trigger,node_rpcbinding,node_rpcclient,node_rpcinterface,node_rpcserver toneAmber
class node_impersonation,node_systemtoken,node_process toneMint
class node_operator,node_spooler,node_console,node_desktop toneIndigo
```

## Components

### Command workflow

- [CLI and workflow](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp): `PrintSpoofer/PrintSpoofer.cpp`
- [Privilege check](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp): `PrintSpoofer/PrintSpoofer.cpp`

### Spooler IPC

- [Named pipe setup](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp): `PrintSpoofer/PrintSpoofer.cpp`
- [Spooler trigger](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp): `PrintSpoofer/PrintSpoofer.cpp`
- [RPC binding](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp): `PrintSpoofer/PrintSpoofer.cpp`
- [RPC client stubs](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/ms-rprn_c.c): `PrintSpoofer/ms-rprn_c.c`
- [Spooler RPC interface](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/ms-rprn_h.h): `PrintSpoofer/ms-rprn_h.h`
- [RPC server stubs](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/ms-rprn_s.c): `PrintSpoofer/ms-rprn_s.c`

### SYSTEM execution

- [Pipe impersonation](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp): `PrintSpoofer/PrintSpoofer.cpp`
- [SYSTEM token](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp): `PrintSpoofer/PrintSpoofer.cpp`
- [Command launch](https://github.com/itm4n/printspoofer/blob/master/PrintSpoofer/PrintSpoofer.cpp): `PrintSpoofer/PrintSpoofer.cpp`

### Other components

- **Tool operator**
- **Windows Print Spooler**
- **Interactive console**
- **Session desktop**

## Connections

- Tool operator → CLI and workflow: runs command (evidence: `README.md`)
- CLI and workflow → Privilege check: checks privilege (evidence: `PrintSpoofer/PrintSpoofer.cpp`)
- CLI and workflow → Named pipe setup: sets up pipe (evidence: `PrintSpoofer/PrintSpoofer.cpp`)
- CLI and workflow → Spooler trigger: starts trigger (evidence: `PrintSpoofer/PrintSpoofer.cpp`)
- Spooler trigger → RPC binding: binds RPC (evidence: `PrintSpoofer/PrintSpoofer.cpp`)
- RPC binding → RPC client stubs: calls stubs (evidence: `PrintSpoofer/PrintSpoofer.cpp`)
- RPC client stubs → Windows Print Spooler: contacts service (evidence: `README.md`)
- RPC client stubs → Spooler RPC interface: uses definitions (evidence: `PrintSpoofer/ms-rprn_c.c`)
- Named pipe setup → Pipe impersonation: accepts client (evidence: `PrintSpoofer/PrintSpoofer.cpp`)
- Pipe impersonation → SYSTEM token: duplicates token (evidence: `PrintSpoofer/PrintSpoofer.cpp`)
- SYSTEM token → Command launch: launches process (evidence: `README.md`)
- Command launch → Interactive console: interacts with (evidence: `README.md`)
- Command launch → Session desktop: targets session (evidence: `README.md`)
