1RAWSHARK(1)                                                        RAWSHARK(1)
2
3
4

NAME

6       rawshark - Dump and analyze raw pcap data
7

SYNOPSIS

9       rawshark [ -d <encap:linktype>|<proto:protoname> ]
10       [ -F <field to display> ] [ -h ] [ -l ] [ -m <bytes> ] [ -n ]
11       [ -N <name resolving flags> ] [ -o <preference setting> ] ... [ -p ]
12       [ -r <pipe>|- ] [ -R <read (display) filter> ] [ -s ]
13       [ -S <field format> ] [ -t a|ad|adoy|d|dd|e|r|u|ud|udoy ] [ -v ]
14

DESCRIPTION

16       Rawshark reads a stream of packets from a file or pipe, and prints a
17       line describing its output, followed by a set of matching fields for
18       each packet on stdout.
19

INPUT

21       Unlike TShark, Rawshark makes no assumptions about encapsulation or
22       input. The -d and -r flags must be specified in order for it to run.
23       One or more -F flags should be specified in order for the output to be
24       useful. The other flags listed above follow the same conventions as
25       Wireshark and TShark.
26
27       Rawshark expects input records with the following format by default.
28       This matches the format of the packet header and packet data in a
29       pcap-formatted file on disk.
30
31           struct rawshark_rec_s {
32               uint32_t ts_sec;      /* Time stamp (seconds) */
33               uint32_t ts_usec;     /* Time stamp (microseconds) */
34               uint32_t caplen;      /* Length of the packet buffer */
35               uint32_t len;         /* "On the wire" length of the packet */
36               uint8_t data[caplen]; /* Packet data */
37           };
38
39       If -p is supplied rawshark expects the following format. This matches
40       the struct pcap_pkthdr structure and packet data used in libpcap,
41       Npcap, or WinPcap. This structure’s format is platform-dependent; the
42       size of the tv_sec field in the struct timeval structure could be 32
43       bits or 64 bits. For rawshark to work, the layout of the structure in
44       the input must match the layout of the structure in rawshark. Note that
45       this format will probably be the same as the previous format if
46       rawshark is a 32-bit program, but will not necessarily be the same if
47       rawshark is a 64-bit program.
48
49           struct rawshark_rec_s {
50               struct timeval ts;    /* Time stamp */
51               uint32_t caplen;      /* Length of the packet buffer */
52               uint32_t len;         /* "On the wire" length of the packet */
53               uint8_t data[caplen]; /* Packet data */
54           };
55
56       In either case, the endianness (byte ordering) of each integer must
57       match the system on which rawshark is running.
58

OUTPUT

60       If one or more fields are specified via the -F flag, Rawshark prints
61       the number, field type, and display format for each field on the first
62       line as "packet number" 0. For each record, the packet number, matching
63       fields, and a "1" or "0" are printed to indicate if the field matched
64       any supplied display filter. A "-" is used to signal the end of a field
65       description and at the end of each packet line. For example, the flags
66       -F ip.src -F dns.qry.type might generate the following output:
67
68           0 FT_IPv4 BASE_NONE - 1 FT_UINT16 BASE_HEX -
69           1 1="1" 0="192.168.77.10" 1 -
70           2 1="1" 0="192.168.77.250" 1 -
71           3 0="192.168.77.10" 1 -
72           4 0="74.125.19.104" 1 -
73
74       Note that packets 1 and 2 are DNS queries, and 3 and 4 are not. Adding
75       -R "not dns" still prints each line, but there’s an indication that
76       packets 1 and 2 didn’t pass the filter:
77
78           0 FT_IPv4 BASE_NONE - 1 FT_UINT16 BASE_HEX -
79           1 1="1" 0="192.168.77.10" 0 -
80           2 1="1" 0="192.168.77.250" 0 -
81           3 0="192.168.77.10" 1 -
82           4 0="74.125.19.104" 1 -
83
84       Also note that the output may be in any order, and that multiple
85       matching fields might be displayed.
86

OPTIONS

88       -d  <encapsulation>
89
90           Specify how the packet data should be dissected. The encapsulation
91           is of the form type:value, where type is one of:
92
93           encap:name Packet data should be dissected using the
94           libpcap/Npcap/WinPcap data link type (DLT) name, e.g. encap:EN10MB
95           for Ethernet. Names are converted using
96           pcap_datalink_name_to_val(). A complete list of DLTs can be found
97           at https://www.tcpdump.org/linktypes.html.
98
99           encap:number Packet data should be dissected using the
100           libpcap/Npcap/WinPcap LINKTYPE_ number, e.g. encap:105 for raw IEEE
101           802.11 or encap:101 for raw IP.
102
103           proto:protocol Packet data should be passed to the specified
104           Wireshark protocol dissector, e.g. proto:http for HTTP data.
105
106       -F  <field to display>
107
108           Add the matching field to the output. Fields are any valid display
109           filter field. More than one -F flag may be specified, and each
110           field can match multiple times in a given packet. A single field
111           may be specified per -F flag. If you want to apply a display
112           filter, use the -R flag.
113
114       -h
115
116           Print the version and options and exits.
117
118       -l
119
120           Flush the standard output after the information for each packet is
121           printed. (This is not, strictly speaking, line-buffered if -V was
122           specified; however, it is the same as line-buffered if -V wasn’t
123           specified, as only one line is printed for each packet, and, as -l
124           is normally used when piping a live capture to a program or script,
125           so that output for a packet shows up as soon as the packet is seen
126           and dissected, it should work just as well as true line-buffering.
127           We do this as a workaround for a deficiency in the Microsoft Visual
128           C++ C library.)
129
130           This may be useful when piping the output of TShark to another
131           program, as it means that the program to which the output is piped
132           will see the dissected data for a packet as soon as TShark sees the
133           packet and generates that output, rather than seeing it only when
134           the standard output buffer containing that data fills up.
135
136       -m  <memory limit bytes>
137
138           Limit rawshark’s memory usage to the specified number of bytes.
139           POSIX (non-Windows) only.
140
141       -n
142
143           Disable network object name resolution (such as hostname, TCP and
144           UDP port names), the -N flag might override this one.
145
146       -N  <name resolving flags>
147
148           Turn on name resolving only for particular types of addresses and
149           port numbers, with name resolving for other types of addresses and
150           port numbers turned off. This flag overrides -n if both -N and -n
151           are present. If both -N and -n flags are not present, all name
152           resolutions are turned on.
153
154           The argument is a string that may contain the letters:
155
156           m to enable MAC address resolution
157
158           n to enable network address resolution
159
160           N to enable using external resolvers (e.g., DNS) for network
161           address resolution
162
163           t to enable transport-layer port number resolution
164
165           d to enable resolution from captured DNS packets
166
167           v to enable VLAN IDs to names resolution
168
169       -o  <preference>:<value>
170
171           Set a preference value, overriding the default value and any value
172           read from a preference file. The argument to the option is a string
173           of the form prefname:value, where prefname is the name of the
174           preference (which is the same name that would appear in the
175           preference file), and value is the value to which it should be set.
176
177       -p
178
179           Assume that packet data is preceded by a pcap_pkthdr struct as
180           defined in pcap.h. On some systems the size of the timestamp data
181           will be different from the data written to disk. On other systems
182           they are identical and this flag has no effect.
183
184       -r  <pipe>|-
185
186           Read packet data from input source. It can be either the name of a
187           FIFO (named pipe) or ``-'' to read data from the standard input,
188           and must have the record format specified above.
189
190           If you are sending data to rawshark from a parent process on
191           Windows you should not close rawshark’s standard input handle
192           prematurely, otherwise the C runtime might trigger an exception.
193
194       -R  <read (display) filter>
195
196           Cause the specified filter (which uses the syntax of read/display
197           filters, rather than that of capture filters) to be applied before
198           printing the output.
199
200       -s
201
202           Allows standard pcap files to be used as input, by skipping over
203           the 24 byte pcap file header.
204
205       -S
206
207           Use the specified format string to print each field. The following
208           formats are supported:
209
210           %D Field name or description, e.g. "Type" for dns.qry.type
211
212           %N Base 10 numeric value of the field.
213
214           %S String value of the field.
215
216           For something similar to Wireshark’s standard display ("Type: A
217           (1)") you could use %D: %S (%N).
218
219       -t  a|ad|adoy|d|dd|e|r|u|ud|udoy
220
221           Set the format of the packet timestamp printed in summary lines.
222           The format can be one of:
223
224           a absolute: The absolute time, as local time in your time zone, is
225           the actual time the packet was captured, with no date displayed
226
227           ad absolute with date: The absolute date, displayed as YYYY-MM-DD,
228           and time, as local time in your time zone, is the actual time and
229           date the packet was captured
230
231           adoy absolute with date using day of year: The absolute date,
232           displayed as YYYY/DOY, and time, as local time in your time zone,
233           is the actual time and date the packet was captured
234
235           d delta: The delta time is the time since the previous packet was
236           captured
237
238           dd delta_displayed: The delta_displayed time is the time since the
239           previous displayed packet was captured
240
241           e epoch: The time in seconds since epoch (Jan 1, 1970 00:00:00)
242
243           r relative: The relative time is the time elapsed between the first
244           packet and the current packet
245
246           u UTC: The absolute time, as UTC, is the actual time the packet was
247           captured, with no date displayed
248
249           ud UTC with date: The absolute date, displayed as YYYY-MM-DD, and
250           time, as UTC, is the actual time and date the packet was captured
251
252           udoy UTC with date using day of year: The absolute date, displayed
253           as YYYY/DOY, and time, as UTC, is the actual time and date the
254           packet was captured
255
256           The default format is relative.
257
258       -v
259
260           Print the version and exit.
261

READ FILTER SYNTAX

263       For a complete table of protocol and protocol fields that are
264       filterable in TShark see the wireshark-filter(4) manual page.
265

FILES

267       These files contains various Wireshark configuration values.
268
269       Preferences
270
271           The preferences files contain global (system-wide) and personal
272           preference settings. If the system-wide preference file exists, it
273           is read first, overriding the default settings. If the personal
274           preferences file exists, it is read next, overriding any previous
275           values. Note: If the command line option -o is used (possibly more
276           than once), it will in turn override values from the preferences
277           files.
278
279           The preferences settings are in the form prefname:value, one per
280           line, where prefname is the name of the preference and value is the
281           value to which it should be set; white space is allowed between :
282           and value. A preference setting can be continued on subsequent
283           lines by indenting the continuation lines with white space. A #
284           character starts a comment that runs to the end of the line:
285
286               # Capture in promiscuous mode?
287               # TRUE or FALSE (case-insensitive).
288               capture.prom_mode: TRUE
289
290           The global preferences file is looked for in the wireshark
291           directory under the share subdirectory of the main installation
292           directory (for example, /usr/local/share/wireshark/preferences) on
293           UNIX-compatible systems, and in the main installation directory
294           (for example, C:\Program Files\Wireshark\preferences) on Windows
295           systems.
296
297           The personal preferences file is looked for in
298           $XDG_CONFIG_HOME/wireshark/preferences (or, if
299           $XDG_CONFIG_HOME/wireshark does not exist while $HOME/.wireshark is
300           present, $HOME/.wireshark/preferences) on UNIX-compatible systems
301           and %APPDATA%\Wireshark\preferences (or, if %APPDATA% isn’t
302           defined, %USERPROFILE%\Application Data\Wireshark\preferences) on
303           Windows systems.
304
305       Disabled (Enabled) Protocols
306
307           The disabled_protos files contain system-wide and personal lists of
308           protocols that have been disabled, so that their dissectors are
309           never called. The files contain protocol names, one per line, where
310           the protocol name is the same name that would be used in a display
311           filter for the protocol:
312
313               http
314               tcp     # a comment
315
316           The global disabled_protos file uses the same directory as the
317           global preferences file.
318
319           The personal disabled_protos file uses the same directory as the
320           personal preferences file.
321
322       Name Resolution (hosts)
323
324           If the personal hosts file exists, it is used to resolve IPv4 and
325           IPv6 addresses before any other attempts are made to resolve them.
326           The file has the standard hosts file syntax; each line contains one
327           IP address and name, separated by whitespace. The same directory as
328           for the personal preferences file is used.
329
330           Capture filter name resolution is handled by libpcap on
331           UNIX-compatible systems and Npcap or WinPcap on Windows. As such
332           the Wireshark personal hosts file will not be consulted for capture
333           filter name resolution.
334
335       Name Resolution (subnets)
336
337           If an IPv4 address cannot be translated via name resolution (no
338           exact match is found) then a partial match is attempted via the
339           subnets file.
340
341           Each line of this file consists of an IPv4 address, a subnet mask
342           length separated only by a / and a name separated by whitespace.
343           While the address must be a full IPv4 address, any values beyond
344           the mask length are subsequently ignored.
345
346           An example is:
347
348           # Comments must be prepended by the # sign! 192.168.0.0/24
349           ws_test_network
350
351           A partially matched name will be printed as
352           "subnet-name.remaining-address". For example, "192.168.0.1" under
353           the subnet above would be printed as "ws_test_network.1"; if the
354           mask length above had been 16 rather than 24, the printed address
355           would be ``ws_test_network.0.1".
356
357       Name Resolution (ethers)
358
359           The ethers files are consulted to correlate 6-byte hardware
360           addresses to names. First the personal ethers file is tried and if
361           an address is not found there the global ethers file is tried next.
362
363           Each line contains one hardware address and name, separated by
364           whitespace. The digits of the hardware address are separated by
365           colons (:), dashes (-) or periods (.). The same separator character
366           must be used consistently in an address. The following three lines
367           are valid lines of an ethers file:
368
369               ff:ff:ff:ff:ff:ff          Broadcast
370               c0-00-ff-ff-ff-ff          TR_broadcast
371               00.00.00.00.00.00          Zero_broadcast
372
373           The global ethers file is looked for in the /etc directory on
374           UNIX-compatible systems, and in the main installation directory
375           (for example, C:\Program Files\Wireshark) on Windows systems.
376
377           The personal ethers file is looked for in the same directory as the
378           personal preferences file.
379
380           Capture filter name resolution is handled by libpcap on
381           UNIX-compatible systems and Npcap or WinPcap on Windows. As such
382           the Wireshark personal ethers file will not be consulted for
383           capture filter name resolution.
384
385       Name Resolution (manuf)
386
387           The manuf file is used to match the 3-byte vendor portion of a
388           6-byte hardware address with the manufacturer’s name; it can also
389           contain well-known MAC addresses and address ranges specified with
390           a netmask. The format of the file is the same as the ethers files,
391           except that entries of the form:
392
393               00:00:0C      Cisco
394
395           can be provided, with the 3-byte OUI and the name for a vendor, and
396           entries such as:
397
398               00-00-0C-07-AC/40     All-HSRP-routers
399
400           can be specified, with a MAC address and a mask indicating how many
401           bits of the address must match. The above entry, for example, has
402           40 significant bits, or 5 bytes, and would match addresses from
403           00-00-0C-07-AC-00 through 00-00-0C-07-AC-FF. The mask need not be a
404           multiple of 8.
405
406           The manuf file is looked for in the same directory as the global
407           preferences file.
408
409       Name Resolution (services)
410
411           The services file is used to translate port numbers into names.
412
413           The file has the standard services file syntax; each line contains
414           one (service) name and one transport identifier separated by white
415           space. The transport identifier includes one port number and one
416           transport protocol name (typically tcp, udp, or sctp) separated by
417           a /.
418
419           An example is:
420
421               mydns       5045/udp     # My own Domain Name Server
422               mydns       5045/tcp     # My own Domain Name Server
423
424       Name Resolution (ipxnets)
425
426           The ipxnets files are used to correlate 4-byte IPX network numbers
427           to names. First the global ipxnets file is tried and if that
428           address is not found there the personal one is tried next.
429
430           The format is the same as the ethers file, except that each address
431           is four bytes instead of six. Additionally, the address can be
432           represented as a single hexadecimal number, as is more common in
433           the IPX world, rather than four hex octets. For example, these four
434           lines are valid lines of an ipxnets file:
435
436               C0.A8.2C.00              HR
437               c0-a8-1c-00              CEO
438               00:00:BE:EF              IT_Server1
439               110f                     FileServer3
440
441           The global ipxnets file is looked for in the /etc directory on
442           UNIX-compatible systems, and in the main installation directory
443           (for example, C:\Program Files\Wireshark) on Windows systems.
444
445           The personal ipxnets file is looked for in the same directory as
446           the personal preferences file.
447

ENVIRONMENT VARIABLES

449       WIRESHARK_CONFIG_DIR
450
451           This environment variable overrides the location of personal
452           configuration files. It defaults to $XDG_CONFIG_HOME/wireshark (or
453           $HOME/.wireshark if the former is missing while the latter exists).
454           On Windows, %APPDATA%\Wireshark is used instead. Available since
455           Wireshark 3.0.
456
457       WIRESHARK_DEBUG_WMEM_OVERRIDE
458
459           Setting this environment variable forces the wmem framework to use
460           the specified allocator backend for all allocations, regardless of
461           which backend is normally specified by the code. This is mainly
462           useful to developers when testing or debugging. See README.wmem in
463           the source distribution for details.
464
465       WIRESHARK_RUN_FROM_BUILD_DIRECTORY
466
467           This environment variable causes the plugins and other data files
468           to be loaded from the build directory (where the program was
469           compiled) rather than from the standard locations. It has no effect
470           when the program in question is running with root (or setuid)
471           permissions on *NIX.
472
473       WIRESHARK_DATA_DIR
474
475           This environment variable causes the various data files to be
476           loaded from a directory other than the standard locations. It has
477           no effect when the program in question is running with root (or
478           setuid) permissions on *NIX.
479
480       ERF_RECORDS_TO_CHECK
481
482           This environment variable controls the number of ERF records
483           checked when deciding if a file really is in the ERF format.
484           Setting this environment variable a number higher than the default
485           (20) would make false positives less likely.
486
487       IPFIX_RECORDS_TO_CHECK
488
489           This environment variable controls the number of IPFIX records
490           checked when deciding if a file really is in the IPFIX format.
491           Setting this environment variable a number higher than the default
492           (20) would make false positives less likely.
493
494       WIRESHARK_ABORT_ON_DISSECTOR_BUG
495
496           If this environment variable is set, Rawshark will call abort(3)
497           when a dissector bug is encountered. abort(3) will cause the
498           program to exit abnormally; if you are running Rawshark in a
499           debugger, it should halt in the debugger and allow inspection of
500           the process, and, if you are not running it in a debugger, it will,
501           on some OSes, assuming your environment is configured correctly,
502           generate a core dump file. This can be useful to developers
503           attempting to troubleshoot a problem with a protocol dissector.
504
505       WIRESHARK_ABORT_ON_TOO_MANY_ITEMS
506
507           If this environment variable is set, Rawshark will call abort(3) if
508           a dissector tries to add too many items to a tree (generally this
509           is an indication of the dissector not breaking out of a loop soon
510           enough). abort(3) will cause the program to exit abnormally; if you
511           are running Rawshark in a debugger, it should halt in the debugger
512           and allow inspection of the process, and, if you are not running it
513           in a debugger, it will, on some OSes, assuming your environment is
514           configured correctly, generate a core dump file. This can be useful
515           to developers attempting to troubleshoot a problem with a protocol
516           dissector.
517

SEE ALSO

519       wireshark-filter(4), wireshark(1), tshark(1), editcap(1), pcap(3),
520       dumpcap(1), text2pcap(1), pcap-filter(7) or tcpdump(8)
521

NOTES

523       This is the manual page for Rawshark 3.6.2. Rawshark is part of the
524       Wireshark distribution. The latest version of Wireshark can be found at
525       https://www.wireshark.org.
526
527       HTML versions of the Wireshark project man pages are available at
528       https://www.wireshark.org/docs/man-pages.
529

AUTHORS

531       Rawshark uses the same packet dissection code that Wireshark does, as
532       well as using many other modules from Wireshark; see the list of
533       authors in the Wireshark man page for a list of authors of that code.
534
535
536
537                                  2022-02-16                       RAWSHARK(1)
Impressum