1 .\" Copyright (c) 1991, 1996, 2000
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that: (1) source code distributions
6 .\" retain the above copyright notice and this paragraph in its entirety, (2)
7 .\" distributions including binary code include the above copyright notice and
8 .\" this paragraph in its entirety in the documentation or other materials
9 .\" provided with the distribution, and (3) all advertising materials mentioning
10 .\" features or use of this software display the following acknowledgement:
11 .\" ``This product includes software developed by the University of California,
12 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13 .\" the University nor the names of its contributors may be used to endorse
14 .\" or promote products derived from this software without specific prior
15 .\" written permission.
16 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 .TH TCPSLICE 1 "22 March 2024"
22 tcpslice \- extract pieces of and/or merge together pcap files
55 is a program for extracting portions of
62 flag or many other programs.
63 It can also be used to merge together several such files, as discussed
66 The basic operation of
70 all packets from its input file(s) whose timestamps fall
71 within a given range. The starting and ending times of the range
72 may be specified on the command line. All ranges are inclusive.
73 The starting time defaults
74 to the earliest time of the first packet in
75 any of the input files; we call
78 The ending time defaults to ten years after the starting time.
80 .I tcpslice trace-file
83 to \fIstdout\fP (assuming the file does not include more than
84 ten years' worth of data).
87 There are a number of ways to specify times. The first is using
88 Unix timestamps of the form
90 (this is the format specified by \fItcpdump\fP's
95 specifies 38 seconds and 765,400 microseconds
96 after 8:51PM PDT, Sept. 25, 1990.
98 All examples in this manual are given
99 for PDT times, but when displaying times and interpreting times symbolically
102 uses the local timezone, regardless of the timezone in which the pcap
103 file was generated. The daylight-savings setting used is that which is
104 appropriate for the local timezone at the date in question. For example,
105 times associated with summer months will usually include daylight-savings
106 effects, and those with winter months will not.
108 Times may also be specified relative
111 (when specifying a starting time)
112 or the starting time (when specifying an ending time)
113 by preceding a numeric value in seconds with a `+'.
114 For example, a starting time of
116 indicates 200 seconds after the
118 and the two arguments
120 indicate from 200 seconds after the
122 through 500 seconds after the
125 Times may also be specified in terms of years (y), months (m), days (d),
126 hours (h), minutes (m), seconds (s), and microseconds(u). For example,
129 discussed above could also be expressed
131 .BR 1990y9m25d20h51m38s765400u .
132 2 or 4 digit years may be used; 2 digits can specify years from 1970 to
135 When specifying times using this style, fields that are omitted default
136 as follows. If the omitted field is a unit
138 than that of the first specified field, then its value defaults to
139 the corresponding value taken from either
141 (if the starting time is being specified) or the starting time
142 (if the ending time is being specified).
143 If the omitted field is a unit
145 than that of the first specified field, then it defaults to zero (1 for days).
146 For example, suppose that the input file has a
148 of the Unix timestamp mentioned above, i.e., 38 seconds and 765,400 microseconds
149 after 8:51PM PDT, Sept. 25, 1990. To specify 9:36PM PDT (exactly) on the
150 same date we could use
152 To specify a range from 9:36PM PDT through 1:54AM PDT the next day we
154 .BR "21h36m 26d1h54m" .
156 Relative times can also be specified when using the
158 format. Omitted fields then default to 0 if the unit of the field is
160 than that of the first specified field, and to the corresponding value
161 taken from either the
163 or the starting time if the omitted field's unit is
165 than that of the first specified field. Given a
167 of the Unix timestamp mentioned above,
169 specifies a range from 10:00PM PDT on that date through 11:10PM PDT, and
171 specifies a range from 38.7654 seconds after 9:51PM PDT through 38.7654
172 seconds after 11:01PM PDT. The first hour of the file could be extracted
178 format there is an ambiguity between using
180 for `month' or for `minute'. The ambiguity is resolved as follows: if an
182 field is followed by a
184 field then it is interpreted as specifying months; otherwise it
186 .SH MULTIPLE INPUT FILES
188 If more than one input file is specified then
190 merges the packets from the various input files into the single
191 output file. Normally, this merge is done based on the
192 value of the time stamps in the packets in the individual files.
193 (Tcpslice assumes that
195 each input file, packets are in time stamp order.)
198 option is used, the value used for ordering is the time stamp of
199 a given packet minus the time stamp of the first packet in the
200 input file in which the given packet occurs.
202 When merging files, by default
206 packet it finds in more than one file. A duplicate is a packet
207 that has an identical timestamp (either relative or absolute) and
208 identical packet contents (for as much as was captured) as another
209 packet previously seen in a different file. Note that it is possible
210 for the network to generate true replicates of packets, and for
211 systems that can return the same timestamp for multiple packets,
212 these can be mistaken for duplicates and discarded. Accordingly,
214 will not discard duplicates in the same trace file. In addition,
217 option to suppress any discarding of duplicates.
220 will refuse to merge multiple files if they don't have the same
221 link-layer header type.
231 reports the timestamps of the first and last packets in each input file
232 and exits. Only one of these three options may be specified.
235 Do not discard duplicate packets seen when merging multiple trace files.
238 Dump the start and end times specified by the given range and
239 exit. This option is useful for checking that the given range actually
240 specifies the times you think it does. If one of
245 has been specified then the times are dumped in the corresponding
248 (raw format) is used.
253 to wait after the last packet was seen before considering a session
254 to be expired (default: 0 = do not expire inactive sessions). This
255 is only effective when the
257 option is used to track sessions.
262 of PCAP files to which each session will be extracted (default: NULL = do
263 not extract sessions to separate files). This is only effective when the
265 option is used to track sessions.
268 Print the tcpslice and libpcap version strings, print a usage message, and exit.
271 When merging more than one file, merge on the basis of
272 relative time, rather than absolute time.
273 Normally, when merging
274 files is done, packets are merged based on absolute time stamps. With
276 packets are merged based on the relative time between
277 the start of the file in which the packet is found and the time stamp
278 of the packet itself.
279 The time stamp of packets in the output file is calculated
280 as the relative time for the packet within its file plus
284 Dump the timestamps of the first and last packets in each input file
285 as raw timestamps (i.e., in the form \fI sssssssss.uuuuuu\fP).
290 except the timestamps are dumped in human-readable format, similar
295 Enable session tracking for the specified
297 which is a comma-separated list of the following:
301 track all TCP connections
304 track SIP-based VoIP calls, which may enable tracking of TCP
305 connections but only the ones that are related to SIP calls.
306 This feature is only available if tcpslice was linked against
307 Aymeric Moizard's GNU oSIP library; if not, install the latest
310 from https://www.gnu.org/software/osip/ and recompile tcpslice.
313 track H.323-based VoIP calls, which may enable tracking of TCP
314 connections but only the ones that are related to H.323 calls.
315 This feature is only available if tcpslice was linked against
316 Objective Systems' Open H.323 library for C; if not, install the
319 from https://sourceforge.net/projects/ooh323c/ and recompile tcpslice.
321 Session tracking altogether is only available if tcpslice was linked
322 against a recent version (>1.20) of Rafal Wojtczuk's Network Intrusion
323 Detection System library; if not, install the latest version of
325 from http://libnids.sourceforge.net/ and recompile tcpslice.
331 except the timestamps are dumped in
335 format discussed above.
338 Turn on verbose mode. Currently this only affects session tracking (\fB\-s\fP)
339 messages: if specified at least once, sessions openings and closings
340 are displayed regardless of the time (by default the closings are only
343 if specified at least twice, subsessions (sessions initiated by other
344 sessions) openings and closings are also displayed.
346 .BI \-w " output-file"
347 Direct the output to \fIoutput-file\fR rather than \fIstdout\fP.
351 The original author was:
354 Lawrence Berkeley Laboratory, University of California, Berkeley, CA.
356 It is currently maintained by The Tcpdump Group.
358 The current version is available at:
361 .I https://github.com/the-tcpdump-group/tcpslice
365 The original distribution is available via anonymous ftp:
368 .I ftp://ftp.ee.lbl.gov/tcpslice-1.2a3.tar.gz
371 Please send problems, bugs, questions, desirable enhancements, etc. to:
374 tcpdump-workers@lists.tcpdump.org
377 Please send source code contributions as git pull requests through the
380 An input filename that exactly matches the
384 format discussed above can be confused with a start/end time (regardless if
385 the date and the time are valid in the latter case). Such filenames can be
386 specified with a leading `./'; for example, specify the file
394 Alternatively, renaming the files to
398 respectively would resolve this ambiguity.
401 cannot read its input from \fIstdin\fP, since it uses random-access
402 to rummage through its input files.
405 cannot process an otherwise valid input file that contains fewer than two
409 refuses to write to its output if it is a terminal
412 This is not a bug but a feature,
413 to prevent it from spraying binary data to the user's terminal.
414 Note that this means you must either redirect \fIstdout\fP or specify an
415 output file via \fB\-w\fP.
418 will not work properly on pcap files spanning more than one year;
419 with files containing portions of packets whose original length was
420 more than 65,535 bytes; nor with files containing fewer than two packets.
422 the error message: `couldn't find final packet in file'. These problems
423 are due to the interpolation scheme used by
425 to greatly speed up its processing when dealing with large trace files.
428 can efficiently extract slices from the middle of trace files of any
429 size, and can also work with truncated trace files (i.e., the final packet
430 in the file is only partially present, typically due to \fItcpdump\fP
431 being ungracefully killed).
435 has broken some compatibility with older versions, since
437 now merges its input files, rather than (approximately) concatenating
438 them together as it did previously.
440 It would sometimes be convenient if you could specify a clock offset
447 supported more general editing of trace files.