天天看點

網絡資料包的捕獲及分析軟體簡介(下)

  自由轉載 ^_^   同時請注明原文出處:http://www.cnblogs.com/wangvsa/archive/2012/07/19/2600013.html

  

  上一篇簡單介紹了幾個捕獲資料包的工具,這篇整理一下資料包及日志分析工具。

  二、資料包及日志分析工具

  很多資料包捕獲工具記錄log采用pcap格式,是以也就有很多工具分析pcap檔案。下面簡單

介紹幾個。

  

  1.capinfos - Prints information about capture files

  這個工具比較簡潔使用,它能分析所指定的pcap檔案(一次可以多個),然後輸出很多資訊

(可以自己設定參數決定輸出想要的資訊)。capinfos -h 選項可以友善的設定參數。

  如下不加任何參數将輸出所有能夠提供的資訊:

capinfos out.pcap  // 這個out.pcap就是用logger工具記錄的pcap檔案      
1 wangchen@wangchen-Aspire-4741:~/shell_ex$ capinfos out.pcap 
 2 File name:           out.pcap
 3 File type:           Wireshark/tcpdump/... - libpcap
 4 File encapsulation:  Ethernet
 5 Packet size limit:   file hdr: 84 bytes
 6 Packet size limit:   inferred: 84 bytes
 7 Number of packets:   5279647
 8 File size:           413462964 bytes
 9 Data size:           31    111541296 bytes
10 Capture duration:    301 seconds
11 Start time:          Sat Jul 14 10:21:54 2012
12 End time:            Sat Jul 14 10:26:55 2012
13 Data byte rate:      103320871.16 bytes/sec
14 Data bit rate:       826566969.24 bits/sec
15 Average packet size: 5892.73 bytes
16 Average packet rate: 17533.61 packets/sec
17 SHA1:                b8248a65614cbeb0cfb7d2ecca697bcdbfd9b9ee
18 RIPEMD160:           ac5a2d103d873abfaa3fbbd50ae8abe123cb4755
19 MD5:                 69d559f9a6bc9503d5f0d3df2d4382c8
20 Strict time order:   False
21 wangchen@wangchen-Aspire-4741:~/shell_ex$       

  

  2. wireshark - Interactively dump and analyze network traffic

  這個是有圖形界面的,功能強大,簡單易用,界面如下:

  

  3. tcptrace - a TCP connection analysis tool

  這個軟體有兩個主要功能,一個是分析pcap檔案,找出所有tcp協定包,對所有這些包進行統計得到基于不同ip連接配接的

資訊,然後輸出到一個文本檔案中。 其二是,對pcap檔案資訊圖形化處理。

  以下是使用第一個功能,-l選項說明詳細輸出。

tcptrace -l -n out.pcap > out.log      

  下面是out.log中的一個連接配接資訊(還是很詳細的):

1 TCP connection 1:
 2     host a:        10.10.10.48:38906
 3     host b:        10.10.10.49:16797
 4     complete conn: no    (SYNs: 0)  (FINs: 0)
 5     first packet:  Sat Jul 14 10:28:05.624726 2012
 6     last packet:   Sat Jul 14 10:29:05.520813 2012
 7     elapsed time:  0:00:59.896087
 8     total packets: 443268
 9     filename:      out_1.pcap
10    a->b:                  b->a:
11      total packets:        396623           total packets:         46645      
12      ack pkts sent:        396623           ack pkts sent:         46645      
13      pure acks sent:       394695           pure acks sent:          826      
14      sack pkts sent:            0           sack pkts sent:            0      
15      dsack pkts sent:           0           dsack pkts sent:           0      
16      max sack blks/ack:         0           max sack blks/ack:         0      
17      unique bytes sent:   2306368           unique bytes sent: 2881050304      
18      actual data pkts:       1928           actual data pkts:      45819      
19      actual data bytes:   2306368           actual data bytes: 2881050304      
20      rexmt data pkts:           0           rexmt data pkts:           0      
21      rexmt data bytes:          0           rexmt data bytes:          0      
22      zwnd probe pkts:           0           zwnd probe pkts:           0      
23      zwnd probe bytes:          0           zwnd probe bytes:          0      
24      outoforder pkts:           0           outoforder pkts:           0      
25      pushed data pkts:        419           pushed data pkts:      30106      
26      SYN/FIN pkts sent:       0/0           SYN/FIN pkts sent:       0/0      
27      urgent data pkts:          0 pkts      urgent data pkts:          0 pkts 
28      urgent data bytes:         0 bytes     urgent data bytes:         0 bytes
29      mss requested:             0 bytes     mss requested:             0 bytes
30      max segm size:          1460 bytes     max segm size:         64240 bytes
31      min segm size:             4 bytes     min segm size:            32 bytes
32      avg segm size:          1196 bytes     avg segm size:         62878 bytes
33      max win adv:             382 bytes     max win adv:             382 bytes
34      min win adv:             354 bytes     min win adv:             365 bytes
35      zero win adv:              0 times     zero win adv:              0 times
36      avg win adv:             381 bytes     avg win adv:             381 bytes
37      initial window:            0 bytes     initial window:            0 bytes
38      initial window:            0 pkts      initial window:            0 pkts 
39      ttl stream length:        NA           ttl stream length:        NA      
40      missed data:              NA           missed data:              NA      
41      truncated data:      2248606 bytes     truncated data:    2879675734 bytes
42      truncated packets:      1925 pkts      truncated packets:     45819 pkts 
43      data xmit time:       59.693 secs      data xmit time:       59.895 secs 
44      idletime max:          217.1 ms        idletime max:          215.4 ms   
45      throughput:            38506 Bps       throughput:         48100810 Bps  
46 ================================      

  

  4.tcpstat — report network interface statistics

  這個工具即可以實時檢測網絡,也可以讀取pcap檔案然後産生想要的資料。而且還可以配合gnuplot使用

進行可視化(沒有需求也就沒試過~.~)。在官網上有如何可視化,點這。

  可視化效果如下(官網的圖):

  

網絡資料包的捕獲及分析軟體簡介(下)

  

  還有很多是我沒有使用過的,在tcpdump的網站裡就介紹了很多相關軟體,大家可以看一下,點這。