Wireshark数据包分析 各层分析

wireshark是非常流行的网络封包分析软件,功能十分强大。可以截取各种网络封包,显示网络封包的详细信息。使用wireshark的人必须了解网络协议,否则就看不懂wireshark了。
为了安全考虑,wireshark只能查看封包,而不能修改封包的内容,或者发送封包。

wireshark能获取HTTP,也能获取HTTPS,但是不能解密HTTPS,所以wireshark看不懂HTTPS中的内容,总结,如果是处理HTTP,HTTPS 还是用Fiddler, 其他协议比如TCP,UDP 就用wireshark.

Wireshark数据包分析
各层分析

随便打开一个包

 Wireshark数据包分析
各层分析

  • Frame:物理层的数据帧概况。
  • Ethernet II:数据链路层以太网帧头部信息。
  • Internet Protocol Version 4:互联网层IP包头部信息。
  • Transmission Control Protocol:传输层的数据段头部信息,此处是TCP协议。
  • User Datagram Protocol:UDP协议
  • Hypertext Transfer Protocol:应用层的信息,此处是HTTP协议

一、物理层Frame

1    -Frame 5: 66 bytes on wire (528 bits), 66 bytes captured(捕获) (528 bits) on interface 0 //5号帧,对方发送66字节,实际收到66字节

2

3     -Interface id: 0 (DeviceNPF_{37239901-4A63-419C-9693-97957A8232CD}) //接口id为0

4

5     -Encapsulation type: Ethernet (1) //封装类型

6

7     -Arrival Time: Jul 5, 2017 15:14:31.865685000 //捕获日期和时间(中国标准时间)

8

9      -[Time shift for this packet: 0.000000000 seconds]

10    -Epoch Time: 1499238871.865685000 seconds

11    -[Time delta from previous captured frame: 0.006861000 seconds] //与前一包时间间隔

12    -[Time delta from previous displayed frame: 0.006861000 seconds]

13    -[Time since reference or first frame: 0.613985000 seconds] //#此包与第一帧的时间间隔

14

15     -Frame Number: 5 //帧序号

16    -Frame Length: 66 bytes (528 bits) //帧长度

17    -Capture Length: 66 bytes (528 bits) //捕获字节长度

18    -[Frame is marked: False] //是否做了标记

19    -[Frame is ignored: False] //是否被忽略

20    -[Protocols in frame: eth:ethertype:ip:tcp] //帧内封装的协议层次结构

21    -[Coloring Rule Name: HTTP] //着色标记的协议名称

22    -[Coloring Rule String: http || tcp.port == 80 || http2] //着色规则显示的字符串

二、数据链路层以太网帧头部信息

   -Ethernet II, Src: Tp-LinkT_f5:3e:62 (c0:61:18:f5:3e:62), Dst: IntelCor_09:65:a5 (58:fb:84:09:65:a5)

2

3    - Destination: IntelCor_09:65:a5 (58:fb:84:09:65:a5) //目的MAC地址

4    - Source: Tp-LinkT_f5:3e:62 (c0:61:18:f5:3e:62) //源MAC地址(就是我电脑的MAC地址)

5    - Type: IPv4 (0x0800) //0x0800表示使用IP协议

Wireshark数据包分析
各层分析

三、互联网层IP包头部信息

     Internet Protocol Version 4, Src: 192.168.2.112, Dst: 116.211.185.142

           0100 .... = Version: 4 //IPV4协议

3            .... 0101 = Header Length: 20 bytes (5) //包头长度

4    

5      -Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) //差分服务字段

6      -Total Length: 52 //IP包总长度

7      -Identification: 0x3849 (14409) //标识字段

8      -Flags: 0x02 (Don't Fragment) //标记字段

9      -Fragment offset: 0 //分段偏移量

10    -Time to live: 128 //生存期TTL

11    -Protocol: TCP (6) //此包内封装的上层协议为TCP

12    -Header checksum: 0xd100 [validation disabled] //头部数据的校验和

13    -[Header checksum status: Unverified] //头部数据校验状态

14    -Source: 192.168.2.112 //源IP地址

15    -Destination: 116.211.185.142 //目的IP地址

16    -[Destination GeoIP: Unknown]

17    -[Destination GeoIP: Unknown]

四、传输层TCP数据段头部信息

1     Transmission Control Protocol, Src Port: 60606, Dst Port: 80, Seq: 0, Len: 0

2     

3     -Source Port: 60606 //源端口号(ecbe)

    -Destination Port: 80 //目的端口号(0050)

    -[Stream index: 0]

    -[TCP Segment Len: 0]

    -Sequence number: 0 (relative sequence number) //序列号(相对序列号)(四个字节fd 3e dd a2)

8     -Acknowledgment number: 0 //确认号(四个字节00 00 00 00)

9     -Header Length: 32 bytes //头部长度(0x80)

10   -Flags: 0x002 (SYN) //TCP标记字段

11   -Window size value: 8192 //流量控制的窗口大小(20 00)

12   -[Calculated window size: 8192]

13   -Checksum: 0x97ad [unverified] //数据段的校验和(97 ad)

14   -[Checksum Status: Unverified]

15   -Urgent pointer: 0 //紧急指针(00 00)

16   -Options: (12 bytes), Maximum segment size, No-Operation (NOP), Window scale, No-Operation (NOP), No-Operation (NOP), SACK permitted //选项(可变长度

五、UDP数据段首部

1      User Datagram Protocol, Src Port: 7273, Dst Port: 15030

2      -Source Port: 7273 //源端口(1c 69)    

3     -Destination Port: 15030 //目的端口(3a 6b)

4     -Length: 1410 //长度(05 82)

5     -Checksum: 0xd729 [unverified] //校验和(d7 29)

6     -[Checksum Status: Unverified]

7     -[Stream index: 6335]

参考博客:https://my.oschina.net/u/1585857/blog/479306
Wireshark的常见几种过滤方法

-Length: 1410 //长度(05 82)