1RAWSHARK(1)             The Wireshark Network Analyzer             RAWSHARK(1)
2
3
4

NAME

6       rawshark - Dump and analyze raw libpcap data
7

SYNOPSIS

9       rawshark [ -d <encap:dlt>|<proto:protoname> ] [ -F <field to display> ]
10       [ -h ] [ -l ] [ -n ] [ -N <name resolving flags> ]
11       [ -o <preference setting> ] ...  [ -p ] [ -r <pipe>|- ]
12       [ -R <read (display) filter> ] [ -s ] [ -S <field format> ]
13       [ -t ad|a|r|d|e ] [ -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       libpcap-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.  This
41       structure's format is platform-dependent; the size of the tv_sec field
42       in the struct timeval structure could be 32 bits or 64 bits.  For
43       rawshark to work, the layout of the structure in the input must match
44       the layout of the structure in rawshark.  Note that this format will
45       probably be the same as the previous format if rawshark is a 32-bit
46       program, but will not necessarily be the same if rawshark is a 64-bit
47       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 libpcap data
93           link type (DLT) name, e.g. encap:EN10MB for Ethernet. Names are
94           converted using pcap_datalink_name_to_val().
95
96           encap:number Packet data should be dissected using the libpcap DLT
97           number, e.g. encap:105 for raw IEEE 802.11. A complete list of DLTs
98           can be found in pcap-bpf.h in the libpcap sources.
99
100           proto:protocol Packet data should be passed to the specified
101           Wireshark protocol dissector, e.g. proto:http for HTTP data.
102
103       -F  <field to display>
104           Add the matching field to the output. Fields are any valid display
105           filter field. More than one -F flag may be specified, and each
106           field can match multiple times in a given packet. A single field
107           may be specified per -F flag. If you want to apply a display
108           filter, use the -R flag.
109
110       -h  Print the version and options and exits.
111
112       -l  Flush the standard output after the information for each packet is
113           printed.  (This is not, strictly speaking, line-buffered if -V was
114           specified; however, it is the same as line-buffered if -V wasn't
115           specified, as only one line is printed for each packet, and, as -l
116           is normally used when piping a live capture to a program or script,
117           so that output for a packet shows up as soon as the packet is seen
118           and dissected, it should work just as well as true line-buffering.
119           We do this as a workaround for a deficiency in the Microsoft Visual
120           C++ C library.)
121
122           This may be useful when piping the output of TShark to another
123           program, as it means that the program to which the output is piped
124           will see the dissected data for a packet as soon as TShark sees the
125           packet and generates that output, rather than seeing it only when
126           the standard output buffer containing that data fills up.
127
128       -n  Disable network object name resolution (such as hostname, TCP and
129           UDP port names), the -N flag might override this one.
130
131       -N  <name resolving flags>
132           Turn on name resolving only for particular types of addresses and
133           port numbers, with name resolving for other types of addresses and
134           port numbers turned off. This flag overrides -n if both -N and -n
135           are present. If both -N and -n flags are not present, all name
136           resolutions are turned on.
137
138           The argument is a string that may contain the letters:
139
140           m to enable MAC address resolution
141
142           n to enable network address resolution
143
144           t to enable transport-layer port number resolution
145
146           C to enable concurrent (asynchronous) DNS lookups
147
148       -o  <preference>:<value>
149           Set a preference value, overriding the default value and any value
150           read from a preference file.  The argument to the option is a
151           string of the form prefname:value, where prefname is the name of
152           the preference (which is the same name that would appear in the
153           preference file), and value is the value to which it should be set.
154
155       -p  Assume that packet data is preceded by a pcap_pkthdr struct as
156           defined in pcap.h. On some systems the size of the timestamp data
157           will be different from the data written to disk. On other systems
158           they are identical and this flag has no effect.
159
160       -r  <pipe>|-
161           Read packet data from input source. It can be either the name of a
162           FIFO (named pipe) or ``-'' to read data from the standard input,
163           and must have the record format specified above.
164
165       -R  <read (display) filter>
166           Cause the specified filter (which uses the syntax of read/display
167           filters, rather than that of capture filters) to be applied before
168           printing the output.
169
170       -s  Allows standard pcap files to be used as input, by skipping over
171           the 24 byte pcap file header.
172
173       -S  Use the specified format string to print each field. The following
174           formats are supported:
175
176           %D Field name or description, e.g. "Type" for dns.qry.type
177
178           %N Base 10 numeric value of the field.
179
180           %S String value of the field.
181
182           For something similar to Wireshark's standard display ("Type: A
183           (1)") you could use %D: %S (%N).
184
185       -t  ad|a|r|d|e
186           Set the format of the packet timestamp printed in summary lines,
187           the default is relative. The format can be one of:
188
189           ad absolute with date: The absolute date and time is the actual
190           time and date the packet was captured
191
192           a absolute: The absolute time is the actual time the packet was
193           captured, with no date displayed
194
195           r relative: The relative time is the time elapsed between the first
196           packet and the current packet
197
198           d delta: The delta time is the time since the previous packet was
199           captured
200
201           e epoch: The time in seconds since epoch (Jan 1, 1970 00:00:00)
202
203       -v  Print the version and exit.
204

READ FILTER SYNTAX

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

FILES

210       These files contains various Wireshark configuration values.
211
212       Preferences
213           The preferences files contain global (system-wide) and personal
214           preference settings. If the system-wide preference file exists, it
215           is read first, overriding the default settings. If the personal
216           preferences file exists, it is read next, overriding any previous
217           values. Note: If the command line option -o is used (possibly more
218           than once), it will in turn override values from the preferences
219           files.
220
221           The preferences settings are in the form prefname:value, one per
222           line, where prefname is the name of the preference and value is the
223           value to which it should be set; white space is allowed between :
224           and value.  A preference setting can be continued on subsequent
225           lines by indenting the continuation lines with white space.  A #
226           character starts a comment that runs to the end of the line:
227
228             # Capture in promiscuous mode?
229             # TRUE or FALSE (case-insensitive).
230             capture.prom_mode: TRUE
231
232           The global preferences file is looked for in the wireshark
233           directory under the share subdirectory of the main installation
234           directory (for example, /usr/local/share/wireshark/preferences) on
235           UNIX-compatible systems, and in the main installation directory
236           (for example, C:\Program Files\Wireshark\preferences) on Windows
237           systems.
238
239           The personal preferences file is looked for in
240           $HOME/.wireshark/preferences on UNIX-compatible systems and
241           %APPDATA%\Wireshark\preferences (or, if %APPDATA% isn't defined,
242           %USERPROFILE%\Application Data\Wireshark\preferences) on Windows
243           systems.
244
245       Disabled (Enabled) Protocols
246           The disabled_protos files contain system-wide and personal lists of
247           protocols that have been disabled, so that their dissectors are
248           never called.  The files contain protocol names, one per line,
249           where the protocol name is the same name that would be used in a
250           display filter for the protocol:
251
252             http
253             tcp     # a comment
254
255           The global disabled_protos file uses the same directory as the
256           global preferences file.
257
258           The personal disabled_protos file uses the same directory as the
259           personal preferences file.
260
261       Name Resolution (hosts)
262           If the personal hosts file exists, it is used to resolve IPv4 and
263           IPv6 addresses before any other attempts are made to resolve them.
264           The file has the standard hosts file syntax; each line contains one
265           IP address and name, separated by whitespace. The same directory as
266           for the personal preferences file is used.
267
268           Capture filter name resolution is handled by libpcap on UNIX-
269           compatible systems and WinPCAP on Windows.  As such the Wireshark
270           personal hosts file will not be consulted for capture filter name
271           resolution.
272
273       Name Resolution (ethers)
274           The ethers files are consulted to correlate 6-byte hardware
275           addresses to names. First the personal ethers file is tried and if
276           an address is not found there the global ethers file is tried next.
277
278           Each line contains one hardware address and name, separated by
279           whitespace.  The digits of the hardware address are separated by
280           colons (:), dashes (-) or periods (.).  The same separator
281           character must be used consistently in an address. The following
282           three lines are valid lines of an ethers file:
283
284             ff:ff:ff:ff:ff:ff          Broadcast
285             c0-00-ff-ff-ff-ff          TR_broadcast
286             00.00.00.00.00.00          Zero_broadcast
287
288           The global ethers file is looked for in the /etc directory on UNIX-
289           compatible systems, and in the main installation directory (for
290           example, C:\Program Files\Wireshark) on Windows systems.
291
292           The personal ethers file is looked for in the same directory as the
293           personal preferences file.
294
295           Capture filter name resolution is handled by libpcap on UNIX-
296           compatible systems and WinPCAP on Windows.  As such the Wireshark
297           personal ethers file will not be consulted for capture filter name
298           resolution.
299
300       Name Resolution (manuf)
301           The manuf file is used to match the 3-byte vendor portion of a
302           6-byte hardware address with the manufacturer's name; it can also
303           contain well-known MAC addresses and address ranges specified with
304           a netmask.  The format of the file is the same as the ethers files,
305           except that entries of the form:
306
307             00:00:0C      Cisco
308
309           can be provided, with the 3-byte OUI and the name for a vendor, and
310           entries such as:
311
312             00-00-0C-07-AC/40     All-HSRP-routers
313
314           can be specified, with a MAC address and a mask indicating how many
315           bits of the address must match. The above entry, for example, has
316           40 significant bits, or 5 bytes, and would match addresses from
317           00-00-0C-07-AC-00 through 00-00-0C-07-AC-FF. The mask need not be a
318           multiple of 8.
319
320           The manuf file is looked for in the same directory as the global
321           preferences file.
322
323       Name Resolution (ipxnets)
324           The ipxnets files are used to correlate 4-byte IPX network numbers
325           to names. First the global ipxnets file is tried and if that
326           address is not found there the personal one is tried next.
327
328           The format is the same as the ethers file, except that each address
329           is four bytes instead of six.  Additionally, the address can be
330           represented as a single hexadecimal number, as is more common in
331           the IPX world, rather than four hex octets.  For example, these
332           four lines are valid lines of an ipxnets file:
333
334             C0.A8.2C.00              HR
335             c0-a8-1c-00              CEO
336             00:00:BE:EF              IT_Server1
337             110f                     FileServer3
338
339           The global ipxnets file is looked for in the /etc directory on
340           UNIX-compatible systems, and in the main installation directory
341           (for example, C:\Program Files\Wireshark) on Windows systems.
342
343           The personal ipxnets file is looked for in the same directory as
344           the personal preferences file.
345

ENVIRONMENT VARIABLES

347       WIRESHARK_DEBUG_EP_NO_CHUNKS
348           Normally per-packet memory is allocated in large "chunks."  This
349           behavior doesn't work well with debugging tools such as Valgrind or
350           ElectricFence.  Export this environment variable to force
351           individual allocations.  Note: disabling chunks also disables
352           canaries (see below).
353
354       WIRESHARK_DEBUG_SE_NO_CHUNKS
355           Normally per-file memory is allocated in large "chunks."  This
356           behavior doesn't work well with debugging tools such as Valgrind or
357           ElectricFence.  Export this environment variable to force
358           individual allocations.  Note: disabling chunks also disables
359           canaries (see below).
360
361       WIRESHARK_DEBUG_EP_NO_CANARY
362           Normally per-packet memory allocations are separated by "canaries"
363           which allow detection of memory overruns.  This comes at the
364           expense of some extra memory usage.  Exporting this environment
365           variable disables these canaries.
366
367       WIRESHARK_DEBUG_SE_USE_CANARY
368           Exporting this environment variable causes per-file memory
369           allocations to be protected with "canaries" which allow for
370           detection of memory overruns.  This comes at the expense of
371           significant extra memory usage.
372
373       WIRESHARK_DEBUG_SCRUB_MEMORY
374           If this environment variable is set, the contents of per-packet and
375           per-file memory is initialized to 0xBADDCAFE when the memory is
376           allocated and is reset to 0xDEADBEEF when the memory is freed.
377           This functionality is useful mainly to developers looking for bugs
378           in the way memory is handled.
379
380       WIRESHARK_RUN_FROM_BUILD_DIRECTORY
381           This environment variable causes the plugins and other data files
382           to be loaded from the build directory (where the program was
383           compiled) rather than from the standard locations.  It has no
384           effect when the program in question is running with root (or
385           setuid) permissions on *NIX.
386
387       WIRESHARK_DATA_DIR
388           This environment variable causes the various data files to be
389           loaded from a directory other than the standard locations.  It has
390           no effect when the program in question is running with root (or
391           setuid) permissions on *NIX.
392
393       WIRESHARK_PYTHON_DIR
394           This environment variable points to an alternate location for
395           Python.  It has no effect when the program in question is running
396           with root (or setuid) permissions on *NIX.
397
398       ERF_RECORDS_TO_CHECK
399           This environment variable controls the number of ERF records
400           checked when deciding if a file really is in the ERF format.
401           Setting this environment variable a number higher than the default
402           (20) would make false positives less likely.
403
404       IPFIX_RECORDS_TO_CHECK
405           This environment variable controls the number of IPFIX records
406           checked when deciding if a file really is in the IPFIX format.
407           Setting this environment variable a number higher than the default
408           (20) would make false positives less likely.
409
410       WIRESHARK_ABORT_ON_DISSECTOR_BUG
411           If this environment variable is set, Rawshark will call abort(3)
412           when a dissector bug is encountered.  abort(3) will cause the
413           program to exit abnormally; if you are running Rawshark in a
414           debugger, it should halt in the debugger and allow inspection of
415           the process, and, if you are not running it in a debugger, it will,
416           on some OSes, assuming your environment is configured correctly,
417           generate a core dump file.  This can be useful to developers
418           attempting to troubleshoot a problem with a protocol dissector.
419
420       WIRESHARK_EP_VERIFY_POINTERS
421           This environment variable, if set, causes certain uses of pointers
422           to be audited to ensure they do not point to memory that is
423           deallocated after each packet has been fully dissected.  This can
424           be useful to developers writing or auditing code.
425
426       WIRESHARK_SE_VERIFY_POINTERS
427           This environment variable, if set, causes certain uses of pointers
428           to be audited to ensure they do not point to memory that is
429           deallocated after when a capture file is closed.  This can be
430           useful to developers writing or auditing code.
431
432       WIRESHARK_ABORT_ON_OUT_OF_MEMORY
433           This environment variable, if present, causes abort(3) to be called
434           if certain out-of-memory conditions (which normally result in an
435           exception and an explanatory error message) are experienced.  This
436           can be useful to developers debugging out-of-memory conditions.
437

SEE ALSO

439       wireshark-filter(4), wireshark(1), tshark(1), editcap(1), pcap(3),
440       dumpcap(1), text2pcap(1), pcap-filter(7) or tcpdump(8) if it doesn't
441       exist.
442

NOTES

444       Rawshark is part of the Wireshark distribution. The latest version of
445       Wireshark can be found at <http://www.wireshark.org>.
446
447       HTML versions of the Wireshark project man pages are available at:
448       <http://www.wireshark.org/docs/man-pages>.
449

AUTHORS

451       Rawshark uses the same packet dissection code that Wireshark does, as
452       well as using many other modules from Wireshark; see the list of
453       authors in the Wireshark man page for a list of authors of that code.
454
455
456
4571.8.10                            2013-07-23                       RAWSHARK(1)
Impressum