用Wireshark抓取TCP和UDP头结构
时间: 2023-07-25 09:33:28 浏览: 195
网络TCP/UDP抓包工具
5星 · 资源好评率100%
在Wireshark中抓取TCP和UDP头结构,可以按照以下步骤进行:
1. 打开Wireshark,并选择要抓取的网络接口。
2. 在过滤器中输入过滤规则,如 `tcp` 或 `udp`,以过滤出 TCP 或 UDP 的数据包。
3. 点击“开始捕获”按钮,开始抓取数据包。
4. 在捕获到 TCP 或 UDP 数据包后,选中该数据包并展开“Transmission Control Protocol”或“User Datagram Protocol”标签,即可查看 TCP 或 UDP 头结构。
下面是TCP头结构的示例:
```
Transmission Control Protocol, Src Port: 49366, Dst Port: 80, Seq: 1, Ack: 1, Len: 0
Source Port: 49366
Destination Port: 80
[Stream index: 0]
[TCP Segment Len: 0]
Sequence number: 1
[Next sequence number: 1]
Acknowledgment number: 1
Header Length: 20 bytes
Flags: 0x10 (ACK)
000. .... .... = Reserved: Not set
...0 .... .... = Nonce: Not set
.... 0... .... = Congestion Window Reduced (CWR): Not set
.... .0.. .... = ECN-Echo: Not set
.... ..0. .... = Urgent: Not set
.... ...0 .... = Acknowledgment: Not set
.... .... 0... = Push: Not set
.... .... .0.. = Reset: Not set
.... .... ..1. = Syn: Set
.... .... ...0 = Fin: Not set
Window size value: 64240
[Calculated window size: 64240]
Checksum: 0xb2a1 [unverified]
[Checksum Status: Unverified]
Urgent pointer: 0
Options: (20 bytes)
No-Operation (NOP)
No-Operation (NOP)
Timestamps: TSval 129214501 ecr 0
NOP
MSS: 1460
```
下面是UDP头结构的示例:
```
User Datagram Protocol, Src Port: 49366, Dst Port: 53
Source Port: 49366
Destination Port: 53
Length: 55
Checksum: 0x1e65 [unverified]
[Checksum Status: Unverified]
[Stream index: 0]
[Timestamps]
[Time since first frame: 0.000000000 seconds]
[Time since previous frame: 0.000000000 seconds]
```
阅读全文