5 == Working With Captured Packets
7 [#ChWorkViewPacketsSection]
9 === Viewing Packets You Have Captured
11 Once you have captured some packets or you have opened a previously saved
12 capture file, you can view the packets that are displayed in the packet list
13 pane by simply clicking on a packet in the packet list pane, which will bring up
14 the selected packet in the tree view and byte view panes.
16 You can then expand any part of the tree to view detailed information about each
17 protocol in each packet. Clicking on an item in the tree will highlight the
18 corresponding bytes in the byte view. An example with a TCP packet selected is
19 shown in <<ChWorkSelPack1>>. It also has the Acknowledgment number in the TCP
20 header selected, which shows up in the byte view as the selected bytes.
24 .Wireshark with a TCP packet selected for viewing
25 image::images/ws-packet-selected.png[{screenshot-attrs}]
27 You can also select and view packets the same way while Wireshark is capturing
28 if you selected “Update list of packets in real time” in the “Capture
29 Preferences” dialog box.
31 In addition you can view individual packets in a separate window as shown in
32 <<ChWorkPacketSepView>>. You can do this by double-clicking on an item in the
33 packet list or by selecting the packet in which you are interested in the packet
34 list pane and selecting menu:View[Show Packet in New Window]. This allows you to
35 easily compare two or more packets, even across multiple files.
37 [#ChWorkPacketSepView]
39 .Viewing a packet in a separate window
40 image::images/ws-packet-sep-win.png[{screenshot-attrs}]
42 Along with double-clicking the packet list and using the main menu there are a
43 number of other ways to open a new packet window:
45 - Hold down the shift key and double-click on a frame link in the packet
47 - From <<PacketListPopupMenuTable>>.
48 - From <<PacketDetailsPopupMenuTable>>.
50 [#ChWorkDisplayPopUpSection]
54 You can open a pop-up menu over the “Packet List”, its column heading,
55 “Packet Details”, or “Packet Bytes” by clicking your right mouse button
56 on the corresponding item.
58 [#ChWorkColumnHeaderPopUpMenuSection]
60 ==== Pop-up Menu Of The “Packet List” Column Header
62 [#ChWorkColumnHeaderPopUpMenu]
63 .Pop-up menu of the “Packet List” column header
64 image::images/ws-column-header-popup-menu.png[{screenshot-attrs}]
66 The following table gives an overview of which functions are available
67 in this header, where to find the corresponding function in the main
68 menu, and a description of each item.
70 [#ColumnHeaderPopupMenuTable]
71 .The menu items of the “Packet List” column header pop-up menu
72 [options="header",cols="3,7"]
77 Left-align values in this column.
79 |menu:Align Center[] |
80 Center-align values in this column.
83 Right-align values in this column.
85 |menu:Column Preferences...[] |
86 Open the “Preferences” dialog for this column.
89 Open the column editor toolbar for this column.
91 |menu:Resize To Contents[] |
92 Resize the column to fit its values.
94 |menu:Display as Values[] |
95 Display the raw values for fields.
97 |menu:Display as Strings[] |
98 Display human-readable strings instead of raw values for fields.
99 Only applicable to custom columns with fields that have value strings
100 and custom columns which can be resolved to strings.
102 |menu:Display as packet Details[] |
103 Display the values using the same format as in Packet Details.
104 Only applicable to custom columns.
106 | _No., Time, Source, et al._ |
107 Show or hide a column by selecting its item.
109 |menu:Remove Column[] |
110 Remove this column, similar to deleting it in the “Preferences” dialog.
114 [#ChWorkPacketListPanePopUpMenuSection]
116 ==== Pop-up Menu Of The “Packet List” Pane
118 [#ChWorkPacketListPanePopUpMenu]
120 .Pop-up menu of the “Packet List” pane
121 image::images/ws-packet-pane-popup-menu.png[{screenshot-attrs}]
123 The following table gives an overview of which functions are available
124 in this pane, where to find the corresponding function in the main menu,
125 and a short description of each item.
127 [#PacketListPopupMenuTable]
128 .The menu items of the “Packet List” pop-up menu
129 [options="header",cols="3,1,6"]
131 |Item |Corresponding main menu item |Description
132 |menu:Mark Packet (toggle)[]|menu:Edit[]| Mark or unmark a packet.
133 |menu:Ignore Packet (toggle)[]|menu:Edit[]| Ignore or inspect this packet while dissecting the capture file.
134 |menu:Set Time Reference (toggle)[]|menu:Edit[]| Set or reset a time reference.
136 |menu:Time Shift[] |menu:Edit[] |
137 Opens the “Time Shift” dialog, which allows you to adjust the timestamps
138 of some or all packets.
140 |menu:Packet Comment...[] |menu:Edit[] |
141 Opens the “Packet Comment” dialog, which lets you add a comment to a
142 single packet. Note that the ability to save packet comments depends on
143 your file format. E.g., pcapng supports comments, pcap does not.
145 |menu:Edit Resolved Name[]||
146 Allows you to enter a name to resolve for the selected address.
148 |menu:Apply as Filter[]|menu:Analyze[]|
149 Immediately replace or append the current display filter based on the most recent packet list or packet details item selected.
150 The first submenu item shows the filter and subsequent items show the different ways that the filter can be applied.
152 |menu:Prepare as Filter[]|menu:Analyze[]|
153 Change the current display filter based on the most recent packet list or packet details item selected, but don't apply it.
154 The first submenu item shows the filter and subsequent items show the different ways that the filter can be changed.
156 // XXX - add a new section describing this better.
157 |menu:Conversation Filter[] ||
158 Apply a display filter with the address information from the selected packet.
159 For example, the IP menu entry will set a filter to show the traffic between the two IP addresses of the current packet.
161 |menu:Colorize Conversation[] ||
162 Create a new colorizing rule based on address information from the selected packet.
165 Allows you to analyze and prepare a filter for this SCTP association.
168 |menu:Follow[] |menu:Analyze[] |
169 Opens a sub-menu with options of various types of protocol streams
170 to follow. The entries for protocols which aren't found in the
171 currently selected packet will not be shown.
172 See <<ChAdvFollowStreamSection>>.
174 |menu:Copy[Summary as Text] ||
175 Copy the summary fields as displayed to the clipboard as tab-separated
178 |menu:Copy[...as CSV] ||
179 Copy the summary fields as displayed to the clipboard as comma-separated
182 |menu:Copy[...as YAML] ||
183 Copy the summary fields as displayed to the clipboard as YAML data.
185 |menu:Copy[As Filter] ||
186 Prepare a display filter based on the currently selected item and copy
187 that filter to the clipboard.
189 |menu:Copy[Bytes as Hex + ASCII Dump] ||
190 Copy the packet bytes to the clipboard in full “hexdump” format.
192 |menu:Copy[...as Hex Dump] ||
193 Copy the packet bytes to the clipboard in “hexdump” format without the
196 |menu:Copy[...as Printable Text] ||
197 Copy the packet bytes to the clipboard as ASCII text, excluding
198 non-printable characters.
200 |menu:Copy[...as a Hex Stream] ||
201 Copy the packet bytes to the clipboard as an unpunctuated list of hex
204 |menu:Copy[...as Raw Binary] ||
205 Copy the packet bytes to the clipboard as raw binary. The data is stored
206 in the clipboard using the MIME type “application/octet-stream”.
208 |menu:Protocol Preferences[] ||
209 Adjust the <<ChCustPreferencesSection,preferences>> for the selected protocol,
210 or disable it entirely. (You can re-enable it with the
211 <<ChAdvEnabledProtocols,“Enabled Protocols” dialog box>>.)
213 |menu:Decode As...[] |menu:Analyze[] |
214 Change or apply a new relation between two dissectors.
216 |menu:Show Packet in New Window[] |menu:View[] |
217 Shows the selected packet in a separate window. The separate window
218 shows only the packet details and bytes. See <<ChWorkPacketSepView>> for
224 [#ChWorkPacketDetailsPanePopUpMenuSection]
226 ==== Pop-up Menu Of The “Packet Details” Pane
228 [#ChWorkPacketDetailsPanePopUpMenu]
230 .Pop-up menu of the “Packet Details” pane
231 image::images/ws-details-pane-popup-menu.png[{screenshot-attrs}]
233 The following table gives an overview of which functions are available in this
234 pane, where to find the corresponding function in the main menu, and a short
235 description of each item.
237 [#PacketDetailsPopupMenuTable]
239 .The menu items of the “Packet Details” pop-up menu
240 [options="header",cols="3,1,6"]
242 |Item |Corresponding main menu item |Description
243 |menu:Expand Subtrees[]|menu:View[]| Expand the currently selected subtree.
244 |menu:Collapse Subtrees[]|menu:View[]| Collapse the currently selected subtree.
245 |menu:Expand All[]|menu:View[]| Expand all subtrees in all packets in the capture.
246 |menu:Collapse All[]|menu:View[]| Wireshark keeps a list of all the protocol subtrees that are expanded, and uses it to ensure that the correct subtrees are expanded when you display a packet. This menu item collapses the tree view of all packets in the capture list.
247 |menu:Edit Resolved Name[]|menu:View[]| Allows you to enter a name to resolve for the selected address.
248 |menu:Apply as Column[]|| Use the selected protocol item to create a new column in the packet list.
250 |menu:Apply as Filter[]|menu:Analyze[]|
251 Immediately replace or append the current display filter based on the most recent packet list or packet details item selected.
252 The first submenu item shows the filter and subsequent items show the different ways that the filter can be applied.
254 |menu:Prepare as Filter[]|menu:Analyze[]|
255 Change the current display filter based on the most recent packet list or packet details item selected, but don't apply it.
256 The first submenu item shows the filter and subsequent items show the different ways that the filter can be changed.
258 |menu:Colorize with Filter[]|| This menu item uses a display filter with the information from the selected protocol item to build a new colorizing rule.
260 |menu:Follow[] |menu:Analyze[] |
261 Opens a sub-menu with options of various types of protocol streams
262 to follow. The entries for protocols which aren't found in the
263 currently selected packet will not be shown.
264 See <<ChAdvFollowStreamSection>>.
266 |menu:Copy[All Visible Items] |menu:Edit[] |
267 Copy the packet details as displayed.
269 |menu:Copy[All Visible Selected Tree Items] |menu:Edit[] |
270 Copy the selected packet detail and its children as displayed.
272 |menu:Copy[Description] |menu:Edit[] |
273 Copy the displayed text of the selected field to the system clipboard.
275 |menu:Copy[Fieldname] |menu:Edit[] |
276 Copy the name of the selected field to the system clipboard.
278 |menu:Copy[Value] |menu:Edit[] |
279 Copy the value of the selected field to the system clipboard.
281 |menu:Copy[As Filter]| menu:Edit[] |
282 Prepare a display filter based on the currently selected item and copy
285 |menu:Copy[Bytes as Hex + ASCII Dump] ||
286 Copy the packet bytes to the clipboard in full “hexdump” format.
288 |menu:Copy[...as Hex Dump] ||
289 Copy the packet bytes to the clipboard in “hexdump” format without the
292 |menu:Copy[...as Printable Text] ||
293 Copy the packet bytes to the clipboard as ASCII text, excluding
294 non-printable characters.
296 |menu:Copy[...as a Hex Stream] ||
297 Copy the packet bytes to the clipboard as an unpunctuated list of hex
300 |menu:Copy[...as Raw Binary] ||
301 Copy the packet bytes to the clipboard as raw binary. The data is stored
302 in the clipboard using the MIME type “application/octet-stream”.
304 |menu:Copy[...as Escaped String] ||
305 Copy the packet bytes to the clipboard as C-style escape sequences.
307 |menu:Export Packet Bytes...[] |menu:File[] |
308 This menu item is the same as the File menu item of the same name. It
309 allows you to export raw packet bytes to a binary file.
311 |menu:Wiki Protocol Page[]|| Open the wiki page for the selected protocol in your web browser.
312 |menu:Filter Field Reference[]|| Open the filter field reference web page for the selected protocol in your web browser.
314 |menu:Protocol Preferences[] ||
315 Adjust the <<ChCustPreferencesSection,preferences>> for the selected protocol,
316 or disable it entirely. (You can re-enable it with the
317 <<ChAdvEnabledProtocols,“Enabled Protocols” dialog box>>.)
319 |menu:Decode As...[]|menu:Analyze[]| Change or apply a new relation between two dissectors.
321 |menu:Go to Linked Packet[] |menu:Go[] |
322 If the selected field has a corresponding packet such as the matching
323 request for a DNS response, go to it.
325 |menu:Show Linked Packet in New Window[] |menu:Go[] |
326 If the selected field has a corresponding packet such as the matching
327 request for a DNS response, show the selected packet in a separate
328 window. See <<ChWorkPacketSepView>> for details.
332 [#ChWorkPacketBytesPanePopUpMenuSection]
334 ==== Pop-up Menu Of The “Packet Bytes” Pane
336 [#ChWorkPacketBytesPanePopUpMenu]
338 .Pop-up menu of the “Packet Bytes” pane
339 image::images/ws-bytes-pane-popup-menu.png[{screenshot-attrs}]
341 The following table gives an overview of which functions are available
342 in this pane along with a short description of each item.
344 [#PacketBytesPopupMenuTable]
346 .The menu items of the “Packet Bytes” pop-up menu
347 [options="header",cols="3,7"]
351 |menu:Copy Bytes as Hex + ASCII Dump[] |
352 Copy the packet bytes to the clipboard in full “hexdump” format.
354 |menu:...as Hex Dump[] |
355 Copy the packet bytes to the clipboard in “hexdump” format without the
358 |menu:...as Printable Text[] |
359 Copy the packet bytes to the clipboard as ASCII text, excluding
360 non-printable characters.
362 |menu:...as a Hex Stream[] |
363 Copy the packet bytes to the clipboard as an unpunctuated list of hex
366 |menu:...as Raw Binary[] |
367 Copy the packet bytes to the clipboard as raw binary. The data is stored
368 in the clipboard using the MIME type “application/octet-stream”.
370 |menu:...as Escaped String[] |
371 Copy the packet bytes to the clipboard as C-style escape sequences.
373 |menu:Show bytes as hexadecimal[] |
374 Display the byte data as hexadecimal digits.
376 |menu:Show bytes as bits[] |
377 Display the byte data as binary digits.
379 |menu:Show text based on packet[] |
380 Show the “hexdump” data with text.
382 |menu:...as ASCII[] |
383 Use ASCII encoding when displaying “hexdump” text.
385 |menu:...as EBCDIC[] |
386 Use EBCDIC encoding when displaying “hexdump” text.
390 [#ChWorkPacketDiagramPanePopUpMenuSection]
392 ==== Pop-up Menu Of The “Packet Diagram” Pane
394 [#ChWorkPacketDiagramPanePopUpMenu]
396 .Pop-up menu of the “Packet Diagram” pane
397 image::images/ws-diagram-pane-popup-menu.png[{screenshot-attrs}]
399 The following table gives an overview of which functions are available
400 in this pane along with a short description of each item.
402 [#PacketDiagramPopupMenuTable]
404 .The menu items of the “Packet Diagram” pop-up menu
405 [options="header",cols="3,7"]
409 |menu:Show Field Values[] |
410 Display current value for each field on the packet diagram.
412 |menu:Save Diagram As...[] |
413 Save the packet diagram to an image file (PNG, BMP, JPEG).
415 |menu:Copy as Raster Image[] |
416 Copy the packet diagram to the clipboard in raster (ARGB32) format.
419 // (macOS) Copy the packet diagram to the clipboard in SVG format.
423 [#ChWorkDisplayFilterSection]
425 === Filtering Packets While Viewing
427 Wireshark has two filtering languages: _capture filters_ and _display filters_.
428 _Capture filters_ are used for filtering
429 when capturing packets and are discussed in <<ChCapCaptureFilterSection>>.
430 _Display filters_ are used for filtering
431 which packets are displayed and are discussed below.
432 For more information about _display filter_ syntax, see the
433 link:{wireshark-man-page-url}wireshark-filter.html[wireshark-filter(4)] man page.
435 Display filters allow you to concentrate on the packets you are interested in
436 while hiding the currently uninteresting ones. They allow you to only display packets
441 * The presence of a field
443 * The values of fields
445 * A comparison between fields
447 * ... and a lot more!
449 To only display packets containing a particular protocol, type the protocol name
450 in the display filter toolbar of the Wireshark
451 window and press enter to apply the filter. <<ChWorkTCPFilter>> shows an
452 example of what happens when you type _tcp_ in the display filter toolbar.
456 Protocol and field names are usually in lowercase.
461 Don’t forget to press enter or click on the apply display filter button after entering the filter
468 .Filtering on the TCP protocol
469 image::images/ws-display-filter-tcp.png[{screenshot-attrs}]
471 As you may have noticed, only packets containing the TCP protocol are now displayed,
472 so packets 1-10 are hidden and packet number 11
473 is the first packet displayed.
477 When using a display filter, all packets remain in the capture file. The display
478 filter only changes the display of the capture file but not its content!
481 To remove the filter, click on the btn:[Clear] button to the right of the
482 display filter field. All packets will become visible again.
484 Display filters can be very powerful and are discussed in further detail in
485 <<ChWorkBuildDisplayFilterSection>>
487 It's also possible to create display filters with the
488 _Display Filter Expression_ dialog box. More information about
489 the _Display Filter Expression_ dialog box is available in
490 <<ChWorkFilterAddExpressionSection>>.
493 [#ChWorkBuildDisplayFilterSection]
495 === Building Display Filter Expressions
497 Wireshark provides a display filter language that enables you
498 to precisely control which packets are displayed. They can be used
499 to check for the presence of a protocol or field, the value of a field, or
500 even compare two fields to each other. These comparisons can be combined
501 with logical operators, like "and" and "or", and parentheses
502 into complex expressions.
504 The following sections will go into the display filter functionality in
509 There are many display filter examples on the _Wireshark Wiki Display
510 Filter page_ at: link:{wireshark-wiki-url}DisplayFilters[].
513 ==== Display Filter Fields
515 The simplest display filter is one that displays a single protocol.
516 To only display packets containing a particular protocol, type the protocol
517 into Wireshark's display filter toolbar. For example, to only
518 display TCP packets, type _tcp_ into Wireshark's display filter toolbar.
519 Similarly, to only display
520 packets containing a particular field, type the field
521 into Wireshark's display filter toolbar. For example, to only display
522 HTTP requests, type _http.request_ into Wireshark's display filter toolbar.
524 You can filter on any protocol that Wireshark supports. You can
525 also filter on any field that a dissector adds to the tree view, if the dissector
526 has added an abbreviation for that field. A full list of the available protocols
527 and fields is available through the menu item
528 menu:View[Internals,Supported Protocols].
530 // XXX - add some more info here and a link to the statusbar info.
532 ==== Comparing Values
534 You can build display filters that compare values using a number of different
535 comparison operators. For example, to only display packets to or
536 from the IP address 192.168.0.1, use `ip.addr==192.168.0.1`.
538 A complete list of available comparison operators is shown in <<DispCompOps>>.
542 English and C-like operators are interchangeable and can be mixed within a filter string.
547 .Display Filter comparison operators
548 [options="header",cols="1,1,1,3,3"]
550 | English | Alias | C-like | Description | Example
551 | eq | any_eq | == | Equal (any if more than one) | `ip.src == 10.0.0.5`
552 | ne | all_ne | != | Not equal (all if more than one) | `ip.src != 10.0.0.5`
553 | | all_eq | === | Equal (all if more than one) | `ip.src === 10.0.0.5`
554 | | any_ne | !== | Not equal (any if more than one) | `ip.src !== 10.0.0.5`
555 | gt | | > | Greater than | `frame.len > 10`
556 | lt | | < | Less than | `frame.len < 128`
557 | ge | | >= | Greater than or equal to | `frame.len ge 0x100`
558 | le | | \<= | Less than or equal to | `frame.len \<= 0x20`
559 | contains | | | Protocol, field or slice contains a value | `sip.To contains "a1762"`
560 | matches | | ~ | Protocol or text field matches a Perl-compatible regular expression| `http.host matches "acme\\.(org\|com\|net)"`
566 The meaning of != (all not equal) was changed in Wireshark 3.6.
567 Before it used to mean "any not equal".
570 All protocol fields have a type. <<ChWorkFieldTypes>> provides a list
571 of the types with examples of how to use them in display filters.
575 ===== Display Filter Field Types
578 Can be 8, 16, 24, 32, or 64 bits. You can express integers in decimal, octal,
579 hexadecimal or binary. The following display filters are equivalent:
587 `ip.len le 0b10111011100`
590 Can be 8, 16, 24, 32, or 64 bits. As with unsigned integers you can use
591 decimal, octal, hexadecimal or binary.
594 Can be 1 or "True", 0 or "False" (without quotes).
596 A Boolean field is present regardless if its value is true or false. For example,
597 `tcp.flags.syn` is present in all TCP packets containing the flag, whether
598 the SYN flag is 0 or 1. To only match TCP packets with the SYN flag set, you need
599 to use `tcp.flags.syn == 1` or `tcp.flags.syn == True`.
602 6 bytes separated by a colon (:), dot (.), or dash (-) with one or two bytes between separators:
604 `eth.dst == ff:ff:ff:ff:ff:ff`
606 `eth.dst == ff-ff-ff-ff-ff-ff`
608 `eth.dst == ffff.ffff.ffff`
611 `ip.addr == 192.168.0.1`
613 Classless InterDomain Routing (CIDR) notation can be used to test if
614 an IPv4 address is in a certain subnet. For example, this display
615 filter will find all packets in the 129.111 Class-B network:
617 `ip.addr == 129.111.0.0/16`
622 As with IPv4 addresses, IPv6 addresses can match a subnet.
625 `http.request.uri == "https://www.wireshark.org/"`
627 Strings are a sequence of bytes. Functions like `lower()` use ASCII, otherwise
628 no particular encoding is assumed. String literals are specified with double
629 quotes. Characters can also be specified using a byte escape sequence using
630 hex \x__hh__ or octal {backslash}__ddd__, where _h_ and _d_ are hex and octal
631 numerical digits respectively:
633 `dns.qry.name contains "www.\x77\x69\x72\x65\x73\x68\x61\x72\x6b.org"`
635 Alternatively, a raw string syntax can be used. Such strings are prefixed with `r` or `R` and treat
636 backslash as a literal character.
638 `http.user_agent matches r"\(X11;"`
641 `frame.time == "Sep 26, 2004 23:18:04.954975"`
643 `ntp.xmt ge "2020-07-04 12:34:56"`
645 The value of an absolute time field is expressed as a string, using one of the
646 two formats above. Fractional seconds can be omitted or specified up to
647 nanosecond precision; extra trailing zeros are allowed but not other digits.
648 The string cannot take a time zone suffix, and is always parsed as in the local
649 time zone, even for fields that are displayed in UTC.
651 In the first format, the abbreviated month names must be in English regardless
652 of locale. In the second format, any number of time fields may be omitted, in
653 the order from least significant (seconds) to most, but at least the entire
654 date must be specified:
656 `frame.time < "2022-01-01"`
658 In the second format, a `T` may appear between the date and time as in
659 ISO 8601, but not when less significant times are dropped.
661 [#ChWorkFilterExamples]
666 udp contains 81:60:03
668 The display filter above matches packets that contains the 3-byte sequence 0x81, 0x60,
669 0x03 anywhere in the UDP header or payload.
671 sip.To contains "a1762"
673 The display filter above matches packets where the SIP To-header contains the string "a1762"
674 anywhere in the header.
676 http.host matches "acme\\.(org|com|net)"
678 The display filter above matches HTTP packets where the HOST header contains
679 acme.org, acme.com, or acme.net.
680 Comparisons are case-insensitive.
684 That display filter will match all packets that contain the “tcp.flags” field with the 0x02 bit,
685 i.e., the SYN bit, set.
687 ===== Possible Pitfalls Using Regular Expressions
689 String literals containing regular expressions are parsed twice. Once by Wireshark's display
690 filter engine and again by the PCRE2 library. It's important to keep this in mind when using
691 the "matches" operator with regex escape sequences and special characters.
693 For example, the filter expression `+frame matches "AB\x43"+` uses the string `+"ABC"+` as input
694 pattern to PCRE. However, the expression `+frame matches "AB\\x43"+` uses the string `+"AB\x43"+`
695 as the pattern. In this case both expressions give the same result because Wireshark and PCRE
696 both support the same byte escape sequence (0x43 is the ASCII hex code for `C`).
698 An example where this fails badly is `+foo matches "bar\x28"+`. Because 0x28 is the ASCII
699 code for `(` the pattern input to PCRE is `+"bar("+`. This regular expression is syntactically
700 invalid (missing closing parenthesis). To match a literal parenthesis in a display filter regular
701 expression it must be escaped (twice) with backslashes.
703 TIP: Using raw strings avoids most problem with the "matches" operator and double escape requirements.
705 ==== Combining Expressions
707 You can combine filter expressions in Wireshark using the logical operators shown in <<FiltLogOps>>
711 .Display Filter Logical Operations
712 [options="header",cols="1,1,1,4"]
714 |English |C-like |Description | Example
715 |and |&&| Logical AND | `ip.src==10.0.0.5 and tcp.flags.fin`
716 |or |\|\| | Logical OR | `ip.src==10.0.0.5 or ip.src==192.1.1.1`
717 |xor |^^ | Logical XOR | `tr.dst[0:3] == 0.6.29 xor tr.src[0:3] == 0.6.29`
718 |not |! | Logical NOT | `not llc`
719 |[...] | | Subsequence | See “Slice Operator” below.
720 |in | | Set Membership| http.request.method in {"HEAD", "GET"}. See “Membership Operator” below.
724 Wireshark allows you to select a subsequence of byte arrays (including
725 protocols) or text strings in rather elaborate ways. After a label you can
726 place a pair of brackets [] containing a comma separated list of range
729 eth.src[0:3] == 00:00:83
731 The example above uses the n:m format to specify a single range. In this case n
732 is the beginning offset and m is the length of the range being specified.
734 eth.src[1-2] == 00:83
736 The example above uses the n-m format to specify a single range. In this case n
737 is the beginning offset and m is the ending offset.
739 eth.src[:4] == 00:00:83:00
741 The example above uses the :m format, which takes everything from the beginning
742 of a sequence to offset m. It is equivalent to 0:m
746 The example above uses the n: format, which takes everything from offset n to
747 the end of the sequence.
751 The example above uses the n format to specify a single range. In this case the
752 element in the sequence at offset n is selected. This is equivalent to n:1.
754 eth.src[0:3,1-2,:4,4:,2] ==
755 00:00:83:00:83:00:00:83:00:20:20:83
757 Wireshark allows you to string together single ranges in a comma separated list
758 to form compound ranges as shown above.
760 You can use the slice operator on a protocol name, too, to slice the
761 bytes associated with that protocol. The `+frame+` protocol can be useful,
762 encompassing all the captured data (not including secondary data sources
763 like decrypted data.)
765 Offsets can be negative, indicating an offset from the end of a field.
767 frame[-4:4] == 0.1.2.3
768 frame[-4:] == 0.1.2.3
770 The two examples above both check the last four bytes of a frame.
772 Slices of string fields yield strings, and are indexed on codepoint
773 boundaries after conversation of the string to UTF-8, not bytes.
775 http.content_type[0:4] == "text"
776 smpp.message_text[:10] == "Абвгдеёжзи"
778 The second example above will match regardless of whether the original
779 string was in Windows-1251, UTF-8, or UTF-16, so long as the converted
780 string starts with those ten characters.
782 Byte slices can be directly compared to strings; this converts the
783 string to the corresponding UTF-8 byte sequence. To compare string
784 slices with byte sequences, use the @ operator, below.
786 ==== The Layer Operator
788 A field can be restricted to a certain layer in the protocol stack using the
789 layer operator (#), followed by a decimal number:
791 ip.addr#2 == 192.168.30.40
793 matches only the inner (second) layer in the packet.
794 Layers use simple stacking semantics and protocol layers are counted sequentially starting from 1.
795 For example, in a packet that contains two IPv4 headers, the outer (first) source address can be matched with "ip.src#1" and the inner (second) source address can be matched with "ip.src#2".
797 For more complicated ranges the same syntax used with slices is valid:
801 means layers number 2, 3 or 4 inclusive. The hash symbol is required to
802 distinguish a layer range from a slice.
805 By prefixing the field name with an at sign (@) the comparison is done against
806 the raw packet data for the field.
808 A character string must be decoded from a source encoding during dissection.
809 If there are decoding errors the resulting string will usually contain
810 replacement characters:
812 [subs="replacements"]
814 browser.comment == "string is ����"
817 The at operator allows testing the raw undecoded data:
819 @browser.comment == 73:74:72:69:6e:67:20:69:73:20:aa:aa:aa:aa
822 The syntactical rules for a bytes field type apply to the second example.
826 When a bytes field is compared with a literal string, it is compared
827 with the UTF-8 representation of that string. The at operator compares
828 a string field with the actual byte representation in the original encoding,
829 which may not be UTF-8.
831 As an example, SMPP has a bytes field, `+smpp.message+`, and a string
832 field, `+smpp.message_text+`, that refer to the same data. If the
833 first four characters of the message is the string "Text" in the UTF-16
834 encoding, the following filters all match.
837 smpp.message[:8] == 00:54:00:65:00:73:00:74
838 smpp.message[:8] == "\x00T\x00e\x00s\x00t"
839 smpp.message_text[:4] == "Test"
840 smpp.message_text[:4] == "\x54\x65\x73\x74"
841 @smpp.message_text[:8] == 00:54:00:65:00:73:00:74
842 @smpp.message_text[:8] == "\x00T\x00e\x00s\x00t"
845 The following filters do *NOT* match.
848 @smpp.message_text[:4] == "\x00T\x00e\x00s\x00t"
849 smpp.message[:4] == "Test"
850 smpp.message[:8] == "Test"
851 @smpp.message_text[:4] == "Test"
852 @smpp.message_text[:8] == "Test"
855 The first filter above does not match because of operator precedence
856 left-to-right; `+@smpp.message_text` is converted to bytes before the
857 slice operator is applied, so the length of the necessary slice is 8.
858 The other filters do not match because the literal string "Test" is
859 always converted to its 4 octet UTF-8 representation when comparing
860 against bytes, and it does not match the UTF-16 representation of
865 ==== Membership Operator
866 Wireshark allows you to test a field for membership in a set of values or
867 fields. After the field name, use the `in` operator followed by the set items
868 surrounded by braces {}. For example, to display packets with a TCP source or
869 destination port of 80, 443, or 8080, you can use `tcp.port in {80, 443, 8080}`.
870 Set elements must be separated by commas.
871 The set of values can also contain ranges: `tcp.port in {443,4430..4434}`.
877 tcp.port in {80, 443, 8080}
881 tcp.port == 80 || tcp.port == 443 || tcp.port == 8080
883 However, the display filter
885 tcp.port in {443, 4430..4434}
889 tcp.port == 443 || (tcp.port >= 4430 && tcp.port <= 4434)
891 This is because comparison operators are satisfied when _any_ field
892 matches the filter, so a packet with a source port of 56789 and
893 destination port of port 80 would also match the second filter
894 since `56789 >= 4430 && 80 \<= 4434` is true. In contrast, the
895 membership operator tests a single field against the range condition.
900 Sets are not just limited to numbers, other types can be used as well:
902 http.request.method in {"HEAD", "GET"}
903 ip.addr in {10.0.0.5 .. 10.0.0.9, 192.168.1.1..192.168.1.9}
904 frame.time_delta in {10 .. 10.5}
907 ==== Arithmetic operators
909 You can perform the arithmetic operations on numeric fields shown in <<ArithmeticOps>>
913 .Display Filter Arithmetic Operations
914 [options="header",cols="1,1,1,4"]
916 |Name |Syntax | Alternative | Description
917 |Unary minus |-A | | Negation of A
918 |Addition |A + B | | Add B to A
919 |Subtraction |A - B | | Subtract B from A
920 |Multiplication |A * B | | Multiply A times B
921 |Division |A / B | | Divide A by B
922 |Modulo |A % B | | Remainder of A divided by B
923 |Bitwise AND |A & B | A bitand B | Bitwise AND of A and B
926 An unfortunate quirk in the filter syntax is that the subtraction
927 operator must be preceded by a space character, so "A-B" must be
928 written as "A -B" or "A - B".
930 Arithmetic expressions can be grouped using curly braces.
932 For example, frames where capture length resulted in truncated TCP options:
934 frame.cap_len < { 14 + ip.hdr_len + tcp.hdr_len }
939 The display filter language has a number of functions to convert fields, see
943 .Display Filter Functions
944 [options="header",cols="1,4"]
946 |Function|Description
947 |upper |Converts a string field to uppercase.
948 |lower |Converts a string field to lowercase.
949 |len |Returns the byte length of a string or bytes field.
950 |count |Returns the number of field occurrences in a frame.
951 |string |Converts a non-string field to a string.
952 |vals |Converts a field value to its value string, if it has one.
953 |dec |Converts an unsigned integer field to a decimal string.
954 |hex |Converts an unsigned integer field to a hexadecimal string.
955 |float |Converts a field to single precision floating point.
956 |double |Converts a field to double precision floating point.
957 |max |Return the maximum value for the arguments.
958 |min |Return the minimum value for the arguments.
959 |abs |Return the absolute value for the argument.
962 The `upper` and `lower` functions can used to force case-insensitive matches:
963 `lower(http.server) contains "apache"`.
965 To find HTTP requests with long request URIs: `len(http.request.uri) > 100`.
966 Note that the `len` function yields the string length in bytes rather than
967 (multi-byte) characters.
969 Usually an IP frame has only two addresses (source and destination), but in case
970 of ICMP errors or tunneling, a single packet might contain even more addresses.
971 These packets can be found with `count(ip.addr) > 2`.
973 The `string` function converts a field value to a string, suitable for use with operators
974 like "matches" or "contains". Integer fields are converted to their decimal representation.
975 It can be used with IP/Ethernet addresses (as well as others), but not with string or
978 For example, to match odd frame numbers:
980 string(frame.number) matches "[13579]$"
983 To match IP addresses ending in 255 in a block of subnets (172.16 to 172.31):
985 string(ip.dst) matches r"^172\.(1[6-9]|2[0-9]|3[0-1])\.[0-9]{1,3}\.255"
988 The `vals` function converts an integer or boolean field value to a string
989 using the field's associated value string, if it has one.
991 The `double` function converts certain field types to doubles, including
992 floats, doubles (a no-op), integers, booleans, times (absolute times are
993 converted to seconds since the UN*X epoch), and the special IEEE 11073
994 Personal Health Devices floating point formats. The results can be used
995 with further arithmetic operations and, like other filters, placed in a
998 The functions max() and min() take any number of arguments of the same type
999 and returns the largest/smallest respectively of the set.
1002 max(tcp.srcport, tcp.dstport) <= 1024
1005 ==== Field References
1007 An expression of the form ${proto.field} is called a field reference.
1008 Its value is read from the corresponding field in the currently selected
1009 frame in the GUI. This is a powerful way to build dynamic filters, such
1010 as frames since the last five minutes to the selected frame:
1013 frame.time_relative >= ${frame.time_relative} - 300
1016 or all HTTP packets whose `+ip.dst` value equals the "A" record of
1017 the DNS response in the current frame:
1020 http && ip.dst eq ${dns.a}
1023 The notation of field references is similar to that of macros but they are
1024 syntactically distinct. Field references, like other complex filters, make
1025 excellent use cases for <<ChWorkDefineFilterMacrosSection,macros>>,
1026 <<ChWorkDefineFilterSection,saved filters>>, and
1027 <<ChCustFilterButtons,filter buttons>>
1029 [#ChWorkBuildDisplayFilterTransitional]
1031 ==== Sometimes Fields Change Names
1033 As protocols evolve they sometimes change names or are superseded by
1034 newer standards. For example, DHCP extends and has largely replaced
1035 BOOTP and TLS has replaced SSL. If a protocol dissector originally used
1036 the older names and fields for a protocol the Wireshark development team
1037 might update it to use the newer names and fields. In such cases they
1038 will add an alias from the old protocol name to the new one in order to
1039 make the transition easier.
1041 For example, the DHCP dissector was originally developed for the BOOTP
1042 protocol but as of Wireshark 3.0 all of the “bootp” display filter
1043 fields have been renamed to their “dhcp” equivalents. You can still use
1044 the old filter names for the time being, e.g., “bootp.type” is equivalent
1045 to “dhcp.type” but Wireshark will show the warning “"bootp" is deprecated”
1046 when you use it. Support for the deprecated fields may be removed in the future.
1048 ==== Some protocol names can be ambiguous
1049 In some particular cases relational expressions (equal, less than, etc.)
1050 can be ambiguous. The filter name of a protocol or protocol field can contain
1051 any letter and digit in any order, possibly separated by dots. That can be
1052 indistinguishable from a literal value (usually numerical values in hexadecimal).
1053 For example the semantic value of `fc` can be the protocol Fibre Channel or the
1054 number 0xFC in hexadecimal because the 0x prefix is optional for hexadecimal numbers.
1056 Any value that matches a registered protocol or protocol field filter name is
1057 interpreted semantically as such. If it doesn't match a protocol name the normal
1058 rules for parsing literal values apply.
1060 So in the case of 'fc' the lexical token is interpreted as "Fibre Channel" and
1061 not 0xFC. In the case of 'fd' it would be interpreted as 0xFD because it is a
1062 well-formed hexadecimal literal value (according to the rules of display filter
1063 language syntax) and there is no protocol registered with the filter name 'fd'.
1065 How ambiguous values are interpreted may change in the future. To avoid this
1066 problem and resolve the ambiguity there is additional syntax available.
1067 Values prefixed with a dot are always treated as a protocol name. The
1068 dot stands for the root of the protocol namespace and is optional). Values
1069 prefixed with a colon are always interpreted as a byte array.
1071 frame[10:] contains .fc or frame[10] == :fc
1073 If you are writing a script, or you think your expression may not be giving the
1074 expected results because of the syntactical ambiguity of some filter expression
1075 it is advisable to use the explicit syntax to indicate the correct meaning for
1078 [#ChWorkFilterAddExpressionSection]
1080 === The “Display Filter Expression” Dialog Box
1082 When you are accustomed to Wireshark’s filtering system and know what labels you
1083 wish to use in your filters it can be very quick to simply type a filter string.
1084 However, if you are new to Wireshark or are working with a slightly unfamiliar
1085 protocol it can be very confusing to try to figure out what to type. The
1086 “Display Filter Expression” dialog box helps with this.
1090 The “Display Filter Expression” dialog box is an excellent way to learn how to write
1091 Wireshark display filter strings.
1095 [#ChWorkFilterAddExpression1]
1097 .The “Display Filter Expression” dialog box
1098 image::images/ws-filter-add-expression.png[{screenshot-attrs}]
1099 // Screenshot from Wireshark 3.1.1
1101 When you first bring up the Display Filter Expression dialog box you are shown a tree
1102 of field names, organized by protocol, and a box for selecting a relation.
1105 Select a protocol field from the protocol field tree. Every protocol with
1106 filterable fields is listed at the top level. You can search for a particular
1107 protocol entry by entering the first few letters of the protocol name. By
1108 expanding a protocol name you can get a list of the field names available for
1109 filtering for that protocol.
1112 Select a relation from the list of available relation. The _is present_ is a
1113 unary relation which is true if the selected field is present in a packet. All
1114 other listed relations are binary relations which require additional data (e.g.
1115 a _Value_ to match) to complete.
1117 When you select a field from the field name list and select a binary relation
1118 (such as the equality relation ==) you will be given the opportunity to enter a
1119 value, and possibly some range information.
1122 You may enter an appropriate value in the _Value_ text box. The _Value_ will
1123 also indicate the type of value for the _Field Name_ you have selected (like
1127 Some of the protocol fields have predefined values available, much like enumerations
1128 in C. If the selected protocol field has such values defined, you can choose one
1132 Lets you search for a full or partial field name or description.
1133 Regular expressions are supported.
1134 For example, searching for “tcp.*flag” shows the TCP flags fields supported by a wide variety of dissectors, while “^tcp.flag” shows only the TCP flags fields supported by the TCP dissector.
1137 A range of integers or a group of ranges, such as `1-12` or `39-42,98-2000`.
1140 Opens this section of the User’s Guide.
1143 When you have built a satisfactory expression click btn:[OK] and a filter string
1144 will be built for you.
1147 You can leave the “Add Expression...” dialog box without any effect by
1148 clicking the btn:[Cancel] button.
1150 [#ChWorkDefineFilterSection]
1152 === Defining And Saving Filters
1154 You create pre-defined filters that appear in the capture and display filter bookmark menus (image:images/toolbar/filter-toolbar-bookmark.png[height=16,width=12]).
1155 This can save time in remembering and retyping some of the more complex filters you use.
1157 To create or edit capture filters, select menu:Manage Capture Filters[] from the capture filter bookmark menu or menu:Capture[Capture Filters...] from the main menu.
1158 Display filters can be created or edited by selecting menu:Manage Display Filters[] from the display filter bookmark menu or menu:Analyze[Display Filters...] from the main menu.
1159 Wireshark will open the corresponding dialog as shown in <<FiltersDialog>>.
1160 The two dialogs look and work similar to one another.
1161 Both are described here, and the differences are noted as needed.
1165 .The “Capture Filters” and “Display Filters” dialog boxes
1166 image::images/ws-filters.png[{screenshot-attrs}]
1169 Adds a new filter to the list.
1170 You can edit the filter name or expression by double-clicking on it.
1172 The filter name is used in this dialog to identify the filter for your convenience and is not used elsewhere.
1173 You can create multiple filters with the same name, but this is not very useful.
1175 When typing in a filter string, the background color will change depending on the validity of the filter similar to the main capture and display filter toolbars.
1178 Delete the selected filter.
1179 This will be greyed out if no filter is selected.
1181 // XXX Asciidoctor doesn't seem to allow images in DL terms, otherwise we could use
1182 // list-copy.template.png here.
1184 Copy the selected filter.
1185 This will be greyed out if no filter is selected.
1188 Saves the filter settings and closes the dialog.
1191 Closes the dialog without saving any changes.
1193 [#ChWorkDefineFilterMacrosSection]
1195 === Defining And Saving Filter Macros
1197 Display Filter Macros are a mechanism to create shortcuts for complex filters.
1198 You can define a filter macro with Wireshark and label it for later use.
1199 This can save time in remembering and retyping some of the more complex filters
1202 To define and save your own filter macros, follow the steps below:
1204 . In the main menu select menu:Analyze[Display Filter Macros...]. Wireshark will open a corresponding dialog <<FilterMacrosDialog>>.
1206 [#FilterMacrosDialog]
1208 .Display Filter Macros window
1209 image::images/ws-filter-macros.png[{screenshot-attrs}]
1211 . To add a new filter macro, click the btn:[{plus}] button in the bottom-left corner. A new row will appear in the Display Filter Macros table above.
1213 . Enter the name of your macro in the `Macro Name` column. Enter your filter macro in the `Macro Expression` column.
1215 . To save your modifications, click the btn:[OK] button in the bottom-right corner of the <<FilterMacrosDialog>>.
1217 ==== Display Filter Macros syntax
1219 Display filter macros are invoked with the macro name and a number of
1220 input arguments. There are several supported syntaxes.
1222 The `Macro Name` must consist of ASCII alphanumerics or the '_' character.
1223 (Note that the presence of a '.' character would indicate a
1224 <<_field_references,field reference>>.)
1226 The `Macro Expression` is replacement text for the macro name. It substitutes
1227 $1, $2, $3, ... with the input arguments.
1229 For example, defining a display filter macro named _$$tcp_conv$$_ whose text is
1232 (ip.src == $1 and ip.dst == $2 and tcp.srcport == $3 and tcp.dstport == $4)
1233 or (ip.src == $2 and ip.dst == $1 and tcp.srcport == $4 and tcp.dstport == $3)
1236 would allow to use a display filter like
1239 $tcp_conv(10.1.1.2,10.1.1.3,1200,1400)
1245 ${tcp_conv:10.1.1.2;10.1.1.3;1200;1400}
1251 ${tcp_conv;10.1.1.2;10.1.1.3;1200;1400}
1254 instead of typing the whole filter. Both notations are equivalent. Once defined, a macro can
1255 be used in <<ChWorkDefineFilterSection,saved display (but not
1256 capture) filters>> and <<ChCustFilterButtons,filter buttons>>.
1258 [#ChWorkFindPacketSection]
1262 You can easily find packets once you have captured some packets or have
1263 read in a previously saved capture file. Simply select menu:Edit[Find
1264 Packet...] in the main menu. Wireshark will open a toolbar between the
1265 main toolbar and the packet list shown in <<ChWorkFindPacketToolbar>>.
1267 ==== The “Find Packet” Toolbar
1269 [#ChWorkFindPacketToolbar]
1271 .The “Find Packet” toolbar
1272 image::images/ws-find-packet.png[{screenshot-attrs}]
1274 You can search using the following criteria:
1277 Enter a display filter string into the text entry field and click the btn:[Find] button.
1279 For example, to find the three-way handshake for a connection from host 192.168.0.1, use the following filter string:
1282 ip.src==192.168.0.1 and tcp.flags.syn==1
1285 The value to be found will be syntax checked while you type it in. If
1286 the syntax check of your value succeeds, the background of the entry
1287 field will turn green, if it fails, it will turn red. For more details
1288 see <<ChWorkDisplayFilterSection>>
1291 Search for a specific byte sequence in the packet data.
1293 For example, use “ef:bb:bf” to find the next packet that contains the
1294 link:{wikipedia-main-url}Byte_order_mark[UTF-8 byte order mark].
1297 Find a string in the packet data, with various options.
1299 Regular Expression::
1300 Search the packet data using link:{pcre2pattern-url}[Perl-compatible
1301 regular expressions]. PCRE patterns are beyond the scope of this
1302 document, but typing “pcre test” into your favorite search engine
1303 should return a number of sites that will help you test and explore
1306 [#ChWorkGoToPacketSection]
1308 === Go To A Specific Packet
1310 You can easily jump to specific packets with one of the menu items in
1313 ==== The “Go Back” Command
1315 Go back in the packet history, works much like the page history in most
1318 ==== The “Go Forward” Command
1320 Go forward in the packet history, works much like the page history in
1323 ==== The “Go to Packet” Toolbar
1325 [#ChWorkGoToPacketToolbar]
1327 .The “Go To Packet” toolbar
1328 image::images/ws-goto-packet.png[{screenshot-attrs}]
1330 This toolbar can be opened by selecting menu:Go[Go to packet...] from
1331 the main menu. It appears between the main toolbar and the packet list,
1332 similar to the <<ChWorkFindPacketToolbar,”Find Packet” toolbar>>.
1334 When you enter a packet number and press btn:[Go to packet]
1335 Wireshark will jump to that packet.
1337 ==== The “Go to Corresponding Packet” Command
1339 If a protocol field is selected which points to another packet in the capture
1340 file, this command will jump to that packet.
1342 As these protocol fields now work like links (just as in your Web browser), it’s
1343 easier to simply double-click on the field to jump to the corresponding field.
1345 ==== The “Go to First Packet” Command
1347 This command will jump to the first packet displayed.
1349 ==== The “Go to Last Packet” Command
1351 This command will jump to the last packet displayed.
1353 [#ChWorkMarkPacketSection]
1357 You can mark packets in the “Packet List” pane. A marked packet will be shown
1358 with black background, regardless of the coloring rules set. Marking a packet
1359 can be useful to find it later while analyzing in a large capture file.
1361 Marked packet information is not stored in the capture file or anywhere
1362 else. It will be lost when the capture file is closed.
1364 You can use packet marking to control the output of packets when saving,
1365 exporting, or printing. To do so, an option in the packet range is available,
1366 see <<ChIOPacketRangeSection>>.
1368 There are several ways to mark and unmark packets. From the menu:Edit[] menu
1369 you can select from the following:
1371 * menu:Mark/Unmark Selected[] toggles the marked state of the current selection.
1372 This option is also available in the packet list context menu.
1374 * menu:Mark All Displayed[] set the mark state of all displayed packets.
1376 * menu:Unmark All Displayed[] reset the mark state of all packets.
1378 You can also mark and unmark a packet by clicking on it in the packet list
1379 with the middle mouse button.
1381 [#ChWorkIgnorePacketSection]
1383 === Ignoring Packets
1385 You can ignore packets in the “Packet List” pane. Wireshark will then
1386 pretend that they not exist in the capture file. An ignored packet will
1387 be shown with white background and grey foreground, regardless of the
1390 Ignored packet information is not stored in the capture file or anywhere
1391 else. It will be lost when the capture file is closed.
1393 There are several ways to ignore and unignore packets. From the
1394 menu:Edit[] menu you can select from the following:
1396 * menu:Ignore/Unignore Selected[] toggles the ignored state of the current selection.
1397 This option is also available in the packet list context menu.
1399 * menu:Ignore All Displayed[] set the ignored state of all displayed packets.
1401 * menu:Unignore All Displayed[] reset the ignored state of all packets.
1403 [#ChWorkTimeFormatsSection]
1405 === Time Display Formats And Time References
1407 While packets are captured, each packet is timestamped. These timestamps will be
1408 saved to the capture file, so they will be available for later analysis.
1410 A detailed description of timestamps, timezones and alike can be found at:
1411 <<ChAdvTimestamps>>.
1413 The timestamp presentation format and the precision in the packet list can be
1414 chosen using the View menu, see <<ChUseWiresharkViewMenu>>.
1416 The available presentation formats are:
1418 * menu:Date and Time of Day: 1970-01-01 01:02:03.123456[] The absolute date and time
1419 of the day when the packet was captured.
1421 * menu:Time of Day: 01:02:03.123456[] The absolute time of the day when the packet
1424 * menu:Seconds Since First Captured Packet: 123.123456[] The time relative to the
1425 start of the capture file or the first “Time Reference” before this packet
1426 (see <<ChWorkTimeReferencePacketSection>>).
1428 * menu:Seconds Since Previous Captured Packet: 1.123456[] The time relative to the
1429 previous captured packet.
1431 * menu:Seconds Since Previous Displayed Packet: 1.123456[] The time relative to the
1432 previous displayed packet.
1434 * menu:Seconds Since Epoch (1970-01-01): 1234567890.123456[] The time relative to
1435 epoch (midnight UTC of January 1, 1970).
1437 The available precisions (aka. the number of displayed decimal places) are:
1439 * menu:Automatic (from capture file)[] The timestamp precision of the loaded capture file format will be
1442 * menu:Seconds[], menu:Tenths of a second[], menu:Hundredths of a second[],
1443 menu:Milliseconds[], menu:Microseconds[] or menu:Nanoseconds[] The
1444 timestamp precision will be forced to the given setting. If the
1445 actually available precision is smaller, zeros will be appended. If
1446 the precision is larger, the remaining decimal places will be cut off.
1448 Precision example: If you have a timestamp and it’s displayed using, “Seconds
1449 Since Previous Packet” the value might be 1.123456. This will be displayed
1450 using the “Automatic” setting for libpcap files (which is microseconds). If
1451 you use Seconds it would show simply 1 and if you use Nanoseconds it shows
1454 [#ChWorkTimeReferencePacketSection]
1456 ==== Packet Time Referencing
1458 The user can set time references to packets. A time reference is the starting
1459 point for all subsequent packet time calculations. It will be useful, if you
1460 want to see the time values relative to a special packet, e.g., the start of a
1461 new request. It’s possible to set multiple time references in the capture file.
1463 The time references will not be saved permanently and will be lost when you
1464 close the capture file.
1466 Time referencing supercedes the value for the time relative to first
1467 capture packet. It affects the default Time column if the time display
1468 format is set to “Seconds Since First Captured Packet”, or a “Relative Time”
1469 column if one has been added. It also affects the `frame.time_relative` field.
1471 To work with time references, choose one of the menu:Time Reference[] items in
1472 the menu:[Edit] menu or from the pop-up menu of the “Packet List” pane. See
1473 <<ChUseEditMenuSection>>.
1475 * menu:Set Time Reference (toggle)[] Toggles the time reference state of the
1476 currently selected packet to on or off.
1478 * menu:Find Next[] Find the next time referenced packet in the “Packet List” pane.
1480 * menu:Find Previous[] Find the previous time referenced packet in the “Packet
1483 [#ChWorkTimeReference]
1485 .Wireshark showing a time referenced packet
1486 image::images/ws-time-reference.png[{screenshot-attrs}]
1488 A time referenced packet will be marked with the string $$*REF*$$ in the Time
1489 column (see packet number 10). All subsequent packets will show the time since
1490 the last time reference. If there is a column displayed for “Cumulative Bytes”
1491 its counter will also reset at every time reference packet.
1492 # Somewhat odd that cumulative bytes also resets.
1494 Time referenced packets will always be displayed in the packet list pane.
1495 Display filters will not affect or hide these packets.
1497 [#ChWorkShiftTimePacketSection]
1499 === Time Shifting Packets
1501 Sometimes you will want to adjust the timestamps in a capture file.
1502 This may be because a machine performing the capture had an inaccurate
1503 clock, or because the capture was originally saved with timestamps in
1504 <<ChAdvTabTimezones,local time>> (perhaps even to a capture file format
1505 that only writes times in local time, or only writes the time of day
1506 but not the date). One common use is to synchronize timestamps between
1507 captures made on different machines with relative clock skew or clock
1508 drift before <<ChIOMergeSection,merging>> them. Selecting
1509 menu:Edit[Time Shift...] from the main menu opens the "Time Shift" dialog.
1511 .The “Time Shift” dialog
1512 image::images/ws-time-shift.png[{medium-screenshot-attrs}]
1514 Shift all packets by...::
1516 Apply a fixed offset, entered as a relative time in hours, minutes,
1517 and seconds, to the timestamps for all packets. This is useful for
1518 correcting small known errors or timezones.
1520 Set the time for packet...::
1522 Apply offsets based on one or, if the box is checked, two given packets
1523 to the timestamps for all packets. Enter the packet number and absolute
1524 date and time for the packet(s). When one packet is used, a fixed offset
1525 is applied that can be used to correct for clock skew. When two packets
1526 are used, the correction for all other packets is computed linearly,
1527 which can be used to correct for clock drift. This is useful when the
1528 precise date and time for particular packets are known, e.g. packets
1529 containing the NTP or PTP protocols.
1533 This removes all unsaved time shifts from packets.
1536 .Time shifts are applied to all packets
1538 Time shifts are applied to all packets in the capture, including
1539 ignored packets and packets that are not displayed due to the current
1541 Wireshark does not have a method to adjust the timestamps of individual
1542 or selected packets.
1545 The offset currently applied to time shifted packets is in the
1546 `frame.offset_shift` field, which can be viewed in the packet details.
1548 .A Time Shifted Packet
1549 image::images/ws-time-shift-details.png[{medium-screenshot-attrs}]
1551 After time shifts are applied, the file will have unsaved changes,
1552 which are indicated with an {asterisk} beside its name in the title bar.
1553 Beginning with Wireshark 4.2.0, <<ChIOSaveSection,saving>> the file
1554 will write the corrected timestamps to the capture file.
1555 If you attempt to close the capture file without saving it, a dialog
1556 will prompt you to save in order to prevent losing your changes
1557 (unless that warning has been disabled in the <<ChCustGUIPrefPage,preferences>>.)
1559 // End of WSUG Chapter Work