Wireshark Network Traffic Analysis by zebbern/claude-code-guide
npx skills add https://github.com/zebbern/claude-code-guide --skill 'Wireshark Network Traffic Analysis'使用 Wireshark 执行全面的网络流量分析,以捕获、过滤和检查网络数据包,用于安全调查、性能优化和故障排除。此技能支持从 PCAP 文件系统分析网络协议、检测异常和重建网络会话。
在网络接口上开始捕获数据包:
1. 启动 Wireshark
2. 从主屏幕选择网络接口
3. 点击鲨鱼鳍图标或双击接口
4. 捕获立即开始
| 操作 |
|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 快捷键 |
|---|
| 描述 |
|---|
| 开始/停止捕获 | Ctrl+E | 切换捕获开/关 |
| 重新开始捕获 | Ctrl+R | 停止并开始新的捕获 |
| 打开 PCAP 文件 | Ctrl+O | 加载现有捕获文件 |
| 保存捕获 | Ctrl+S | 保存当前捕获 |
在捕获前应用过滤器以限制数据收集:
# 仅捕获特定主机
host 192.168.1.100
# 捕获特定端口
port 80
# 捕获特定网络
net 192.168.1.0/24
# 排除特定流量
not arp
# 组合过滤器
host 192.168.1.100 and port 443
过滤捕获的数据包进行分析:
# IP 地址过滤器
ip.addr == 192.168.1.1 # 所有进出该 IP 的流量
ip.src == 192.168.1.1 # 仅源 IP
ip.dst == 192.168.1.1 # 仅目标 IP
# 端口过滤器
tcp.port == 80 # TCP 端口 80
udp.port == 53 # UDP 端口 53
tcp.dstport == 443 # 目标端口 443
tcp.srcport == 22 # 源端口 22
按特定协议过滤:
# 常见协议
http # HTTP 流量
https or ssl or tls # 加密的 Web 流量
dns # DNS 查询和响应
ftp # FTP 流量
ssh # SSH 流量
icmp # Ping/ICMP 流量
arp # ARP 请求/响应
dhcp # DHCP 流量
smb or smb2 # SMB 文件共享
识别特定的连接状态:
tcp.flags.syn == 1 # SYN 数据包(连接尝试)
tcp.flags.ack == 1 # ACK 数据包
tcp.flags.fin == 1 # FIN 数据包(连接关闭)
tcp.flags.reset == 1 # RST 数据包(连接重置)
tcp.flags.syn == 1 && tcp.flags.ack == 0 # 仅 SYN(初始连接)
搜索特定内容:
frame contains "password" # 包含字符串的数据包
http.request.uri contains "login" # 包含字符串的 HTTP URI
tcp contains "GET" # 包含字符串的 TCP 数据包
识别潜在问题:
tcp.analysis.retransmission # TCP 重传
tcp.analysis.duplicate_ack # 重复 ACK
tcp.analysis.zero_window # 零窗口(流量控制)
tcp.analysis.flags # 有问题的数据包
dns.flags.rcode != 0 # DNS 错误
使用逻辑运算符进行复杂查询:
# AND 运算符
ip.addr == 192.168.1.1 && tcp.port == 80
# OR 运算符
dns || http
# NOT 运算符
!(arp || icmp)
# 复杂组合
(ip.src == 192.168.1.1 || ip.src == 192.168.1.2) && tcp.port == 443
查看完整的 TCP 会话:
1. 右键单击任何 TCP 数据包
2. 选择 Follow > TCP Stream
3. 查看重建的会话
4. 在 ASCII、Hex、Raw 视图之间切换
5. 过滤以仅显示此流
| 流 | 访问方式 | 使用场景 |
|---|---|---|
| TCP 流 | Follow > TCP Stream | Web、文件传输、任何 TCP |
| UDP 流 | Follow > UDP Stream | DNS、VoIP、流媒体 |
| HTTP 流 | Follow > HTTP Stream | Web 内容、头部 |
| TLS 流 | Follow > TLS Stream | 加密流量(如果密钥可用) |
查看协议分布:
Statistics > Protocol Hierarchy
显示:
- 每个协议的百分比
- 数据包计数
- 传输的字节数
- 协议分解树
分析通信对:
Statistics > Conversations
标签页:
- Ethernet:MAC 地址对
- IPv4/IPv6:IP 地址对
- TCP:连接详情(端口、字节、数据包)
- UDP:数据报交换
查看活跃的网络参与者:
Statistics > Endpoints
显示:
- 所有源/目标地址
- 数据包和字节计数
- 地理信息(如果启用)
可视化数据包序列:
Statistics > Flow Graph
选项:
- 所有数据包或仅显示的数据包
- 标准流或 TCP 流
- 显示数据包时序和方向
绘制随时间变化的流量:
Statistics > I/O Graph
功能:
- 每秒数据包数
- 每秒字节数
- 自定义过滤器图表
- 多个图表叠加
识别侦察活动:
# SYN 扫描检测(许多端口,同一来源)
ip.src == SUSPECT_IP && tcp.flags.syn == 1
# 查看 Statistics > Conversations 寻找异常
# 查找单个源命中许多目标端口的情况
过滤异常情况:
# 发往异常端口的流量
tcp.dstport > 1024 && tcp.dstport < 49152
# 受信任网络之外的流量
!(ip.addr == 192.168.1.0/24)
# 异常的 DNS 查询
dns.qry.name contains "suspicious-domain"
# 大数据传输
frame.len > 1400
识别 ARP 攻击:
# 重复的 ARP 响应
arp.duplicate-address-frame
# ARP 流量分析
arp
# 查找:
# - 同一 IP 对应多个 MAC
# - 无故的 ARP 泛洪
# - 异常的 ARP 模式
分析文件传输:
# HTTP 文件下载
http.request.method == "GET" && http contains "Content-Disposition"
# 跟踪 HTTP 流以查看文件内容
# 使用 File > Export Objects > HTTP 提取文件
调查 DNS 活动:
# 所有 DNS 流量
dns
# 仅 DNS 查询
dns.flags.response == 0
# 仅 DNS 响应
dns.flags.response == 1
# 失败的 DNS 查找
dns.flags.rcode != 0
# 特定域查询
dns.qry.name contains "domain.com"
查看 Wireshark 的自动化发现:
Analyze > Expert Information
类别:
- Errors:关键问题
- Warnings:潜在问题
- Notes:信息性项目
- Chats:正常会话事件
| 发现 | 含义 | 操作 |
|---|---|---|
| TCP 重传 | 数据包重发 | 检查数据包丢失 |
| 重复 ACK | 可能丢失 | 调查网络路径 |
| 零窗口 | 缓冲区已满 | 检查接收方性能 |
| RST | 连接重置 | 检查阻塞/错误 |
| 乱序 | 数据包重新排序 | 通常正常,过多则是问题 |
| 操作 | 快捷键 |
|---|---|
| 打开文件 | Ctrl+O |
| 保存文件 | Ctrl+S |
| 开始/停止捕获 | Ctrl+E |
| 查找数据包 | Ctrl+F |
| 转到数据包 | Ctrl+G |
| 下一个数据包 | ↓ |
| 上一个数据包 | ↑ |
| 第一个数据包 | Ctrl+Home |
| 最后一个数据包 | Ctrl+End |
| 应用过滤器 | Enter |
| 清除过滤器 | Ctrl+Shift+X |
# Web 流量
http || https
# 电子邮件
smtp || pop || imap
# 文件共享
smb || smb2 || ftp
# 身份验证
ldap || kerberos
# 网络管理
snmp || icmp
# 加密
tls || ssl
File > Export Specified Packets # 保存过滤后的子集
File > Export Objects > HTTP # 提取 HTTP 文件
File > Export Packet Dissections # 导出为文本/CSV
场景:调查潜在的明文凭据传输
1. 过滤器:http.request.method == "POST"
2. 查找登录表单
3. 跟踪 HTTP 流
4. 搜索用户名/密码参数
发现:凭据以明文形式数据传输。
场景:识别命令与控制流量
1. 过滤器:dns
2. 查找异常的查询模式
3. 检查高频信标
4. 识别具有随机名称的域名
5. 过滤器:ip.dst == SUSPICIOUS_IP
6. 分析流量模式
指标:
场景:诊断缓慢的 Web 应用程序
1. 过滤器:ip.addr == WEB_SERVER
2. 检查 Statistics > Service Response Time
3. 过滤器:tcp.analysis.retransmission
4. 查看 I/O 图寻找模式
5. 检查高延迟或数据包丢失
发现:TCP 重传表明网络拥塞。
每周安装
–
仓库
GitHub Stars
3.7K
首次出现
–
安全审计
Execute comprehensive network traffic analysis using Wireshark to capture, filter, and examine network packets for security investigations, performance optimization, and troubleshooting. This skill enables systematic analysis of network protocols, detection of anomalies, and reconstruction of network conversations from PCAP files.
Begin capturing packets on network interface:
1. Launch Wireshark
2. Select network interface from main screen
3. Click shark fin icon or double-click interface
4. Capture begins immediately
| Action | Shortcut | Description |
|---|---|---|
| Start/Stop Capture | Ctrl+E | Toggle capture on/off |
| Restart Capture | Ctrl+R | Stop and start new capture |
| Open PCAP File | Ctrl+O | Load existing capture file |
| Save Capture | Ctrl+S | Save current capture |
Apply filters before capture to limit data collection:
# Capture only specific host
host 192.168.1.100
# Capture specific port
port 80
# Capture specific network
net 192.168.1.0/24
# Exclude specific traffic
not arp
# Combine filters
host 192.168.1.100 and port 443
Filter captured packets for analysis:
# IP address filters
ip.addr == 192.168.1.1 # All traffic to/from IP
ip.src == 192.168.1.1 # Source IP only
ip.dst == 192.168.1.1 # Destination IP only
# Port filters
tcp.port == 80 # TCP port 80
udp.port == 53 # UDP port 53
tcp.dstport == 443 # Destination port 443
tcp.srcport == 22 # Source port 22
Filter by specific protocols:
# Common protocols
http # HTTP traffic
https or ssl or tls # Encrypted web traffic
dns # DNS queries and responses
ftp # FTP traffic
ssh # SSH traffic
icmp # Ping/ICMP traffic
arp # ARP requests/responses
dhcp # DHCP traffic
smb or smb2 # SMB file sharing
Identify specific connection states:
tcp.flags.syn == 1 # SYN packets (connection attempts)
tcp.flags.ack == 1 # ACK packets
tcp.flags.fin == 1 # FIN packets (connection close)
tcp.flags.reset == 1 # RST packets (connection reset)
tcp.flags.syn == 1 && tcp.flags.ack == 0 # SYN-only (initial connection)
Search for specific content:
frame contains "password" # Packets containing string
http.request.uri contains "login" # HTTP URIs with string
tcp contains "GET" # TCP packets with string
Identify potential issues:
tcp.analysis.retransmission # TCP retransmissions
tcp.analysis.duplicate_ack # Duplicate ACKs
tcp.analysis.zero_window # Zero window (flow control)
tcp.analysis.flags # Packets with issues
dns.flags.rcode != 0 # DNS errors
Use logical operators for complex queries:
# AND operator
ip.addr == 192.168.1.1 && tcp.port == 80
# OR operator
dns || http
# NOT operator
!(arp || icmp)
# Complex combinations
(ip.src == 192.168.1.1 || ip.src == 192.168.1.2) && tcp.port == 443
View complete TCP conversation:
1. Right-click on any TCP packet
2. Select Follow > TCP Stream
3. View reconstructed conversation
4. Toggle between ASCII, Hex, Raw views
5. Filter to show only this stream
| Stream | Access | Use Case |
|---|---|---|
| TCP Stream | Follow > TCP Stream | Web, file transfers, any TCP |
| UDP Stream | Follow > UDP Stream | DNS, VoIP, streaming |
| HTTP Stream | Follow > HTTP Stream | Web content, headers |
| TLS Stream | Follow > TLS Stream | Encrypted traffic (if keys available) |
View protocol distribution:
Statistics > Protocol Hierarchy
Shows:
- Percentage of each protocol
- Packet counts
- Bytes transferred
- Protocol breakdown tree
Analyze communication pairs:
Statistics > Conversations
Tabs:
- Ethernet: MAC address pairs
- IPv4/IPv6: IP address pairs
- TCP: Connection details (ports, bytes, packets)
- UDP: Datagram exchanges
View active network participants:
Statistics > Endpoints
Shows:
- All source/destination addresses
- Packet and byte counts
- Geographic information (if enabled)
Visualize packet sequence:
Statistics > Flow Graph
Options:
- All packets or displayed only
- Standard or TCP flow
- Shows packet timing and direction
Plot traffic over time:
Statistics > I/O Graph
Features:
- Packets per second
- Bytes per second
- Custom filter graphs
- Multiple graph overlays
Identify reconnaissance activity:
# SYN scan detection (many ports, same source)
ip.src == SUSPECT_IP && tcp.flags.syn == 1
# Review Statistics > Conversations for anomalies
# Look for single source hitting many destination ports
Filter for anomalies:
# Traffic to unusual ports
tcp.dstport > 1024 && tcp.dstport < 49152
# Traffic outside trusted network
!(ip.addr == 192.168.1.0/24)
# Unusual DNS queries
dns.qry.name contains "suspicious-domain"
# Large data transfers
frame.len > 1400
Identify ARP attacks:
# Duplicate ARP responses
arp.duplicate-address-frame
# ARP traffic analysis
arp
# Look for:
# - Multiple MACs for same IP
# - Gratuitous ARP floods
# - Unusual ARP patterns
Analyze file transfers:
# HTTP file downloads
http.request.method == "GET" && http contains "Content-Disposition"
# Follow HTTP Stream to view file content
# Use File > Export Objects > HTTP to extract files
Investigate DNS activity:
# All DNS traffic
dns
# DNS queries only
dns.flags.response == 0
# DNS responses only
dns.flags.response == 1
# Failed DNS lookups
dns.flags.rcode != 0
# Specific domain queries
dns.qry.name contains "domain.com"
View Wireshark's automated findings:
Analyze > Expert Information
Categories:
- Errors: Critical issues
- Warnings: Potential problems
- Notes: Informational items
- Chats: Normal conversation events
| Finding | Meaning | Action |
|---|---|---|
| TCP Retransmission | Packet resent | Check for packet loss |
| Duplicate ACK | Possible loss | Investigate network path |
| Zero Window | Buffer full | Check receiver performance |
| RST | Connection reset | Check for blocks/errors |
| Out-of-Order | Packets reordered | Usually normal, excessive is issue |
| Action | Shortcut |
|---|---|
| Open file | Ctrl+O |
| Save file | Ctrl+S |
| Start/Stop capture | Ctrl+E |
| Find packet | Ctrl+F |
| Go to packet | Ctrl+G |
| Next packet | ↓ |
| Previous packet | ↑ |
| First packet | Ctrl+Home |
| Last packet | Ctrl+End |
| Apply filter | Enter |
| Clear filter | Ctrl+Shift+X |
# Web traffic
http || https
# Email
smtp || pop || imap
# File sharing
smb || smb2 || ftp
# Authentication
ldap || kerberos
# Network management
snmp || icmp
# Encrypted
tls || ssl
File > Export Specified Packets # Save filtered subset
File > Export Objects > HTTP # Extract HTTP files
File > Export Packet Dissections # Export as text/CSV
Scenario : Investigate potential plaintext credential transmission
1. Filter: http.request.method == "POST"
2. Look for login forms
3. Follow HTTP Stream
4. Search for username/password parameters
Finding : Credentials transmitted in cleartext form data.
Scenario : Identify command and control traffic
1. Filter: dns
2. Look for unusual query patterns
3. Check for high-frequency beaconing
4. Identify domains with random-looking names
5. Filter: ip.dst == SUSPICIOUS_IP
6. Analyze traffic patterns
Indicators :
Scenario : Diagnose slow web application
1. Filter: ip.addr == WEB_SERVER
2. Check Statistics > Service Response Time
3. Filter: tcp.analysis.retransmission
4. Review I/O Graph for patterns
5. Check for high latency or packet loss
Finding : TCP retransmissions indicating network congestion.
Weekly Installs
–
Repository
GitHub Stars
3.7K
First Seen
–
Security Audits
Better Auth 最佳实践指南:集成、配置与安全设置完整教程
30,300 周安装