5 == File Input, Output, And Printing
7 [#ChIOIntroductionSection]
11 This chapter will describe input and output of capture data.
13 * Open capture files in various capture file formats
15 * Save and export capture files in various formats
17 * Merge capture files together
19 * Import text files containing hex dumps of packets
25 === Open Capture Files
27 Wireshark can read in previously saved capture files. To read them, simply
28 select the menu:File[Open] menu or toolbar item. Wireshark will then pop up
29 the “File Open” dialog box, which is discussed in more detail in <<ChIOOpen>>.
32 .You can use drag and drop to open files
34 On most systems you can open a file by simply dragging it in your file manager and dropping it onto Wireshark’s main window.
37 If you haven’t previously saved the current capture file you will be asked to
38 do so to prevent data loss. This warning can be disabled in the preferences.
40 In addition to its native file format (pcapng), Wireshark can read and write
41 capture files from a large number of other packet capture programs as well. See
42 <<ChIOInputFormatsSection>> for the list of capture formats Wireshark
47 ==== The “Open Capture File” Dialog Box
49 The “Open Capture File” dialog box allows you to search for a capture file
50 containing previously captured packets for display in Wireshark. The following
51 sections show some examples of the Wireshark “Open File” dialog box. The
52 appearance of this dialog depends on the system. However, the functionality
53 should be the same across systems.
55 Common dialog behavior on all systems:
57 * Select files and directories.
59 * Click the btn:[Open] button to accept your selected file and open it.
61 * Click the btn:[Cancel] button to go back to Wireshark and not load a capture file.
63 * The btn:[Help] button will take you to this section of the “User’s Guide”.
65 Wireshark adds the following controls:
67 * View file preview information such as the size and the number of packets in a selected a capture file.
69 // XXX - we need a better description of these read filters
70 * Specify a read filter with the “Read filter” field.
71 This filter will be used when opening the new file.
72 The text field background will turn green for a valid filter string and red for an invalid one.
73 Read filters can be used to exclude various types of traffic, which can be useful for large capture files.
74 They use the same syntax as display filters, which are discussed in detail in <<ChWorkDisplayFilterSection>>.
76 * Optionally force Wireshark to read a file as a particular type using the “Automatically detect file type” drop-down.
78 [#ChIOOpenFileDialogWin32]
80 .“Open” on Microsoft Windows
81 image::images/ws-open-win32.png[{medium-screenshot-attrs}]
83 This is the common Windows file open dialog along with some Wireshark extensions.
87 .“Open” - Linux and UNIX
88 image::images/ws-open-qt5.png[{medium-screenshot-attrs}]
90 This is the common Qt file open dialog along with some Wireshark extensions.
94 [#ChIOInputFormatsSection]
97 ==== Input File Formats
99 The native capture file formats used by Wireshark are:
101 * pcap. The default format used by the _libpcap_ packet capture library. Used
102 by _tcpdump, _Snort_, _Nmap_, _Ntop_, and many other tools.
104 * pcapng. A flexible, extensible successor to the pcap format.
105 Wireshark 1.8 and later save files as pcapng by default. Versions
106 prior to 1.8 used pcap. Used by Wireshark and by _tcpdump_ in newer
109 The following file formats from other capture tools can be opened by Wireshark:
111 * Oracle (previously Sun) _snoop_ and _atmsnoop_ captures
113 * Finisar (previously Shomiti) _Surveyor_ captures
115 * Microsoft _Network Monitor_ captures
117 * Novell _LANalyzer_ captures
119 * AIX _iptrace_ captures
121 * Cinco Networks NetXray captures
123 * NETSCOUT (previously Network Associates/Network General) Windows-based
124 Sniffer and Sniffer Pro captures
126 * Network General/Network Associates DOS-based Sniffer captures
127 (compressed or uncompressed) captures
129 * LiveAction (previously WildPackets/Savvius)
130 *Peek/EtherHelp/PacketGrabber captures
132 * RADCOM’s WAN/LAN Analyzer captures
134 * Viavi (previously Network Instruments) Observer captures
136 * Lucent/Ascend router debug output
138 * captures from HP-UX nettl
140 * Toshiba’s ISDN routers dump output
142 * output from _i4btrace_ from the ISDN4BSD project
144 * traces from the EyeSDN USB S0
146 * the IPLog format output from the Cisco Secure Intrusion Detection System
148 * pppd logs (pppdump format)
150 * the output from VMS’s TCPIPtrace/TCPtrace/UCX$TRACE utilities
152 * the text output from the DBS Etherwatch VMS utility
154 * Visual Networks’ Visual UpTime traffic capture
156 * the output from CoSine L2 debug
158 * the output from InfoVista (previously Accellent) 5Views LAN agents
160 * Endace Measurement Systems’ ERF format captures
162 * Linux Bluez Bluetooth stack hcidump -w traces
164 * Catapult (now Ixia/Keysight) DCT2000 .out files
166 * Gammu generated text output from Nokia DCT3 phones in Netmonitor mode
168 * IBM Series (OS/400) Comm traces (ASCII & UNICODE)
170 * Juniper Netscreen snoop captures
172 * Symbian OS btsnoop captures
174 * Tamosoft CommView captures
176 * Tektronix K12xx 32bit .rf5 format captures
178 * Tektronix K12 text file format captures
180 * Apple PacketLogger captures
182 * Captures from Aethra Telecommunications’ PC108 software for their test instruments
184 * Citrix NetScaler Trace files
186 * Android Logcat binary and text format logs
188 * Colasoft Capsa and PacketBuilder captures
190 * Micropross mplog files
192 * Unigraf DPA-400 DisplayPort AUX channel monitor traces
194 * 802.15.4 traces from Daintree's Sensor Network Analyzer
196 * MPEG-2 Transport Streams as defined in ISO/IEC 13818-1
198 * Log files from the _candump_ utility
200 * Logs from the BUSMASTER tool
202 * Ixia IxVeriWave raw captures
204 * Rabbit Labs CAM Inspector files
206 * _systemd_ journal files
208 * 3GPP TS 32.423 trace files
210 New file formats are added from time to time.
212 It may not be possible to read some formats dependent on the packet types
213 captured. Ethernet captures are usually supported for most file formats but it
214 may not be possible to read other packet types such as PPP or IEEE 802.11 from
219 === Saving Captured Packets
221 You can save captured packets by using the menu:File[Save] or menu:File[Save As...] menu items.
222 You can choose which packets to save and which file format to be used.
224 Not all information will be saved in a capture file. For example, most file
225 formats don’t record the number of dropped packets. See
226 <<ChAppFilesCaptureFilesSection>> for details.
230 ==== The “Save Capture File As” Dialog Box
232 The “Save Capture File As” dialog box allows you to save the current capture to a file.
233 The exact appearance of this dialog depends on your system.
234 However, the functionality is the same across systems.
235 Examples are shown below.
237 [#ChIOSaveAsFileWin32]
239 .“Save” on Microsoft Windows
240 image::images/ws-save-as-win32.png[{medium-screenshot-attrs}]
242 This is the common Windows file save dialog with some additional Wireshark extensions.
246 .“Save” on Linux and UNIX
247 image::images/ws-save-as-qt5.png[{medium-screenshot-attrs}]
249 This is the common Qt file save dialog with additional Wireshark extensions.
253 You can perform the following actions:
255 * Type in the name of the file in which you wish to save the captured packets.
257 * Select the directory to save the file into.
259 * Specify the format of the saved capture file by clicking on the “Save as” drop-down box.
260 You can choose from the types described in <<ChIOOutputFormatsSection>>.
261 Some capture formats may not be available depending on the packet types captured.
263 * The btn:[Help] button will take you to this section of the “User’s Guide”.
265 * “Compress with gzip” will compress the capture file as it is being written to disk.
267 * Click the btn:[Save] button to accept your selected file and save it.
269 * Click on the btn:[Cancel] button to go back to Wireshark without saving any packets.
271 If you don’t provide a file extension to the filename (e.g., `.pcap`) Wireshark will append the standard file extension for that file format.
274 .Wireshark can convert file formats
276 You can convert capture files from one format to another by opening a capture and saving it as a different format.
279 If you wish to save some of the packets in your capture file you can do so via <<ChIOExportSpecifiedPacketsDialog>>.
281 [#ChIOOutputFormatsSection]
283 ==== Output File Formats
285 Wireshark can save the packet data in its native file format (pcapng) and in the
286 file formats of other protocol analyzers so other tools can read the capture
290 .Saving in a different format might lose data
292 Saving your file in a different format might lose information such as comments, name resolution, and time stamp resolution.
293 See <<ChAdvTimestamps>> for more information on time stamps.
296 The following file formats can be saved by Wireshark (with the known file extensions):
298 * pcapng ({asterisk}.pcapng). A flexible, extensible successor to the
299 libpcap format. Wireshark 1.8 and later save files as pcapng by
300 default. Versions prior to 1.8 used libpcap.
302 * pcap ({asterisk}.pcap). The default format used by the _libpcap_
303 packet capture library. Used by _tcpdump, _Snort_, _Nmap_, _Ntop_,
304 and many other tools.
306 * Accellent 5Views ({asterisk}.5vw)
308 * captures from HP-UX nettl ({asterisktrc0,{asterisk}.trc1)
310 * Microsoft Network Monitor - NetMon ({asterisk}.cap)
312 * Network Associates Sniffer - DOS
313 ({asterisk}.cap,{asterisk}.enc,{asterisk}.trc,{asterisk}.fdc,{asterisk}.syc)
315 * Cinco Networks NetXray captures ({asterisk}.cap)
317 * Network Associates Sniffer - Windows ({asterisk}.cap)
319 * Network Instruments/Viavi Observer ({asterisk}.bfr)
321 * Novell LANalyzer ({asterisk}.tr1)
323 * Oracle (previously Sun) snoop ({asterisk}.snoop,{asterisk}.cap)
325 * Visual Networks Visual UpTime traffic ({asterisk}.{asterisk})
327 * Symbian OS btsnoop captures ({asterisk}.log)
329 * Tamosoft CommView captures ({asterisk}.ncf)
331 * Catapult (now Ixia/Keysight) DCT2000 .out files ({asterisk}.out)
333 * Endace Measurement Systems’ ERF format capture({asterisk}.erf)
335 * EyeSDN USB S0 traces ({asterisk}.trc)
337 * Tektronix K12 text file format captures ({asterisk}.txt)
339 * Tektronix K12xx 32bit .rf5 format captures ({asterisk}.rf5)
341 * Android Logcat binary logs ({asterisk}.logcat)
343 * Android Logcat text logs ({asterisk}.{asterisk})
345 * Citrix NetScaler Trace files ({asterisk}.cap)
347 New file formats are added from time to time.
349 Whether or not the above tools will be more helpful than Wireshark is a different question ;-)
352 .Third party protocol analyzers may require specific file extensions
354 Wireshark examines a file’s contents to determine its type. Some other protocol
355 analyzers only look at a file's extension. For example, you might need to use
356 the `.cap` extension in order to open a file using the Windows version
362 === Merging Capture Files
364 Sometimes you need to merge several capture files into one. For example, this can
365 be useful if you have captured simultaneously from multiple interfaces at once
366 (e.g., using multiple instances of Wireshark).
368 There are three ways to merge capture files using Wireshark:
370 * Use the menu:File[Merge] menu to open the “Merge” dialog.
371 See <<ChIOMergeDialog>> for details.
372 This menu item will be disabled unless you have loaded a capture file.
374 * Use _drag and drop_ to drop multiple files on the main window.
375 Wireshark will try to merge the packets in chronological order from the dropped files into a newly created temporary file.
376 If you drop a single file, it will simply replace the existing capture.
378 * Use the `mergecap` tool from the command line to merge capture files.
379 This tool provides the most options to merge capture files.
380 See <<AppToolsmergecap>> for details.
384 ==== The “Merge With Capture File” Dialog Box
386 This lets you select a file to be merged into the currently loaded file.
387 If your current data has not been saved you will be asked to save it first.
389 Most controls of this dialog will work the same way as described in the “Open Capture File” dialog box.
390 See <<ChIOOpen>> for details.
392 Specific controls of this merge dialog are:
395 Prepend the packets from the selected file before the currently loaded packets.
397 Merge chronologically::
398 Merge both the packets from the selected and currently loaded file in chronological order.
401 Append the packets from the selected file after the currently loaded packets.
405 .“Merge Capture File As” dialog box examples
407 [#ChIOMergeFileWin32]
409 .“Merge” on Microsoft Windows
410 image::images/ws-merge-win32.png[{medium-screenshot-attrs}]
412 This is the common Windows file open dialog with additional Wireshark extensions.
416 .“Merge” on Linux and UNIX
417 image::images/ws-merge-qt5.png[{medium-screenshot-attrs}]
419 This is the Qt file open dialog with additional Wireshark extensions.
427 Wireshark can read in a hex dump and write the data described into a
428 temporary libpcap capture file. It can read hex dumps with multiple packets in
429 them, and build a capture file of multiple packets. It is also capable of
430 generating dummy Ethernet, IP and UDP, TCP, or SCTP headers, in order to build
431 fully processable packet dumps from hexdumps of application-level data only.
432 Alternatively, a Dummy PDU header can be added to specify a dissector the data
433 should be passed to initially.
435 Two methods for converting the input are supported:
437 ==== Standard ASCII Hexdumps
439 Wireshark understands a hexdump of the form generated by `od -Ax -tx1 -v`.
440 In other words, each byte is individually displayed, with spaces separating
441 the bytes from each other. Hex digits can be upper or lowercase.
443 In normal operation, each line must begin with an offset describing the
444 position in the packet, followed a colon, space, or tab separating it from
445 the bytes. There is no limit on the width or number of bytes per line, but
446 lines with only hex bytes without a leading offset are ignored (i.e.,
447 line breaks should not be inserted in long lines that wrap.) Offsets are more
448 than two digits; they are in hex by default, but can also be in octal or
449 decimal. Each packet must begin with offset zero, and an offset
450 zero indicates the beginning of a new packet. Offset values must be correct;
451 an unexpected value causes the current packet to be aborted and the next
452 packet start awaited. There is also a single packet mode with no offsets.
454 Packets may be preceded by a direction indicator ('I' or 'O') and/or a
455 timestamp if indicated. If both are present, the direction indicator precedes
456 the timestamp. The format of the timestamps must be specified. If no timestamp
457 is parsed, in the case of the first packet the current system time is used,
458 while subsequent packets are written with timestamps one microsecond later than
459 that of the previous packet.
461 Other text in the input data is ignored. Any text before the offset is
462 ignored, including email forwarding characters '>'. Any text on a line
463 after the bytes is ignored, e.g., an ASCII character dump (but see *-a* to
464 ensure that hex digits in the character dump are ignored). Any line where
465 the first non-whitespace character is a '#' will be ignored as a comment.
466 Any lines of text between the bytestring lines are considered preamble;
467 the beginning of the preamble is scanned for the direction indicator and
468 timestamp as mentioned above and otherwise ignored.
470 Any line beginning with #TEXT2PCAP is a directive and options
471 can be inserted after this command to be processed by Wireshark.
472 Currently there are no directives implemented; in the future, these may
473 be used to give more fine-grained control on the dump and the way it
474 should be processed e.g., timestamps, encapsulation type etc.
476 In general, short of these restrictions, Wireshark is pretty liberal
477 about reading in hexdumps and has been tested with a variety of
478 mangled outputs (including being forwarded through email multiple
479 times, with limited line wrap etc.)
481 Here is a sample dump that can be imported, including optional
482 directional indicator and timestamp:
485 I 2019-05-14T19:04:57Z
486 000000 00 e0 1e a7 05 6f 00 10 ........
487 000008 5a a0 b9 12 08 00 46 00 ........
488 000010 03 68 00 00 00 00 0a 2e ........
489 000018 ee 33 0f 19 08 7f 0f 19 ........
490 000020 03 80 94 04 00 00 10 01 ........
491 000028 16 a2 0a 00 03 50 00 0c ........
492 000030 01 01 0f 19 03 80 11 01 ........
495 ==== Regular Text Dumps
497 Wireshark is also capable of scanning the input using a custom Perl regular
498 expression as specified by GLib's https://developer-old.gnome.org/glib/stable/glib-regex-syntax.html[GRegex here].
499 Using a regex capturing a single packet in the given file
500 Wireshark will search the given file from start to the second to last character
501 (the last character has to be `\n` and is ignored)
502 for non-overlapping (and non-empty) strings matching the given regex and then
503 identify the fields to import using named capturing subgroups. Using provided
504 format information for each field they are then decoded and translated into a
505 standard libpcap file retaining packet order.
507 Note that each named capturing subgroup has to match _exactly_ once a packet,
508 but they may be present multiple times in the regex.
510 For example, the following dump:
512 > 0:00:00.265620 a130368b000000080060
513 > 0:00:00.280836 a1216c8b00000000000089086b0b82020407
514 < 0:00:00.295459 a2010800000000000000000800000000
515 > 0:00:00.296982 a1303c8b00000008007088286b0bc1ffcbf0f9ff
516 > 0:00:00.305644 a121718b0000000000008ba86a0b8008
517 < 0:00:00.319061 a2010900000000000000001000600000
518 > 0:00:00.330937 a130428b00000008007589186b0bb9ffd9f0fdfa3eb4295e99f3aaffd2f005
519 > 0:00:00.356037 a121788b0000000000008a18
521 could be imported using these settings:
523 regex: ^(?<dir>[<>])\s(?<time>\d+:\d\d:\d\d.\d+)\s(?<data>[0-9a-fA-F]+)$
524 timestamp: %H:%M:%S.%f
529 Caution has to be applied when discarding the anchors `^` and `$`, as the input
530 is searched, not parsed, meaning even most incorrect regexes will produce valid
531 looking results when not anchored (however, anchors are not guaranteed to prevent
532 this). It is generally recommended to sanity check any files created using
537 * data: Actual captured frame data
539 The only mandatory field. This should match the encoded binary data captured and
540 is used as the actual frame data to import.
542 * time: timestamp for the packet
544 The captured field will be parsed according to the given timestamp format into a
547 If no timestamp is present an arbitrary counter will count up seconds and
548 nanoseconds by one each packet.
550 * dir: the direction the packet was sent over the wire
552 The captured field is expected to be one character in length, any remaining
553 characters are ignored (e.g., given "Input" only the 'I' is looked at). This
554 character is compared to lists of characters corresponding to inbound and
555 outbound and the packet is assigned the corresponding direction.
556 If neither list yields a match, the direction is set to unknown.
558 If this field is not specified the entire file has no directional information.
560 * seqno: an ID for this packet
562 Each packet can be assigned an arbitrary ID that can used as field by Wireshark.
563 This field is assumed to be a positive integer base 10. This field can e.g.
564 be used to reorder out of order captures after the import.
566 If this field is not given, no IDs will be present in the resulting file.
572 ==== The “Import From Hex Dump” Dialog Box
574 This dialog box lets you select a text file, containing a hex dump of packet
575 data, to be imported and set import parameters.
577 [#ChIOFileImportDialog]
579 .The “Import from Hex Dump” dialog in Hex Dump mode
580 image::images/ws-file-import.png[{medium-screenshot-attrs}]
582 Specific controls of this import dialog are split in three sections:
584 File Source:: Determine which input file has to be imported
586 Input Format:: Determine how the input file has to be interpreted.
588 Encapsulation:: Determine how the data is to be encapsulated.
593 Enter the name of the text file to import. You can use _Browse_ to browse for a
598 This section is split in the two alternatives for input conversion, accessible in
599 the two Tabs "Hex Dump" and "Regular Expression"
601 In addition to the conversion mode specific inputs, there are also common
602 parameters, currently only the timestamp format.
604 ===== The Hex Dump tab
607 Select the radix of the offsets given in the text file to import. This is
608 usually hexadecimal, but decimal and octal are also supported. Select _None_
609 when only the bytes are present. These will be imported as a single packet.
611 Direction indication::
612 Tick this box if the text file to import has direction indicators before each
613 frame. These are on a separate line before each frame and start with either
614 _I_ or _i_ for input and _O_ or _o_ for output.
616 ===== The Regular Expression tab
618 .The "Regular Expression" tab inside the "Import from Hex Dump” dialog.
619 image::images/ws-file-import-regex.png[{medium-screenshot-attrs}]
621 Packet format regular expression::
622 This is the regex used for searching packets and metadata inside the input file.
623 Named capturing subgroups are used to find the individual fields. Anchors `^` and
624 `$` are set to match directly before and after newlines `\n` or `\r\n`. See
625 https://developer-old.gnome.org/glib/stable/glib-regex-syntax.html[GRegex] for a full
629 The Encoding used for the binary data. Supported encodings are plain-hexadecimal,
630 -octal, -binary and base64. Plain here means no additional
631 characters are present in the data field beyond whitespaces, which are ignored.
632 Any unexpected characters abort the import process.
634 Ignored whitespaces are `\r`, `\n`, `\t`, `\v`, ` ` and only for hex `:`, only
637 Any incomplete bytes at the field's end are assumed to be padding to fill the
638 last complete byte. These bits should be zero, however, this is not checked.
640 Direction indication::
641 The lists of characters indicating incoming vs. outgoing packets. These fields
642 are only available when the regex contains a `(?<dir>...)` group.
647 This is the format specifier used to parse the timestamps in the text file to
648 import. It uses the same format as `strptime(3)` with the addition of `%f` for
649 zero padded fractions of seconds. The precision of `%f` is determined from its
650 length. The most common fields are `%H`, `%M` and `%S` for hours, minutes and
651 seconds. The straightforward HH:MM:SS format is covered by %T. For a full
652 definition of the syntax look for `strptime(3)`,
654 In Regex mode this field is only available when a `(?<time>...)` group is present.
656 In Hex Dump mode if there are no timestamps in the text file to import, leave this
657 field empty and timestamps will be generated based on the time of import.
662 Here you can select which type of frames you are importing. This all depends on
663 from what type of medium the dump to import was taken. It lists all types that
664 Wireshark understands, so as to pass the capture file contents to the right
668 When Ethernet encapsulation is selected you have to option to prepend dummy
669 headers to the frames to import. These headers can provide artificial Ethernet,
670 IP, UDP, TCP or SCTP headers or SCTP data chunks. When selecting a type of
671 dummy header, the applicable entries are enabled, others are greyed out and
672 default values are used.
673 When the _Wireshark Upper PDU export_ encapsulation is selected the option
674 _ExportPDU_ becomes available. This allows you to select the name of the
675 dissector these frames are to be directed to.
677 Maximum frame length::
678 You may not be interested in the full frames from the text file, just the first
679 part. Here you can define how much data from the start of the frame you want to
680 import. If you leave this open the maximum is set to 256kiB.
682 Once all input and import parameters are setup click btn:[Import] to start the
683 import. If your current data wasn’t saved before you will be asked to save it
686 If the import button doesn't unlock, make sure all encapsulation parameters are
687 in the expected range and all unlocked fields are populated when using regex mode
688 (the placeholder text is not used as default).
690 When completed there will be a new capture file loaded with the frames imported
693 [#ChIOFileSetSection]
697 When using the “Multiple Files” option while doing a capture (see:
698 <<ChCapCaptureFiles>>), the capture data is spread over several capture files,
701 As it can become tedious to work with a file set by hand, Wireshark provides
702 some features to handle these file sets in a convenient way.
704 .How does Wireshark detect the files of a file set?
706 A filename in a file set uses the format Prefix_Number_DateTimeSuffix (or,
707 in Wireshark 4.4.0 and later, Prefix_DateTime_NumberSuffix) which might
708 look something like `test_00001_20240714183910.pcap`. All files of a file
709 set share the same prefix (e.g., “test”) and suffix (e.g., “.pcap”) and a
710 varying middle part. Files are also allowed to have a second compression
711 suffix of types that Wireshark can open; the compression suffix does not
712 have to match for all files in a set.
714 To find the files of a file set, Wireshark scans the directory where the
715 currently loaded file resides and checks for files matching the filename pattern
716 (prefix and suffix) of the currently loaded file.
718 This simple mechanism usually works well but has its drawbacks. If several file
719 sets were captured with the same prefix and suffix, Wireshark will detect them
720 as a single file set. If files were renamed or spread over several directories
721 the mechanism will fail to find all files of a set.
724 The following features in the menu:File[File Set] submenu are available to work
725 with file sets in a convenient way:
727 * The “List Files” dialog box will list the files Wireshark has recognized as
728 being part of the current file set.
730 * btn:[Next File] closes the current and opens the next file in the file
733 * btn:[Previous File] closes the current and opens the previous file in the
736 [#ChIOFileSetListDialog]
738 ==== The “List Files” Dialog Box
740 .The “List Files” dialog box
741 image::images/ws-file-set-dialog.png[{medium-screenshot-attrs}]
743 Each line contains information about a file of the file set:
746 The name of the file. If you click on the filename (or the radio
747 button left to it), the current file will be closed and the corresponding
748 capture file will be opened.
751 The creation time of the file.
754 The last time the file was modified.
757 The size of the file.
759 The last line will contain info about the currently used directory where all of
760 the files in the file set can be found.
762 The content of this dialog box is updated each time a capture file is
765 The btn:[Close] button will, well, close the dialog box.
769 // - Add {missing} for other exports?
773 Wireshark provides a variety of options for exporting packet data.
774 This section describes general ways to export data from the main Wireshark application.
775 There are many other ways to export or extract data from capture files, including processing <<AppToolstshark,tshark>> output and customizing Wireshark and TShark using Lua scripts.
777 [#ChIOExportSpecifiedPacketsDialog]
779 ==== The “Export Specified Packets” Dialog Box
781 .The “Export Specified Packets” dialog box
782 image::images/ws-export-specified-packets.png[{medium-screenshot-attrs}]
784 This is similar to the “<<ChIOSaveAs,Save>>” dialog box, but it lets you save specific packets.
785 This can be useful for trimming irrelevant or unwanted packets from a capture file.
786 See <<ChIOPacketRangeSection,Packet Range>> for details on the range controls.
788 [#ChIOExportPacketDissectionsDialog]
790 ==== The “Export Packet Dissections” Dialog Box
792 This lets you save the packet list, packet details, and packet bytes as plain text, CSV, JSON, and other formats.
794 .The “Export Packet Dissections” dialog box
795 image::images/ws-export-packet-dissections.png[{medium-screenshot-attrs}]
797 The format can be selected from the “Export As” drop-down and further customized using the “<<ChIOPacketRangeSection,Packet Range>>” and “<<ChIOPacketRangeSection,Packet Format>>” controls.
798 Some controls are unavailable for some formats, notably CSV and JSON.
799 The following formats are supported:
801 * Plain text as shown in the main window
802 * link:{wikipedia-main-url}Comma-separated_values[Comma-separated values (CSV)]
803 * link:{wikipedia-main-url}C_(programming_language)[C-compatible] byte arrays
804 * link:https://web.archive.org/web/20141115200425/http://www.nbee.org/doku.php?id=netpdl:psml_specification[PSML] (summary XML)
805 * link:https://web.archive.org/web/20140416072301/http://www.nbee.org/doku.php?id=netpdl:pdml_specification[PDML] (detailed XML)
806 * link:{wikipedia-main-url}JSON[JavaScript Object Notation (JSON)]
808 Here are some examples of exported data:
812 No. Time Source Destination Protocol Length SSID Info
813 1 0.000000 200.121.1.131 172.16.0.122 TCP 1454 10554 → 80 [ACK] Seq=1 Ack=1 Win=65535 Len=1400 [TCP segment of a reassembled PDU]
815 Frame 1: 1454 bytes on wire (11632 bits), 1454 bytes captured (11632 bits)
816 Ethernet II, Src: 00:50:56:c0:00:01, Dst: 00:0c:29:42:12:13
817 Internet Protocol Version 4, Src: 200.121.1.131 (200.121.1.131), Dst: 172.16.0.122 (172.16.0.122)
818 0100 .... = Version: 4
819 .... 0101 = Header Length: 20 bytes (5)
820 Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
822 Identification: 0x0141 (321)
824 ...0 0000 0000 0000 = Fragment offset: 0
827 Header checksum: 0xd390 [validation disabled]
828 [Header checksum status: Unverified]
829 Source: 200.121.1.131 (200.121.1.131)
830 Destination: 172.16.0.122 (172.16.0.122)
831 [Source GeoIP: PE, ASN 6147, Telefonica del Peru S.A.A.]
832 Transmission Control Protocol, Src Port: 10554, Dst Port: 80, Seq: 1, Ack: 1, Len: 1400
838 If you would like to be able to <<ChIOImportSection,import>> any previously exported packets from a plain text file it is recommended that you do the following:
840 * Add the “Absolute date and time” column.
842 * Temporarily hide all other columns.
844 * Disable the menu:Edit[Preferences,Protocols,Data] “Show not dissected data
845 on new Packet Bytes pane” preference. More details are provided in
846 <<ChCustPreferencesSection>>
848 * Include the packet summary line.
850 * Exclude column headings.
852 * Exclude packet details.
854 * Include the packet bytes.
859 "No.","Time","Source","Destination","Protocol","Length","SSID","Info","Win Size"
860 "1","0.000000","200.121.1.131","172.16.0.122","TCP","1454","","10554 > 80 [ACK] Seq=1 Ack=1 Win=65535 Len=1400 [TCP segment of a reassembled PDU]","65535"
861 "2","0.000011","172.16.0.122","200.121.1.131","TCP","54","","[TCP ACKed unseen segment] 80 > 10554 [ACK] Seq=1 Ack=11201 Win=53200 Len=0","53200"
862 "3","0.025738","200.121.1.131","172.16.0.122","TCP","1454","","[TCP Spurious Retransmission] 10554 > 80 [ACK] Seq=1401 Ack=1 Win=65535 Len=1400 [TCP segment of a reassembled PDU]","65535"
863 "4","0.025749","172.16.0.122","200.121.1.131","TCP","54","","[TCP Window Update] [TCP ACKed unseen segment] 80 > 10554 [ACK] Seq=1 Ack=11201 Win=63000 Len=0","63000"
864 "5","0.076967","200.121.1.131","172.16.0.122","TCP","1454","","[TCP Previous segment not captured] [TCP Spurious Retransmission] 10554 > 80 [ACK] Seq=4201 Ack=1 Win=65535 Len=1400 [TCP segment of a reassembled PDU]","65535"
870 "_index": "packets-2014-06-22",
876 "frame.encap_type": "1",
877 "frame.time": "Jun 22, 2014 13:29:41.834477000 PDT",
878 "frame.offset_shift": "0.000000000",
879 "frame.time_epoch": "1403468981.834477000",
880 "frame.time_delta": "0.450535000",
881 "frame.time_delta_displayed": "0.450535000",
882 "frame.time_relative": "0.450535000",
885 "frame.cap_len": "86",
887 "frame.ignored": "0",
888 "frame.protocols": "eth:ethertype:ipv6:icmpv6",
889 "frame.coloring_rule.name": "ICMP",
890 "frame.coloring_rule.string": "icmp || icmpv6"
893 "eth.dst": "33:33:ff:9e:e3:8e",
895 "eth.dst_resolved": "33:33:ff:9e:e3:8e",
896 "eth.dst.oui": "3355647",
897 "eth.addr": "33:33:ff:9e:e3:8e",
898 "eth.addr_resolved": "33:33:ff:9e:e3:8e",
899 "eth.addr.oui": "3355647",
905 "eth.src": "00:01:5c:62:8c:46",
907 "eth.src_resolved": "00:01:5c:62:8c:46",
908 "eth.src.oui": "348",
909 "eth.src.oui_resolved": "Cadant Inc.",
910 "eth.addr": "00:01:5c:62:8c:46",
911 "eth.addr_resolved": "00:01:5c:62:8c:46",
912 "eth.addr.oui": "348",
913 "eth.addr.oui_resolved": "Cadant Inc.",
919 "eth.type": "0x000086dd"
924 "ipv6.tclass": "0x00000000",
925 "ipv6.tclass_tree": {
926 "ipv6.tclass.dscp": "0",
927 "ipv6.tclass.ecn": "0"
929 "ipv6.flow": "0x00000000",
933 "ipv6.src": "2001:558:4080:16::1",
934 "ipv6.addr": "2001:558:4080:16::1",
935 "ipv6.src_host": "2001:558:4080:16::1",
936 "ipv6.host": "2001:558:4080:16::1",
937 "ipv6.dst": "ff02::1:ff9e:e38e",
938 "ipv6.addr": "ff02::1:ff9e:e38e",
939 "ipv6.dst_host": "ff02::1:ff9e:e38e",
940 "ipv6.host": "ff02::1:ff9e:e38e",
941 "ipv6.geoip.src_summary": "US, ASN 7922, Comcast Cable Communications, LLC",
942 "ipv6.geoip.src_summary_tree": {
943 "ipv6.geoip.src_country": "United States",
944 "ipv6.geoip.country": "United States",
945 "ipv6.geoip.src_country_iso": "US",
946 "ipv6.geoip.country_iso": "US",
947 "ipv6.geoip.src_asnum": "7922",
948 "ipv6.geoip.asnum": "7922",
949 "ipv6.geoip.src_org": "Comcast Cable Communications, LLC",
950 "ipv6.geoip.org": "Comcast Cable Communications, LLC",
951 "ipv6.geoip.src_lat": "37.751",
952 "ipv6.geoip.lat": "37.751",
953 "ipv6.geoip.src_lon": "-97.822",
954 "ipv6.geoip.lon": "-97.822"
958 "icmpv6.type": "135",
960 "icmpv6.checksum": "0x00005b84",
961 "icmpv6.checksum.status": "1",
962 "icmpv6.reserved": "00:00:00:00",
963 "icmpv6.nd.ns.target_address": "2001:558:4080:16:be36:e4ff:fe9e:e38e",
965 "icmpv6.opt.type": "1",
966 "icmpv6.opt.length": "1",
967 "icmpv6.opt.linkaddr": "00:01:5c:62:8c:46",
968 "icmpv6.opt.src_linkaddr": "00:01:5c:62:8c:46"
977 [#ChIOExportSelectedDialog]
979 ==== The “Export Selected Packet Bytes” Dialog Box
981 Export the bytes selected in the “Packet Bytes” pane into a raw binary file.
983 .The “Export Selected Packet Bytes” dialog box
984 image::images/ws-export-selected.png[{medium-screenshot-attrs}]
987 The file name to export the packet data to.
992 [#ChIOExportPDUSDialog]
994 ==== The “Export PDUs to File...” Dialog Box
996 The “Export PDUs to File...” dialog box allows you to filter the captured Protocol Data Units (PDUs) and export them into the file. It allows you to export reassembled PDUs avoiding lower layers such as HTTP without TCP, and decrypted PDUs without the lower protocols such as HTTP without TLS and TCP.
998 . In the main menu select menu:File[Export PDUs to File...]. Wireshark will open a corresponding dialog <<ExportPDUsToFile>>.
1002 .Export PDUs to File window
1003 image::images/ws-export-pdus-to-file.png[{screenshot-attrs}]
1005 . To select the data according to your needs, optionally type a filter value into the `Display Filter` field. For more information about filter syntax, see the link:https://www.wireshark.org/docs/man-pages/wireshark-filter.html[Wireshark Filters] man page.
1007 . In the field below the `Display Filter` field you can choose the level from which you want to export the PDUs to the file. There are seven levels:
1009 .. `DLT User`. You can export a protocol, which is framed in the user data link type table without the need to reconfigure the DLT user table. For more information, see the link:https://gitlab.com/wireshark/wireshark/-/wikis/HowToDissectAnything[How to Dissect Anything] page.
1011 .. `DVB-CI`. You can use it for the Digital Video Broadcasting (DVB) protocol.
1013 .. `Logcat` and `Logcat Text`. You can use them for the Android logs.
1015 .. `OSI layer 3`. You can use it to export PDUs encapsulated in the IPSec or SCTP protocols.
1017 .. `OSI layer 4`. You can use it to export PDUs encapsulated in the TCP or UDP protocols.
1019 .. `OSI layer 7`. You can use it to export the following protocols: CredSSP over TLS, Diameter, protocols encapsulated in TLS and DTLS, H.248, Megaco, RELOAD framing, SIP, SMPP.
1021 NOTE: As a developer you can add any dissector to the existing list or define a new entry in the list by using the functions in `epan/exported_pdu.h`.
1023 . To finish exporting PDUs to file, click the btn:[OK] button in the bottom-right corner. This will close the originally captured file and open the exported results instead as a temporary file in the main Wireshark window.
1025 . You may save the temporary file just like any captured file. See <<ChIOSaveSection>> for details.
1027 NOTE: The file produced has a `Wireshark Upper PDU` encapsulation type that has somewhat limited support outside of Wireshark, but is very flexible and can contain PDUs for any protocol for which there is a Wireshark dissector.
1029 [#ChIOStripHeadersDialog]
1031 ==== The “Strip Headers...” Dialog Box
1033 The “Strip Headers...” dialog box allows you to filter known encapsulation types on whatever protocol layer they appear and export them into a new capture file, removing lower-level protocols. It allows you to export reassembled packets and frames without lower layers such as GPF, GRE, GSE, GTP-U, MPLS, MPE, PPP, and more. If Wireshark has performed decryption, then you can export decrypted IP from protocols like IEEE 802.11 or IPSec without having to save encryption keys.
1035 The procedure is similar to that of <<ChIOExportPDUSDialog>>:
1037 . In the main menu select menu:File[Strip Headers...]. Wireshark will open a corresponding dialog.
1039 . To select the data according to your needs, optionally type a filter value into the `Display Filter` field. For more information about filter syntax, see the link:https://www.wireshark.org/docs/man-pages/wireshark-filter.html[Wireshark Filters] man page.
1041 . In the field below the `Display Filter` field you can choose the encapsulation type you want to find and export to the file. There are two encapsulations supported:
1043 .. `Ethernet`. You can use it to export Ethernet encapsulated in other protocols.
1045 .. `IP`. You can use it to export IPv4 and IPv6 encapsulated in other protocols.
1047 NOTE: As a developer you can add encapsulations to the list by using the functions in `epan/exported_pdu.h`.
1049 . To finish exporting to file, click the btn:[OK] button in the bottom-right corner. This will close the originally captured file and open the exported results instead as a temporary file in the main Wireshark window.
1051 . You may save the temporary file just like any captured file. See <<ChIOSaveSection>> for details.
1053 NOTE: The new capture files produced have standard encapsulation types and can be read in nearly any tool.
1055 [#ChIOExportTLSSessionKeys]
1057 ==== The “Export TLS Session Keys...” Dialog Box
1059 Transport Layer Security (TLS) encrypts the communication between a client and a server. The most common use for it is web browsing via HTTPS.
1061 Decryption of TLS traffic requires TLS secrets. You can get them in the form of stored session keys in a "key log file", or by using an RSA private key file. For more details, see the link:{wireshark-wiki-url}TLS[TLS wiki page].
1063 The menu:File[Export TLS Session Keys…] menu option generates a new "key log file" which contains TLS session secrets known by Wireshark. This feature is useful if you typically decrypt TLS sessions using the RSA private key file. The RSA private key is very sensitive because it can be used to decrypt other TLS sessions and impersonate the server. Session keys can be used only to decrypt sessions from the packet capture file. However, session keys are the preferred mechanism for sharing data over the Internet.
1065 To export captured TLS session keys, follow the steps below:
1067 . In the main menu select menu:File[Export TLS Session Keys...]. Wireshark will open a corresponding dialog <<TlsSessionKeys>>.
1071 .Export TLS Session Keys window
1072 image::images/ws-tls-session-keys.png[{screenshot-attrs}]
1074 . Type the desired file name in the `Save As` field.
1076 . Choose the destination folder for your file in the `Where` field.
1078 . Press the btn:[Save] button to complete the export file procedure.
1080 [#ChIOExportObjectsDialog]
1082 ==== The “Export Objects” Dialog Box
1084 This feature scans through the selected protocol's streams in the currently
1085 open capture file or running capture and allows the user to export reassembled
1086 objects to the disk. For example, if you select HTTP, you can export HTML
1087 documents, images, executables, and any other files transferred over HTTP
1088 to the disk. If you have a capture running, this list is automatically
1089 updated every few seconds with any new objects seen. The saved objects can then
1090 be opened or examined independently of Wireshark.
1092 .The “Export Objects” dialog box
1093 image::images/ws-export-objects.png[{screenshot-attrs}]
1098 The packet number in which this object was found. In some
1099 cases, there can be multiple objects in the same packet.
1102 The hostname of the server that sent this object.
1105 The content type of this object.
1108 The size of this object in bytes.
1111 The filename for this object. Each protocol generates
1112 the filename differently. For example, HTTP uses the
1113 final part of the URI and IMF uses the subject of the email.
1118 Only displays objects containing the specified text string.
1121 Opens this section of the “User’s Guide”.
1124 Saves all objects (including those not displayed) using the filename from the
1125 filename column. You will be asked what directory or folder to save them in.
1128 Closes the dialog without exporting.
1131 Saves the currently selected object as a filename you specify. The
1132 default filename to save as is taken from the filename column of the objects
1137 === Printing Packets
1139 To print packets, select the menu:File[Print...] menu item.
1140 Wireshark will display the “Print” dialog box as shown below.
1143 .It’s easy to waste paper doing this
1145 Printed output can contain lots of text, particularly if you print packet details and bytes.
1148 ==== The “Print” Dialog Box
1150 [#ChIOPrintDialogBox]
1152 .The “Print” dialog box
1153 image::images/ws-print.png[{medium-screenshot-attrs}]
1155 The “Print” dialog box shows a preview area which shows the result of changing the packet format settings.
1156 You can zoom in and out using the kbd:[{plus}] and kbd:[-] keys and reset the zoom level using the kbd:[0] key.
1157 The following settings are available in the Print dialog box:
1160 Lets you specify what gets printed. See <<ChIOPacketFormatFrame>> for details.
1163 Include a summary line for each packet.
1164 The line will contain the same fields as the packet list.
1167 Print details for each packet.
1170 Print a hex dump of each packet.
1173 Select the packets to be printed. See <<ChIOPacketRangeSection>> for details.
1175 btn:[Page Setup...] lets you select the page size and orientation.
1177 btn:[Print...] prints to your default printer.
1179 btn:[Cancel] will close the dialog without printing.
1181 btn:[Help] will display this section of the “User’s Guide”.
1183 [#ChIOPacketRangeSection]
1185 === The “Packet Range” Frame
1187 The packet range frame is a part of the “<<ChIOExportSpecifiedPacketsDialog,Export Specified Packets>>,” “<<ChIOExportPacketDissectionsDialog,Export Packet Dissections>>,” and “<<ChIOPrintSection,Print>>” dialog boxes.
1188 You can use it to specify which packets will be exported or printed.
1190 [#ChIOPacketRangeFrame]
1192 .The “Packet Range” frame
1193 image::images/ws-packet-range.png[{medium-screenshot-attrs}]
1195 By default, the btn:[Displayed] button is set, which only exports or prints the packets that match the current display filter.
1196 Selecting btn:[Captured] will export or print all packets.
1197 You can further limit what you export or print to the following:
1200 All captured or displayed packets depending on the primary selection above.
1203 Only the selected packet.
1206 Only marked packets. See <<ChWorkMarkPacketSection>>.
1208 First to last marked::
1209 Lets you mark an inclusive range of packets.
1212 Lets you manually specify a range of packets, e.g., _5,10-15,20-_ will process the packet number five, the packets from packet number ten to fifteen (inclusive) and every packet from number twenty to the end of the capture.
1214 Remove ignored packets::
1215 Don't export or print ignored packets.
1216 See <<ChWorkIgnorePacketSection>>.
1218 [#ChIOPacketFormatSection]
1220 === The Packet Format Frame
1222 The packet format frame is also a part of the “<<ChIOExportPacketDissectionsDialog,Export Packet Dissections>>” and “<<ChIOPrintSection,Print>>” dialog boxes.
1223 You can use it to specify which parts of dissection are exported or printed.
1225 [#ChIOPacketFormatFrame]
1227 .The “Packet Format” frame
1228 image::images/ws-packet-format.png[{small-screenshot-attrs}]
1230 Each of the settings below correspond to the packet list, packet detail, and packet bytes in the main window.
1232 Packet summary line::
1233 Export or print each summary line as shown in the “Packet List” pane.
1236 Export or print the contents of the “Packet Details” tree.
1239 Export or print as if the “Packet Details” tree is in the “all collapsed” state.
1242 Export or print as if the “Packet Details” tree is in the “as displayed” state.
1245 Export or print as if the “Packet Details” tree is in the “all expanded” state.
1248 Export or print the contents of the “Packet Bytes” pane.
1250 Each packet on a new page::
1251 For printing and some export formats, put each packet on a separate page.
1252 For example, when exporting to a text file this will put a form feed character between each packet.
1254 Capture information header::
1255 Add a header to each page with capture filename and the number of total packets and shown packets.
1257 // End of WSUG Chapter IO