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

DIAGNOSTIC OPTIONS

263       --log-level <level>
264           Set the active log level. Supported levels in lowest to highest
265           order are "noisy", "debug", "info", "message", "warning",
266           "critical", and "error". Messages at each level and higher will be
267           printed, for example "warning" prints "warning", "critical", and
268           "error" messages and "noisy" prints all messages. Levels are case
269           insensitive.
270
271       --log-fatal <level>
272           Abort the program if any messages are logged at the specified level
273           or higher. For example, "warning" aborts on any "warning",
274           "critical", or "error" messages.
275
276       --log-domains <list>
277           Only print messages for the specified log domains, e.g.
278           "GUI,Epan,sshdump". List of domains must be comma-separated.
279
280       --log-debug <list>
281           Force the specified domains to log at the "debug" level. List of
282           domains must be comma-separated.
283
284       --log-noisy <list>
285           Force the specified domains to log at the "noisy" level. List of
286           domains must be comma-separated.
287
288       --log-file <path>
289           Write log messages and stderr output to the specified file.
290

READ FILTER SYNTAX

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

FILES

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

ENVIRONMENT VARIABLES

478       WIRESHARK_CONFIG_DIR
479
480           This environment variable overrides the location of personal
481           configuration files. It defaults to $XDG_CONFIG_HOME/wireshark (or
482           $HOME/.wireshark if the former is missing while the latter exists).
483           On Windows, %APPDATA%\Wireshark is used instead. Available since
484           Wireshark 3.0.
485
486       WIRESHARK_DEBUG_WMEM_OVERRIDE
487
488           Setting this environment variable forces the wmem framework to use
489           the specified allocator backend for all allocations, regardless of
490           which backend is normally specified by the code. This is mainly
491           useful to developers when testing or debugging. See README.wmem in
492           the source distribution for details.
493
494       WIRESHARK_RUN_FROM_BUILD_DIRECTORY
495
496           This environment variable causes the plugins and other data files
497           to be loaded from the build directory (where the program was
498           compiled) rather than from the standard locations. It has no effect
499           when the program in question is running with root (or setuid)
500           permissions on *NIX.
501
502       WIRESHARK_DATA_DIR
503
504           This environment variable causes the various data files to be
505           loaded from a directory other than the standard locations. It has
506           no effect when the program in question is running with root (or
507           setuid) permissions on *NIX.
508
509       ERF_RECORDS_TO_CHECK
510
511           This environment variable controls the number of ERF records
512           checked when deciding if a file really is in the ERF format.
513           Setting this environment variable a number higher than the default
514           (20) would make false positives less likely.
515
516       IPFIX_RECORDS_TO_CHECK
517
518           This environment variable controls the number of IPFIX records
519           checked when deciding if a file really is in the IPFIX format.
520           Setting this environment variable a number higher than the default
521           (20) would make false positives less likely.
522
523       WIRESHARK_ABORT_ON_DISSECTOR_BUG
524
525           If this environment variable is set, Rawshark will call abort(3)
526           when a dissector bug is encountered. abort(3) will cause the
527           program to exit abnormally; if you are running Rawshark in a
528           debugger, it should halt in the debugger and allow inspection of
529           the process, and, if you are not running it in a debugger, it will,
530           on some OSes, assuming your environment is configured correctly,
531           generate a core dump file. This can be useful to developers
532           attempting to troubleshoot a problem with a protocol dissector.
533
534       WIRESHARK_ABORT_ON_TOO_MANY_ITEMS
535
536           If this environment variable is set, Rawshark will call abort(3) if
537           a dissector tries to add too many items to a tree (generally this
538           is an indication of the dissector not breaking out of a loop soon
539           enough). abort(3) will cause the program to exit abnormally; if you
540           are running Rawshark in a debugger, it should halt in the debugger
541           and allow inspection of the process, and, if you are not running it
542           in a debugger, it will, on some OSes, assuming your environment is
543           configured correctly, generate a core dump file. This can be useful
544           to developers attempting to troubleshoot a problem with a protocol
545           dissector.
546

SEE ALSO

548       wireshark-filter(4), wireshark(1), tshark(1), editcap(1), pcap(3),
549       dumpcap(1), text2pcap(1), pcap-filter(7) or tcpdump(8)
550

NOTES

552       This is the manual page for Rawshark 4.0.2. Rawshark is part of the
553       Wireshark distribution. The latest version of Wireshark can be found at
554       https://www.wireshark.org.
555
556       HTML versions of the Wireshark project man pages are available at
557       https://www.wireshark.org/docs/man-pages.
558

AUTHORS

560       Rawshark uses the same packet dissection code that Wireshark does, as
561       well as using many other modules from Wireshark; see the list of
562       authors in the Wireshark man page for a list of authors of that code.
563
564
565
566                                  2022-12-08                       RAWSHARK(1)
Impressum