Networking/Computing Tips/Tricks

One of the utilities that is included in your Wireshark distribution is a command line tool called 'mergecap'.  We use this tool to merge multiple captures generated, let's say, from a ring buffer capture (you can see how to do ring buffer captures using T-Shark here).

Alright, so let's say you have a ring buffer capture, as I do:

mergecap1

There are two options for merging these files:

  1. Open the oldest one in the Wireshark GUI, and then methodically use the File> Merge option for the rest of the files (in order).  Wireshark will merge them.
  2. Use the 'mergecap' command line tool.

This article shows how to use the mergecap tool using Windows, but you should be able to follow the exact step by step on Linux and MAC.

Begin by opening the Command Line (or terminal) window, and change directory to the C:/Program Files/Wireshark> directory as shown:

mergecap2

From this location you can view the mergecap help by typing "mergecap -h":

mergecap3

There are several options for concatenation, truncation, etc.  We will keep it simple and merge the files that were part of the ring buffer shown above.

To make my command easier, I renamed the filenames to ring2 - ring11:

mergecap4

Perfect!

Our command is: 'mergecap -w c:\mycaptures\mergedfile.pcap c:\mycaptures\ring2.pcap c:\mycaptures\ring3.pcap c:\mycaptures\ring4.pcap c:\mycaptures\ring5.pcap c:\mycaptures\ring6.pcap c:\mycaptures\ring7.pcap c:\mycaptures\ring8.pcap c:\mycaptures\ring9.pcap c:\mycaptures\ring10.pcap c:\mycaptures\ring11.pcap'

mergecap5

My system completed the task almost instantaneously.  If you are working with larger files, this will not be the case, but it will still be lightning fast.  You can add the '-v' verbose switch if you want to see things are hapenning.

OK - let's see the results!  First we see the newly created file:

mergecap6

Now this file can be openned in the Wireshark GUI.

You can see more information here: https://www.wireshark.org/docs/wsug_html_chunked/AppToolsmergecap.html

Happy packet sniffing.

Comments powered by CComment

Find by Tag

4G Networks 5G Networks 6LoWLAN 6LoWPAN 802.11 802.11ah 802.11ax 802.11ay 802.11az Ad-Hoc Addressing Analysis Ansible Architecture ARP Assessment AToM Automation Baseline BGP Bloom's Taxonomy Cable cat CellStream Cellular Central Office Cheat Sheet Chrome Cisco Cloud CMD Computer Consulting Data Center Data Networking Dependencies DHCPv6 DNS Docker Documentation Dublin-Traceroute dumpcap Earth Earthquakes ECMP Ethernet Ethics Etiquette Evaluation Field Operations Fragmentation G-MPLS Gauge GeoIP GNS3 Google GQUIC Hands-On History Home Network ICMP ICMPv6 IEEE 802.11p IEEE 802.15.4 India Internet IoT IPsec IPv4 IPv6 IRINN IS-IS L2VPN L3VPN LDP LifeNet Linux LLN LoL M-BGP MAC Macro Microsoft mininet Monitoring MPLS mtr MTU Multicast Murphy Name Resolution Netcat NetMon netsh Networking nmap NSE Observations Online School OpenFlow OSPF OSPFv2 OSPFv3 OSX OTT Paris-Traceroute Parrot PIM PMTU Policy POTS POTS to Pipes PPP Profile Project Management PW3E QoS QUIC Railroad Remote Desktop Requirements Resume Review RIP Routing RPL RSVP Rural SDN Security Service Provider Small Business SONET Speed SSH SSL Status Storms Subnetting SYSCTL T-Shark TCP TCP/IP Telco Telecom 101 Telecommunications Telephone Testing TLS Tools Traceroute Traffic Engineering Training Travel Tunnel Ubuntu Utility Video Virtualbox Virtualization VoIP VRF VXLAN Wi-Fi Wi-Fi 4 Wi-Fi 5 Wi-Fi 6 Windows Wireless Wireless 5G Wireshark WLAN Writing Zenmap ZigBee

Twitter Feed