1MERGECAP(1)             The Wireshark Network Analyzer             MERGECAP(1)
2
3
4

NAME

6       mergecap - Merges two or more capture files into one
7

SYNOPSIS

9       mergecap [ -a ] [ -F <file format> ] [ -h ] [ -I <IDB merge mode> ]
10       [ -s <snaplen> ] [ -v ] [ -V ] -w <outfile>|- <infile> [<infile> ...]
11

DESCRIPTION

13       Mergecap is a program that combines multiple saved capture files into a
14       single output file specified by the -w argument.  Mergecap knows how to
15       read pcap and pcapng capture files, including those of tcpdump,
16       Wireshark and other tools that write captures in those formats.
17
18       By default, Mergecap writes the capture file in pcapng format, and
19       writes all of the packets from the input capture files to the output
20       file.
21
22       Mergecap is able to detect, read and write the same capture files that
23       are supported by Wireshark.  The input files don't need a specific
24       filename extension; the file format and an optional gzip compression
25       will be automatically detected.  Near the beginning of the DESCRIPTION
26       section of wireshark(1) or
27       <https://www.wireshark.org/docs/man-pages/wireshark.html> is a detailed
28       description of the way Wireshark handles this, which is the same way
29       Mergecap handles this.
30
31       Mergecap can write the file in several output formats.  The -F flag can
32       be used to specify the format in which to write the capture file,
33       mergecap -F provides a list of the available output formats.
34
35       Packets from the input files are merged in chronological order based on
36       each frame's timestamp, unless the -a flag is specified.  Mergecap
37       assumes that frames within a single capture file are already stored in
38       chronological order.  When the -a flag is specified, packets are copied
39       directly from each input file to the output file, independent of each
40       frame's timestamp.
41
42       The output file frame encapsulation type is set to the type of the
43       input files if all input files have the same type.  If not all of the
44       input files have the same frame encapsulation type, the output file
45       type is set to WTAP_ENCAP_PER_PACKET.  Note that some capture file
46       formats, most notably pcap, do not currently support
47       WTAP_ENCAP_PER_PACKET.  This combination will cause the output file
48       creation to fail.
49

OPTIONS

51       -a  Causes the frame timestamps to be ignored, writing all packets from
52           the first input file followed by all packets from the second input
53           file.  By default, when -a is not specified, the contents of the
54           input files are merged in chronological order based on each frame's
55           timestamp.
56
57           Note: when merging, mergecap assumes that packets within a capture
58           file are already in chronological order.
59
60       -F  <file format>
61           Sets the file format of the output capture file. Mergecap can write
62           the file in several formats; mergecap -F provides a list of the
63           available output formats.  By default this is the pcapng format.
64
65       -h  Prints the version and options and exits.
66
67       -I  <IDB merge mode>
68           Sets the Interface Description Block (IDB) merge mode to use during
69           merging.  mergecap -I provides a list of the available IDB merge
70           modes.
71
72           Every input file has one or more IDBs, which describe the
73           interface(s) the capture was performed on originally. This includes
74           encapsulation type, interface name, etc. When mergecap merges
75           multiple input files, it has to merge these IDBs somehow for the
76           new merged output file. This flag controls how that is
77           accomplished. The currently available modes are:
78
79            * 'B<none>': no merging of IDBs is performed, and instead all IDBs are
80                         copied to the merged output file.
81            * 'B<all>':  IDBs are merged only if all input files have the same number
82                         of IDBs, and each IDB matches their respective entry in the
83                         other files. This is the default mode.
84            * 'B<any>':  Any and all duplicate IDBs are merged into one IDB, regardless
85                         of what file they are in.
86
87           Note that an IDB is only considered a matching duplicate if it has
88           the same encapsulation type, name, speed, time precision, comments,
89           description, etc.
90
91       -s  <snaplen>
92           Sets the snapshot length to use when writing the data.  If the -s
93           flag is used to specify a snapshot length, frames in the input file
94           with more captured data than the specified snapshot length will
95           have only the amount of data specified by the snapshot length
96           written to the output file.  This may be useful if the program that
97           is to read the output file cannot handle packets larger than a
98           certain size (for example, the versions of snoop in Solaris 2.5.1
99           and Solaris 2.6 appear to reject Ethernet frames larger than the
100           standard Ethernet MTU, making them incapable of handling gigabit
101           Ethernet captures if jumbo frames were used).
102
103       -v  Causes mergecap to print a number of messages while it's working.
104
105       -V  Print the version and exit.
106
107       -w  <outfile>|-
108           Sets the output filename. If the name is '-', stdout will be used.
109           This setting is mandatory.
110

EXAMPLES

112       To merge two capture files together, 100 seconds apart use:
113
114           capinfos -aeS a.pcap b.pcap
115
116       (Let's suppose a.pcap starts at 1009932757 and b.pcap ends at
117       873660281. 1009932757 - 873660281 - 100 = 136272376 seconds.)
118
119           editcap -t 136272376 b.pcap b-shifted.pcap
120           mergecap -w compare.pcap a.pcap b-shifted.pcap
121

SEE ALSO

123       pcap(3), wireshark(1), tshark(1), dumpcap(1), editcap(1), text2pcap(1),
124       pcap-filter(7) or tcpdump(8)
125

NOTES

127       Mergecap is based heavily upon editcap by Richard Sharpe
128       <sharpe[AT]ns.aus.com> and Guy Harris <guy[AT]alum.mit.edu>.
129
130       Mergecap is part of the Wireshark distribution.  The latest version of
131       Wireshark can be found at <https://www.wireshark.org>.
132
133       HTML versions of the Wireshark project man pages are available at:
134       <https://www.wireshark.org/docs/man-pages>.
135

AUTHORS

137         Original Author
138         -------- ------
139         Scott Renfro             <scott[AT]renfro.org>
140
141
142         Contributors
143         ------------
144         Bill Guyton              <guyton[AT]bguyton.com>
145
146
147
1483.2.3                             2020-04-13                       MERGECAP(1)
Impressum