This is a work in progress, I will be... Full Story
By Manny Fernandez
December 3, 2018
Merging PCAP files from the CLI
With the Fortigate 6Ks, when you do a packet capture from the GUI, it will save multiple PCAP files into a tar file. This is because the 6K and other chassis based Fortigates have different blades inside, hidden to the user as in the 6K, or visible as in the 5K and 7Ks. This is true with non-Fortigate pcaps as well. You can do a pcap in wireshark or tcpdump that will create multiple files. However it can be daunting to look through each of the files. You can merge this via different methods using the GUI in Wireshark, however I am a “CLI Jockey”, I prefer this one.
Above, we can see the contents of the tar file untarred on my desktop. As you can see, they are labeled 1 - 6
.
mannyfernandez:~/Desktop/sniffer/MPLS VLAN905.root.14$mergecap -w fullpcap.pcap sniffer_slot1_MPLS\ VLAN905.root.14.pcap sniffer_slot2_MPLS\ VLAN905.root.14.pcap sniffer_slot3_MPLS\ VLAN905.root.14.pcap sniffer_slot4_MPLS\ VLAN905.root.14.pcap sniffer_slot5_MPLS\ VLAN905.root.14.pcap sniffer_slot6_MPLS\ VLAN905.root.14.pcap
Here I am running the ‘mergecap’ command with a ‘-w’ to define the output file name and then the series of pcap files you want to merge.
NOTE: The above command is a single line without /r or /n (only spaces between the source pcap file names).
mergecap -w outputfile.pcap %filename1%.pcap %filename2%.pcap etc...
Mergecap (Wireshark) 2.9.0 (v2.9.0rc0-1249-ga108e49d)
Merge two or more capture files into one.
See https://www.wireshark.org for more information.
Usage: mergecap [options] -w <outfile>|- <infile> [<infile> …]
Output:
-a concatenate rather than merge files.
default is to merge based on frame timestamps.
-s <snaplen> truncate packets to <snaplen> bytes of data.
-w <outfile>|- set the output filename to <outfile> or ‘-‘ for stdout.
-F <capture type> set the output file type; default is pcapng.
an empty “-F” option will list the file types.
-I <IDB merge mode> set the merge mode for Interface Description Blocks; default is ‘all’.
an empty “-I” option will list the merge modes.
Miscellaneous:
-h display this help and exit.
-v verbose output.
A simple example merging dhcp-capture.pcapng and imap-1.pcapng into outfile.pcapng is shown below.
Hope this helps.
Recent posts
-
-
I have been playing with the free version of... Full Story
-
In my day job, I am on a lot... Full Story