I need to find a way to split a large pcap file into separated pcap files. What I want to find is a application like Splitcap but I need a application which runs on Linux. Tcpflow or Tcptrace don't generate pcap file as their output. The output pcap file should contains a tcp flow. If there's an application, please let me know. Split pcap file using tshark will be very helpful for me. asked 07 Dec '12, 08:21 fates |
4 Answers:
tshark can do that.
Regards answered 07 Dec '12, 08:31 Kurt Knochner ♦ |
Separate the packets into flows considering only 4 tuples: source address, source port, dest address, dest port for further analysis. The packets are saved in the time order without any processing like TCP resembling. The flow timeout is considered as 64 seconds suggested by CAIDA. answered 25 Dec '12, 04:01 Jamin |
The tshark scripts didn't finish in 30 minutes on my 4G pcap with about 40 flows. The following finished in about 90 seconds. tshark versus tcpdump?
answered 14 Feb ‘13, 13:51 brucer42 edited 14 Feb ‘13, 14:14 |
You can use PcapSplitter which is part of the PcapPlusPlus suite. It's cross-platform so it can run on both Windows, Linux and Mac OS X. There's also a binary version for several OS's here. It can process large pcap files containing large amount of streams (both TCP and UDP). You should use it as follows:
answered 23 Jul '16, 12:45 seladb |
Thanks for the comment, Kurt. But my input file contains more than one millinon flows. Is there any other options to do this?
And you are asking for what? Having 1 million files, one for each stream?
If so, you can run tshark in a loop and use the loop counter in the stream filter and the output file name.
See the following question:
A easier/faster method would be this python script:
The script needs pcapy. You can install pcapy on Ubuntu like this:
Thanks, Kurt! By the way, I've already tried the python script. :) But this script uses "Impacket" package and this package cannot handle corrupted packets. This is why I'm trying to find other solutions.
well, then use tshark.