Tool: TCP Stream Analysis |
TCP/IP stream analysis toolThis tool is part of a series of utilities meant to illustrate the use of the Unsniff Scripting API and to motivate you to write your own tools.TCP is arguably the most important protocol in the internet today. Under the hood, TCP features complex algorithms for congestion control. TCP attempts to seek the ideal bandwidth rate dynamically on any given link. It constantly attempts to push the transfer rate higher and periodically pulling back when it encounters errors. Observing the behavior of TCP is quite a revealing experience about rate control and error recovery. We present a utility here that detects retransmissions, out of order segments, duplicate acks. It can produce charts that plot the congestion window, advertised window, in-flight data, sequence number analysis and much more. TCP/IP AnalysisQuick Info This tool demonstrates the following conceptsUsing the Unsniff Scripting API to work with Streams, Packets, and Fields Create sophisticated user interfaces (tabs, splitters, grids) using Fx-Ruby toolbit Using the free ruby charting library UnleashCharts to create bar charts Ruby concepts such as classes and inheritance TCP/IP algorithms for slow start, fast retrasmit, and congestion avoidance This application is written entirely using Ruby and the Unsniff Scripting API. The purpose of this script is to demonstrate the full power of the Unsniff Scripting as well as to provide a powerful TCP/IP analysis tool to the community. The key features of the tool are:
Per packet analysisTCP/IP analysis is performed for each packet. Packet details along with analysis results are presented in a table. The information shown are :Packet ID (from the capture file), Time (relative to the initial SYN segment), Direction (Out = same direction as SYN segment, In = same direction of SYN+ACK segment), relative SEQ and ACK numbers, Payload bytes, RTT (if the segment yields a valid RTT sample) and analysis of the segment. Sequence number analysisThis chart shown how sequence numbers increase over time. Out of order packets, duplicate ACKs, and retransmissions are shown as vertical lines in the chart.
Congestion Window analysisIn addition to the receive window, each TCP also maintains a window called the Congestion Window or cwnd. The value of cwnd is responsible for throttling the sender. This tool estimates the value of "cwnd" based on observed packets (duplicate acks) and plots the value of cwnd against time. The slope of the congestion window indicates the rate at which data is being transmitted. In the slow start phase - cwnd increases exponentially; in congestion avoidance - cwnd increases linearly subject to a maximum of 2*mss per round trip time. In the chart shown here, you can see that cwnd increases exponentially in the beginning - but is later cut down to a steady state due to congestion in the network,. Note: This chart makes several assumptions about the behavior of the sender TCP which may not be valid with all TCP implementations. Sender and Receiver WindowThis chart plots the advertised sender and receiver window sizes.
Other ChartsIn addition to the above charts you can also access these charts
DownloadHow to run ?
Usage:anastm <capture-file-name> <stream_no> <In | Out> capture-file-name : Capture file in Unsniff (*.usnf) format stream_no : Number of the TCP/IP stream you wish to analyze In/Out : Direction you want to analyse Example:c:\RubyTest> anastm SampleCapture12.usnf 32 In |