LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Session reconstruction from Pcap Files? (https://www.linuxquestions.org/questions/linux-networking-3/session-reconstruction-from-pcap-files-739037/)

narcos 07-09-2009 07:08 PM

Session reconstruction from Pcap Files?
 
Hello,

I'm trying to perform some analysis on pcap files. I've written a script using Perl's Net::TcpDumpLog which allows me to parse each individual packet and extract header information as well as the payload. For example, here's what I'm currently printing out:

Code:

IP_SRC,IP DST, IP_LENGTH, IP_TOS, IP_TTL, IP_Offset, TCP_ACK, TCP_flags, TCP_Winsize, TCP_Chksum, TCP_URG
Now I want to look at some statistics regarding TCP sessions. I've been playing with a few tools to reconstruct flows, such as tcpflow [1]. tcpflow reconstructs sessions and dumps session data into files, but does not give much information at all on the individual packets that made up the flow.

I want to be in a position where I have, say, a flow object which consists of all the packet objects which make up the flow. Ultimately I want to create output containing stats on each flow, one flow per line. For example:

Code:

Flow_num, IP_Src, IP_Dst, TCP_SrcPort, TCP_DstPort, Flow_Duration, Packet_interarrival_mean, Number_of_packets_in_flow, Avg_packet_payload_size
I've been playing with tshark[2] and Net::Analysis[3] too, but haven't managed to get what I want. Any assistance would be greatly appreciated.

Many thanks,
Glenn

[1] http://www.circlemud.org/~jelson/software/tcpflow/
[2] http://www.wireshark.org/docs/man-pages/tshark.html
[3] http://search.cpan.org/~worrall/Net-Analysis-0.40/

amadain 08-03-2009 04:50 AM

Try wireshark's "follow tcp stream"

narcos 08-03-2009 05:42 AM

Quote:

Originally Posted by amadain (Post 3629341)
Try wireshark's "follow tcp stream"

Yeah that's useful for following individual streams manually, but when I have 30GBs that I want to break down my hand gets tired of clicking :) But I managed to get it sorted in the end with a very cool tool called Netdude.


All times are GMT -5. The time now is 08:31 PM.