This file is indexed.

/usr/share/wireshark/text2pcap.html is in libwireshark-data 1.6.7-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>text2pcap - The Wireshark Network Analyzer 1.6.7</title>
<link rel="stylesheet" href="../docbook/ws.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<!--

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#options">OPTIONS</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#notes">NOTES</a></li>
	<li><a href="#authors">AUTHORS</a></li>
</ul>

-->


</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>text2pcap - Generate a capture file from an ASCII hexdump of packets</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<p><strong>text2pcap</strong>
[&nbsp;<strong>-h</strong>&nbsp;]
[&nbsp;<strong>-d</strong>&nbsp;]
[&nbsp;<strong>-q</strong>&nbsp;]
[&nbsp;<strong>-o</strong>&nbsp;hex|oct|dec&nbsp;]
[&nbsp;<strong>-l</strong>&nbsp;&lt;typenum&gt;&nbsp;]
[&nbsp;<strong>-e</strong>&nbsp;&lt;l3pid&gt;&nbsp;]
[&nbsp;<strong>-i</strong>&nbsp;&lt;proto&gt;&nbsp;]
[&nbsp;<strong>-m</strong>&nbsp;&lt;max-packet&gt;&nbsp;]
[&nbsp;<strong>-u</strong>&nbsp;&lt;srcport&gt;,&lt;destport&gt;&nbsp;]
[&nbsp;<strong>-T</strong>&nbsp;&lt;srcport&gt;,&lt;destport&gt;&nbsp;]
[&nbsp;<strong>-s</strong>&nbsp;&lt;srcport&gt;,&lt;destport&gt;,&lt;tag&gt;&nbsp;]
[&nbsp;<strong>-S</strong>&nbsp;&lt;srcport&gt;,&lt;destport&gt;,&lt;ppi&gt;&nbsp;]
[&nbsp;<strong>-t</strong>&nbsp;&lt;timefmt&gt;&nbsp;]
&lt;<em>infile</em>&gt;|-
&lt;<em>outfile</em>&gt;|-</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p><strong>Text2pcap</strong> is a program that reads in an ASCII hex dump and writes the
data described into a <strong>libpcap</strong> capture file.  <strong>text2pcap</strong> can
read hexdumps with multiple packets in them, and build a capture file of
multiple packets.  <strong>text2pcap</strong> is also capable of generating dummy
Ethernet, IP and UDP, TCP, or SCTP headers, in order to build fully
processable packet dumps from hexdumps of application-level data only.</p>
<p><strong>Text2pcap</strong> understands a hexdump of the form generated by <em>od -Ax -tx1 -v</em>.
In other words, each byte is individually displayed and
surrounded with a space. Each line begins with an offset describing
the position in the file. The offset is a hex number (can also be
octal or decimal - see <strong>-o</strong>), of more than two hex digits.
Here is a sample dump that <strong>text2pcap</strong> can recognize:</p>
<pre>
    000000 00 e0 1e a7 05 6f 00 10 ........
    000008 5a a0 b9 12 08 00 46 00 ........
    000010 03 68 00 00 00 00 0a 2e ........
    000018 ee 33 0f 19 08 7f 0f 19 ........
    000020 03 80 94 04 00 00 10 01 ........
    000028 16 a2 0a 00 03 50 00 0c ........
    000030 01 01 0f 19 03 80 11 01 ........</pre>
<p>There is no limit on the width or number of bytes per line. Also the
text dump at the end of the line is ignored. Bytes/hex numbers can be
uppercase or lowercase. Any text before the offset is ignored,
including email forwarding characters '&gt;'. Any lines of text between
the bytestring lines is ignored. The offsets are used to track the
bytes, so offsets must be correct. Any line which has only bytes
without a leading offset is ignored. An offset is recognized as being
a hex number longer than two characters. Any text after the bytes is
ignored (e.g. the character dump). Any hex numbers in this text are
also ignored. An offset of zero is indicative of starting a new
packet, so a single text file with a series of hexdumps can be
converted into a packet capture with multiple packets. Packets may be
preceded by a timestamp. These are interpreted according to the format
given on the command line (see <strong>-t</strong>). If not, the first packet
is timestamped with the current time the conversion takes place. Multiple
packets are written with timestamps differing by one microsecond each.
In general, short of these restrictions, <strong>text2pcap</strong> is pretty liberal
about reading in hexdumps and has been tested with a variety of
mangled outputs (including being forwarded through email multiple
times, with limited line wrap etc.)</p>
<p>There are a couple of other special features to note. Any line where
the first non-whitespace character is '#' will be ignored as a
comment. Any line beginning with #TEXT2PCAP is a directive and options
can be inserted after this command to be processed by
<strong>text2pcap</strong>. Currently there are no directives implemented; in the
future, these may be used to give more fine grained control on the
dump and the way it should be processed e.g. timestamps, encapsulation
type etc.</p>
<p><strong>Text2pcap</strong> also allows the user to read in dumps of
application-level data, by inserting dummy L2, L3 and L4 headers
before each packet. The user can elect to insert Ethernet headers,
Ethernet and IP, or Ethernet, IP and UDP/TCP/SCTP headers before each
packet. This allows Wireshark or any other full-packet decoder to
handle these dumps.</p>
<p>
</p>
<hr />
<h1><a name="options">OPTIONS</a></h1>
<dl>
<dt><strong><a name="h" class="item">-h</a></strong></dt>

<dd>
<p>Displays a help message.</p>
</dd>
<dt><strong><a name="d" class="item">-d</a></strong></dt>

<dd>
<p>Displays debugging information during the process. Can be used
multiple times to generate more debugging information.</p>
</dd>
<dt><strong><a name="q" class="item">-q</a></strong></dt>

<dd>
<p>Be completely quiet during the process.</p>
</dd>
<dt><strong><a name="o_hex_oct_dec" class="item">-o hex|oct|dec</a></strong></dt>

<dd>
<p>Specify the radix for the offsets (hex, octal or decimal). Defaults to
hex. This corresponds to the <code>-A</code> option for <em>od</em>.</p>
</dd>
<dt><strong><a name="l" class="item">-l</a></strong></dt>

<dd>
<p>Specify the link-layer header type of this packet.  Default is Ethernet
(1).  See <a href="http://www.tcpdump.org/linktypes.html">http://www.tcpdump.org/linktypes.html</a> for the complete list
of possible encapsulations.  Note that this option should be used if
your dump is a complete hex dump of an encapsulated packet and you wish
to specify the exact type of encapsulation.  Example: <em>-l 7</em> for ARCNet
packets.</p>
</dd>
<dt><strong><a name="e_l3pid" class="item">-e &lt;l3pid&gt;</a></strong></dt>

<dd>
<p>Include a dummy Ethernet header before each packet. Specify the L3PID
for the Ethernet header in hex. Use this option if your dump has Layer
3 header and payload (e.g. IP header), but no Layer 2
encapsulation. Example: <em>-e 0x806</em> to specify an ARP packet.</p>
<p>For IP packets, instead of generating a fake Ethernet header you can
also use <em>-l 12</em> to indicate a raw IP packet to Wireshark. Note that
<em>-l 12</em> does not work for any non-IP Layer 3 packet (e.g. ARP),
whereas generating a dummy Ethernet header with <em>-e</em> works for any
sort of L3 packet.</p>
</dd>
<dt><strong><a name="i_proto" class="item">-i &lt;proto&gt;</a></strong></dt>

<dd>
<p>Include dummy IP headers before each packet. Specify the IP protocol
for the packet in decimal. Use this option if your dump is the payload
of an IP packet (i.e. has complete L4 information) but does not have
an IP header with each packet. Note that an appropriate Ethernet header
is automatically included with each packet as well. 
Example: <em>-i 46</em> to specify an RSVP packet (IP protocol 46).</p>
</dd>
<dt><strong><a name="m_max_packet" class="item">-m &lt;max-packet&gt;</a></strong></dt>

<dd>
<p>Set the maximum packet length, default is 64000.
Useful for testing various packet boundaries when only an application
level datastream is available.  Example:</p>
<p><em>od -Ax -tx1 stream | text2pcap -m1460 -T1234,1234 - stream.pcap</em></p>
<p>will convert from plain datastream format to a sequence of Ethernet
TCP packets.</p>
</dd>
<dt><strong><a name="u_srcport_destport" class="item">-u &lt;srcport&gt;,&lt;destport&gt;</a></strong></dt>

<dd>
<p>Include dummy UDP headers before each packet. Specify the source and
destination UDP ports for the packet in decimal. Use this option if
your dump is the UDP payload of a packet but does not include any UDP,
IP or Ethernet headers. Note that appropriate Ethernet and IP headers 
are automatically also included with each packet. 
Example: <em>-u1000,69</em> to make the packets look like TFTP/UDP packets.</p>
</dd>
<dt><strong><a name="t_srcport_destport" class="item">-T &lt;srcport&gt;,&lt;destport&gt;</a></strong></dt>

<dd>
<p>Include dummy TCP headers before each packet. Specify the source and
destination TCP ports for the packet in decimal. Use this option if
your dump is the TCP payload of a packet but does not include any TCP,
IP or Ethernet headers. Note that appropriate Ethernet and IP headers 
are automatically also included with each packet.
Sequence numbers will start at 0.</p>
</dd>
<dt><strong><a name="s_srcport_destport_tag" class="item">-s &lt;srcport&gt;,&lt;destport&gt;,&lt;tag&gt;</a></strong></dt>

<dd>
<p>Include dummy SCTP headers before each packet.  Specify, in decimal, the
source and destination SCTP ports, and verification tag, for the packet. 
Use this option if your dump is the SCTP payload of a packet but does
not include any SCTP, IP or Ethernet headers.  Note that appropriate 
Ethernet and IP headers are automatically also included with each
packet.  A CRC32C checksum will be put into the SCTP header.</p>
</dd>
<dt><strong><a name="s_srcport_destport_ppi" class="item">-S &lt;srcport&gt;,&lt;destport&gt;,&lt;ppi&gt;</a></strong></dt>

<dd>
<p>Include dummy SCTP headers before each packet.  Specify, in decimal, the
source and destination SCTP ports, and a verification tag of 0, for the
packet, and prepend a dummy SCTP DATA chunk header with a payload
protocol identifier if <em>ppi</em>.  Use this option if your dump is the SCTP
payload of a packet but does not include any SCTP, IP or Ethernet
headers.  Note that appropriate Ethernet and IP headers are 
automatically included with each packet.  A CRC32C checksum will be put
into the SCTP header.</p>
</dd>
<dt><strong><a name="t_timefmt" class="item">-t &lt;timefmt&gt;</a></strong></dt>

<dd>
<p>Treats the text before the packet as a date/time code; <em>timefmt</em> is a
format string of the sort supported by <code>strptime(3)</code>.
Example: The time &quot;10:15:14.5476&quot; has the format code &quot;%H:%M:%S.&quot;</p>
<p><strong>NOTE:</strong> The subsecond component delimiter must be specified (.) but no
pattern is required; the remaining number is assumed to be fractions of
a second.</p>
<p><strong>NOTE:</strong> Date/time fields from the current date/time are
used as the default for unspecified fields.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><code>od(1)</code>, <code>tcpdump(8)</code>, <code>pcap(3)</code>, <code>wireshark(1)</code>, <code>tshark(1)</code>, <code>dumpcap(1)</code>, <code>mergecap(1)</code>,
<code>editcap(1)</code>, <code>strptime(3)</code>.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p><strong>Text2pcap</strong> is part of the <strong>Wireshark</strong> distribution.  The latest version
of <strong>Wireshark</strong> can be found at <a href="http://www.wireshark.org">http://www.wireshark.org</a>.</p>
<p>
</p>
<hr />
<h1><a name="authors">AUTHORS</a></h1>
<pre>
  Ashok Narayanan          &lt;ashokn[AT]cisco.com&gt;</pre>

</body>

</html>