當我有 tcpdump 創建的轉儲文件時如何測量發送的數據

當我有 tcpdump 創建的轉儲文件時如何測量發送的數據

我使用以下命令轉儲網路流量:

tcpdump -w myfile.dump

現在我想知道傳輸了多少數據。我猜想檔案大小不等於傳輸的資料大小,因為轉儲檔案也包含元資料。

我怎樣才能做到這一點?

答案1

您可以使用wireshark 打開轉儲文件,以使用它的過濾器和統計資訊來獲取您想要的內容。要查看有關過濾的說明,請參閱wireshark論壇中的此頁面:https://ask.wireshark.org/questions/9805/measure-the-total-transmissed-byte-in-a-time-interval

答案2

你是對的,檔案大小並不反映傳輸的資料量:pcap 格式包含額外的元資料。

獲取實際資料大小的一個很好的工具是使用卡普資訊系統這是包的一部分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

相關內容