当我拥有由tcpdump创建的转储文件时如何测量发送的数据


9

我使用以下命令转储了网络流量:

tcpdump -w myfile.dump

现在我想知道传输了多少数据。我猜文件大小不等于传输的数据大小,因为转储文件也包含元数据。

我怎样才能做到这一点?

Answers:



8

没错,文件大小不能反映传输的数据量:pcap格式包含额外的元数据。

获取实际数据大小的一个不错的工具是使用capinfos,它是wireshark-common软件包的一部分。

输出示例,请注意数据大小值:

$ capinfos plop.pcap 
File name:           plop.pcap
File type:           Wireshark/tcpdump/... - pcap
File encapsulation:  Linux cooked-mode capture
File timestamp precision:  microseconds (6)
Packet size limit:   file hdr: 262144 bytes
Number of packets:   2049
File size:           335 kB
Data size:           302 kB
Capture duration:    88.022993 seconds
First packet time:   2017-08-22 09:48:45.233556
Last packet time:    2017-08-22 09:50:13.256549
Data byte rate:      3442 bytes/s
Data bit rate:       27 kbps
Average packet size: 147.88 bytes
Average packet rate: 23 packets/s
SHA1:                51ce5b43206995385ef7f95948848cf6a869367e
RIPEMD160:           fe861b6f16816d952c7a6c88bec63cb30246d125
MD5:                 5ee593b0a5631c42cfebdc20ff0086e7
Strict time order:   False
Number of interfaces in file: 1
Interface #0 info:
                     Encapsulation = Linux cooked-mode capture (25/113 - linux-sll)
                     Capture length = 262144
                     Time precision = microseconds (6)
                     Time ticks per second = 1000000
                     Number of stat entries = 0
                     Number of packets = 2049
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.