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

READ FILTER SYNTAX

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

FILES

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

ENVIRONMENT VARIABLES

419       WIRESHARK_APPDATA
420           On Windows, Wireshark normally stores all application data in
421           %APPDATA% or %USERPROFILE%.  You can override the default location
422           by exporting this environment variable to specify an alternate
423           location.
424
425       WIRESHARK_DEBUG_WMEM_OVERRIDE
426           Setting this environment variable forces the wmem framework to use
427           the specified allocator backend for *all* allocations, regardless
428           of which backend is normally specified by the code. This is mainly
429           useful to developers when testing or debugging. See README.wmem in
430           the source distribution for details.
431
432       WIRESHARK_RUN_FROM_BUILD_DIRECTORY
433           This environment variable causes the plugins and other data files
434           to be loaded from the build directory (where the program was
435           compiled) rather than from the standard locations.  It has no
436           effect when the program in question is running with root (or
437           setuid) permissions on *NIX.
438
439       WIRESHARK_DATA_DIR
440           This environment variable causes the various data files to be
441           loaded from a directory other than the standard locations.  It has
442           no effect when the program in question is running with root (or
443           setuid) permissions on *NIX.
444
445       ERF_RECORDS_TO_CHECK
446           This environment variable controls the number of ERF records
447           checked when deciding if a file really is in the ERF format.
448           Setting this environment variable a number higher than the default
449           (20) would make false positives less likely.
450
451       IPFIX_RECORDS_TO_CHECK
452           This environment variable controls the number of IPFIX records
453           checked when deciding if a file really is in the IPFIX format.
454           Setting this environment variable a number higher than the default
455           (20) would make false positives less likely.
456
457       WIRESHARK_ABORT_ON_DISSECTOR_BUG
458           If this environment variable is set, Rawshark will call abort(3)
459           when a dissector bug is encountered.  abort(3) will cause the
460           program to exit abnormally; if you are running Rawshark in a
461           debugger, it should halt in the debugger and allow inspection of
462           the process, and, if you are not running it in a debugger, it will,
463           on some OSes, assuming your environment is configured correctly,
464           generate a core dump file.  This can be useful to developers
465           attempting to troubleshoot a problem with a protocol dissector.
466
467       WIRESHARK_ABORT_ON_TOO_MANY_ITEMS
468           If this environment variable is set, Rawshark will call abort(3) if
469           a dissector tries to add too many items to a tree (generally this
470           is an indication of the dissector not breaking out of a loop soon
471           enough).  abort(3) will cause the program to exit abnormally; if
472           you are running Rawshark in a debugger, it should halt in the
473           debugger and allow inspection of the process, and, if you are not
474           running it in a debugger, it will, on some OSes, assuming your
475           environment is configured correctly, generate a core dump file.
476           This can be useful to developers attempting to troubleshoot a
477           problem with a protocol dissector.
478

SEE ALSO

480       wireshark-filter(4), wireshark(1), tshark(1), editcap(1), pcap(3),
481       dumpcap(1), text2pcap(1), pcap-filter(7) or tcpdump(8)
482

NOTES

484       Rawshark is part of the Wireshark distribution. The latest version of
485       Wireshark can be found at <https://www.wireshark.org>.
486
487       HTML versions of the Wireshark project man pages are available at:
488       <https://www.wireshark.org/docs/man-pages>.
489

AUTHORS

491       Rawshark uses the same packet dissection code that Wireshark does, as
492       well as using many other modules from Wireshark; see the list of
493       authors in the Wireshark man page for a list of authors of that code.
494
495
496
4973.0.1                             2019-04-08                       RAWSHARK(1)
Impressum