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

NAME

6       text2pcap - Generate a capture file from an ASCII hexdump of packets
7

SYNOPSIS

9       text2pcap [ -a ] [ -d ] [ -e <l3pid> ] [ -h ] [ -i <proto> ]
10       [ -l <typenum> ] [ -m <max-packet> ] [ -o hex|oct|dec ] [ -q ]
11       [ -s <srcport>,<destport>,<tag> ] [ -S <srcport>,<destport>,<ppi> ]
12       [ -t <timefmt> ] [ -T <srcport>,<destport> ]
13       [ -u <srcport>,<destport> ] <infile>|- <outfile>|-
14

DESCRIPTION

16       Text2pcap is a program that reads in an ASCII hex dump and writes the
17       data described into a libpcap capture file.  text2pcap can read
18       hexdumps with multiple packets in them, and build a capture file of
19       multiple packets.  text2pcap is also capable of generating dummy
20       Ethernet, IP and UDP, TCP, or SCTP headers, in order to build fully
21       processable packet dumps from hexdumps of application-level data only.
22
23       Text2pcap understands a hexdump of the form generated by od -Ax -tx1
24       -v.  In other words, each byte is individually displayed and surrounded
25       with a space. Each line begins with an offset describing the position
26       in the file. The offset is a hex number (can also be octal or decimal -
27       see -o), of more than two hex digits.  Here is a sample dump that
28       text2pcap can recognize:
29
30           000000 00 e0 1e a7 05 6f 00 10 ........
31           000008 5a a0 b9 12 08 00 46 00 ........
32           000010 03 68 00 00 00 00 0a 2e ........
33           000018 ee 33 0f 19 08 7f 0f 19 ........
34           000020 03 80 94 04 00 00 10 01 ........
35           000028 16 a2 0a 00 03 50 00 0c ........
36           000030 01 01 0f 19 03 80 11 01 ........
37
38       There is no limit on the width or number of bytes per line. Also the
39       text dump at the end of the line is ignored. Bytes/hex numbers can be
40       uppercase or lowercase. Any text before the offset is ignored,
41       including email forwarding characters '>'. Any lines of text between
42       the bytestring lines is ignored. The offsets are used to track the
43       bytes, so offsets must be correct. Any line which has only bytes
44       without a leading offset is ignored. An offset is recognized as being a
45       hex number longer than two characters. Any text after the bytes is
46       ignored (e.g. the character dump). Any hex numbers in this text are
47       also ignored. An offset of zero is indicative of starting a new packet,
48       so a single text file with a series of hexdumps can be converted into a
49       packet capture with multiple packets. Packets may be preceded by a
50       timestamp. These are interpreted according to the format given on the
51       command line (see -t). If not, the first packet is timestamped with the
52       current time the conversion takes place. Multiple packets are written
53       with timestamps differing by one microsecond each.  In general, short
54       of these restrictions, text2pcap is pretty liberal about reading in
55       hexdumps and has been tested with a variety of mangled outputs
56       (including being forwarded through email multiple times, with limited
57       line wrap etc.)
58
59       There are a couple of other special features to note. Any line where
60       the first non-whitespace character is '#' will be ignored as a comment.
61       Any line beginning with #TEXT2PCAP is a directive and options can be
62       inserted after this command to be processed by text2pcap. Currently
63       there are no directives implemented; in the future, these may be used
64       to give more fine grained control on the dump and the way it should be
65       processed e.g. timestamps, encapsulation type etc.
66
67       Text2pcap also allows the user to read in dumps of application-level
68       data, by inserting dummy L2, L3 and L4 headers before each packet. The
69       user can elect to insert Ethernet headers, Ethernet and IP, or
70       Ethernet, IP and UDP/TCP/SCTP headers before each packet. This allows
71       Wireshark or any other full-packet decoder to handle these dumps.
72

OPTIONS

74       -a  Enables ASCII text dump identification. It allows to identify the
75           start of the ASCII text dump and not include it in the packet even
76           if it looks like HEX.
77
78           NOTE: Do not enable it if the input file does not contain the ASCII
79           text dump.
80
81       -d  Displays debugging information during the process. Can be used
82           multiple times to generate more debugging information.
83
84       -e <l3pid>
85           Include a dummy Ethernet header before each packet. Specify the
86           L3PID for the Ethernet header in hex. Use this option if your dump
87           has Layer 3 header and payload (e.g. IP header), but no Layer 2
88           encapsulation. Example: -e 0x806 to specify an ARP packet.
89
90           For IP packets, instead of generating a fake Ethernet header you
91           can also use -l 101 to indicate a raw IP packet to Wireshark. Note
92           that -l 101 does not work for any non-IP Layer 3 packet (e.g. ARP),
93           whereas generating a dummy Ethernet header with -e works for any
94           sort of L3 packet.
95
96       -h  Displays a help message.
97
98       -i <proto>
99           Include dummy IP headers before each packet. Specify the IP
100           protocol for the packet in decimal. Use this option if your dump is
101           the payload of an IP packet (i.e. has complete L4 information) but
102           does not have an IP header with each packet. Note that an
103           appropriate Ethernet header is automatically included with each
104           packet as well.  Example: -i 46 to specify an RSVP packet (IP
105           protocol 46).
106
107       -l  Specify the link-layer header type of this packet.  Default is
108           Ethernet (1).  See <http://www.tcpdump.org/linktypes.html> for the
109           complete list of possible encapsulations.  Note that this option
110           should be used if your dump is a complete hex dump of an
111           encapsulated packet and you wish to specify the exact type of
112           encapsulation.  Example: -l 7 for ARCNet packets encapsulated BSD-
113           style.
114
115       -m <max-packet>
116           Set the maximum packet length, default is 64000.  Useful for
117           testing various packet boundaries when only an application level
118           datastream is available.  Example:
119
120           od -Ax -tx1 stream | text2pcap -m1460 -T1234,1234 - stream.pcap
121
122           will convert from plain datastream format to a sequence of Ethernet
123           TCP packets.
124
125       -o hex|oct|dec
126           Specify the radix for the offsets (hex, octal or decimal). Defaults
127           to hex. This corresponds to the "-A" option for od.
128
129       -q  Be completely quiet during the process.
130
131       -s <srcport>,<destport>,<tag>
132           Include dummy SCTP headers before each packet.  Specify, in
133           decimal, the source and destination SCTP ports, and verification
134           tag, for the packet.  Use this option if your dump is the SCTP
135           payload of a packet but does not include any SCTP, IP or Ethernet
136           headers.  Note that appropriate Ethernet and IP headers are
137           automatically also included with each packet.  A CRC32C checksum
138           will be put into the SCTP header.
139
140       -S <srcport>,<destport>,<ppi>
141           Include dummy SCTP headers before each packet.  Specify, in
142           decimal, the source and destination SCTP ports, and a verification
143           tag of 0, for the packet, and prepend a dummy SCTP DATA chunk
144           header with a payload protocol identifier if ppi.  Use this option
145           if your dump is the SCTP payload of a packet but does not include
146           any SCTP, IP or Ethernet headers.  Note that appropriate Ethernet
147           and IP headers are automatically included with each packet.  A
148           CRC32C checksum will be put into the SCTP header.
149
150       -t <timefmt>
151           Treats the text before the packet as a date/time code; timefmt is a
152           format string of the sort supported by strptime(3).  Example: The
153           time "10:15:14.5476" has the format code "%H:%M:%S."
154
155           NOTE: The subsecond component delimiter must be specified (.) but
156           no pattern is required; the remaining number is assumed to be
157           fractions of a second.
158
159           NOTE: Date/time fields from the current date/time are used as the
160           default for unspecified fields.
161
162       -T <srcport>,<destport>
163           Include dummy TCP headers before each packet. Specify the source
164           and destination TCP ports for the packet in decimal. Use this
165           option if your dump is the TCP payload of a packet but does not
166           include any TCP, IP or Ethernet headers. Note that appropriate
167           Ethernet and IP headers are automatically also included with each
168           packet.  Sequence numbers will start at 0.
169
170       -u <srcport>,<destport>
171           Include dummy UDP headers before each packet. Specify the source
172           and destination UDP ports for the packet in decimal. Use this
173           option if your dump is the UDP payload of a packet but does not
174           include any UDP, IP or Ethernet headers. Note that appropriate
175           Ethernet and IP headers are automatically also included with each
176           packet.  Example: -u1000,69 to make the packets look like TFTP/UDP
177           packets.
178

SEE ALSO

180       od(1), pcap(3), wireshark(1), tshark(1), dumpcap(1), mergecap(1),
181       editcap(1), strptime(3), pcap-filter(7) or tcpdump(8) if it doesn't
182       exist.
183

NOTES

185       Text2pcap is part of the Wireshark distribution.  The latest version of
186       Wireshark can be found at <http://www.wireshark.org>.
187

AUTHORS

189         Ashok Narayanan          <ashokn[AT]cisco.com>
190
191
192
1931.8.10                            2013-07-29                      TEXT2PCAP(1)
Impressum