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

use*_*447 9 networking tcpdump

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

tcpdump -w myfile.dump
Run Code Online (Sandbox Code Playgroud)

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

我怎样才能做到这一点?

Goh*_*ohu 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
Run Code Online (Sandbox Code Playgroud)


Eli*_*ias 4

您可以使用wireshark 打开转储文件,以使用它的过滤器和统计信息来获取您想要的内容。要查看有关过滤的说明,请参阅wireshark论坛的此页面:https ://ask.wireshark.org/questions/9805/measure-the-total-transmissed-byte-in-a-time-interval