How sensepost/impersonate works
Impersonate is a Windows token-manipulation toolkit. Its main workflow scans system handles for available tokens, displays them for selection, then uses a selected token to launch a command or perform the documented add-user privilege escalation. The repository also provides a CrackMapExec Python module with an embedded binary, a corresponding CME binary, and a separate token-listing example. The C++ excerpts support the scan and execution relationships; Python-module behavior is described only at a high level in the README.
Main entry points: Impersonate/Impersonate.cpp Standalone tool · impersonate.py CME Python module · Impersonate/Impersonate.cpp CME binary · list_tokens.c Token-list example
Components 15
Tool interfaces
- Standalone tool
Impersonate/Impersonate/Impersonate.cpp - CME Python module
impersonate.py - CME binary
CME_module/Impersonate/Impersonate.cpp - Embedded executable
impersonate.py
Token workflow
- Token discovery
Impersonate/Impersonate/Impersonate.cpp - Token metadata
Impersonate/Impersonate/Impersonate.cpp - Token listing
Impersonate/Impersonate/Impersonate.cpp - Token selection
Impersonate/Impersonate/Impersonate.cpp - CME token tool
CME_module/Impersonate/Impersonate.cpp
Token actions
- Command execution
Impersonate/Impersonate/Impersonate.cpp - Domain add-user
Impersonate/Impersonate/Impersonate.cpp
Related code
- Token-list example
list_tokens.c
Other components
- Operator
- Windows host
- Domain controller
Connections 15
- Operator → Standalone tool: runs
README.md - Standalone tool → Token discovery: scans handles
Impersonate/Impersonate/Impersonate.cpp - Token discovery → Token metadata: reads metadata
Impersonate/Impersonate/Impersonate.cpp - Standalone tool → Token listing: lists tokens
Impersonate/Impersonate/Impersonate.cpp - Standalone tool → Token selection: selects token
Impersonate/Impersonate/Impersonate.cpp - Token selection → Command execution: executes command
Impersonate/Impersonate/Impersonate.cpp - Token selection → Domain add-user: adds account
README.md - Command execution → Windows host: starts process
Impersonate/Impersonate/Impersonate.cpp - Domain add-user → Domain controller: adds domain user
- Operator → CME Python module: uses module
README.md - CME Python module → Embedded executable: embeds binary
README.md - Operator → CME binary: runs
README.md - CME binary → CME token tool: scans tokens
CME_module/Impersonate/Impersonate.cpp - Operator → Token-list example: runs example
README.md - Token-list example → Windows host: queries handles
list_tokens.c