x-glacier/kali-pentest / kali-pentest-zh
kali-pentest-zh
Flagged通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。
references/forensics/tools/tcpdump.md
View on GitHub# tcpdump
- **Category**: Forensics / Traffic Analysis
- **Risk Level**: 🟢 Low
---
## 描述
几乎所有 Linux 系统均预装的命令行数据包分析器。支持实时捕获网络流量或读取 pcap 文件,提供功能强大的 BPF(Berkeley 数据包过滤器)表达式语法进行精准过滤。在渗透测试中用于捕获明文协议凭据、分析流量,以及创建供 Wireshark 离线分析的捕获文件。在无 GUI 的服务器和 Docker 环境中,是代替 Wireshark 的首选流量分析工具。
## 安装
```bash
sudo apt install tcpdump
```
## 参数说明
| 参数 | 说明 |
|------|------|
| `-i <interface>` | 要捕获的网络接口(`any` 表示所有接口) |
| `-w <file>` | 将捕获的数据包写入 pcap 文件 |
| `-r <file>` | 从 pcap 文件读取数据包 |
| `-n` | 不解析主机名 |
| `-nn` | 不解析主机名和端口名 |
| `-v / -vv / -vvv` | 详细输出(层级递增) |
| `-c <n>` | 捕获 n 个数据包后停止 |
| `-s <n>` | 快照长度(字节,0 = 完整数据包) |
| `-A` | 以 ASCII 格式打印数据包 payload |
| `-X` | 以十六进制和 ASCII 格式打印数据包 |
| `-l` | 行缓冲输出(适合管道) |
| `port <n>` | 按端口号过滤 |
| `host <ip>` | 按源或目的 IP 过滤 |
| `net <cidr>` | 按网络范围过滤 |
| `tcp / udp / icmp` | 按协议过滤 |
| `-C <size>` | 按大小轮转捕获文件(MB) |
| `-G <seconds>` | 按时间间隔轮转捕获文件 |
## 常用命令
```bash
# 捕获 eth0 上的全部流量并保存到文件
tcpdump -i eth0 -w capture.pcap
# 以 ASCII 格式显示 HTTP 流量(凭据嗅探)
tcpdump -i eth0 -A -nn port 80
# 捕获与特定主机的流量
tcpdump -i eth0 host 192.168.1.10 -w target.pcap
# 仅捕获 DNS 查询
tcpdump -i any -nn port 53
# 读取 pcap 文件并显示
tcpdump -r capture.pcap -nn
# 捕获 FTP 凭据(明文协议)
tcpdump -i eth0 -A -nn port 21
# 从任意接口捕获(适用于 Docker 和无头环境)
tcpdump -i any -nn -w capture.pcap
# 捕获 1000 个数据包后停止
tcpdump -i eth0 -c 1000 -w capture.pcap
# 行缓冲输出,便于管道到 grep
tcpdump -i eth0 -l -A -nn port 80 | grep -i "user\|pass"
```
## 注意事项
1. 始终使用 `-nn` 避免 DNS 解析拖慢捕获速度。
2. 用 `-w` 捕获到文件,再用 Wireshark 离线分析复杂协议。
3. 在 Docker 和无头环境中,tcpdump 是主要流量分析工具——Wireshark GUI 不可用。
4. 与 `strings` 或 `grep` 配合快速提取明文凭据:`tcpdump -A port 21 | grep -i "USER\|PASS"`。
5. tcpdump 的捕获文件(pcap/pcapng)与 Wireshark 完全兼容,可随时导入进行 GUI 分析。
---
## 官方参考
- [tcpdump man page](https://www.tcpdump.org/manpages/tcpdump.1.html)
- [Kali tcpdump](https://www.kali.org/tools/tcpdump/)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 472k | Updated | Claude CodeCodex | Verified | Install |
| 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: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |