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

SYNOPSYS

9       text2pcap [ -h ] [ -d ] [ -q ] [ -o hex⎪oct⎪dec ] [ -l <typenum> ]
10       [ -e <l3pid> ] [ -i <proto> ] [ -m <max-packet> ] [ -u <srcport>,<dest‐
11       port> ] [ -T <srcport>,<destport> ] [ -s <srcport>,<destport>,<tag> ]
12       [ -S <srcport>,<destport>,<ppi> ] [ -t <timefmt> ] <infile>⎪- <out‐
13       file>⎪-
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 hex‐
18       dumps with multiple packets in them, and build a capture file of multi‐
19       ple packets.  text2pcap is also capable of generating dummy Ethernet,
20       IP and UDP, TCP, or SCTP headers, in order to build fully processable
21       packet dumps from hexdumps of application-level data only.
22
23       Text2pcap understands a hexdump of the form generated by od -Ax -tx1.
24       In other words, each byte is individually displayed and surrounded with
25       a space. Each line begins with an offset describing the position in the
26       file. The offset is a hex number (can also be octal or decimal - see
27       -o), of more than two hex digits.  Here is a sample dump that text2pcap
28       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, includ‐
41       ing email forwarding characters '>'. Any lines of text between the
42       bytestring lines is ignored. The offsets are used to track the bytes,
43       so offsets must be correct. Any line which has only bytes without a
44       leading offset is ignored. An offset is recognized as being a hex num‐
45       ber longer than two characters. Any text after the bytes is ignored
46       (e.g. the character dump). Any hex numbers in this text are also
47       ignored. An offset of zero is indicative of starting a new packet, so a
48       single text file with a series of hexdumps can be converted into a
49       packet capture with multiple packets. Multiple packets are read in with
50       timestamps differing by one second each. In general, short of these
51       restrictions, text2pcap is pretty liberal about reading in hexdumps and
52       has been tested with a variety of mangled outputs (including being for‐
53       warded through email multiple times, with limited line wrap etc.)
54
55       There are a couple of other special features to note. Any line where
56       the first non-whitespace character is '#' will be ignored as a comment.
57       Any line beginning with #TEXT2PCAP is a directive and options can be
58       inserted after this command to be processed by text2pcap. Currently
59       there are no directives implemented; in the future, these may be used
60       to give more fine grained control on the dump and the way it should be
61       processed e.g. timestamps, encapsulation type etc.
62
63       Text2pcap also allows the user to read in dumps of application-level
64       data, by inserting dummy L2, L3 and L4 headers before each packet. The
65       user can elect to insert Ethernet headers, Ethernet and IP, or Ether‐
66       net, IP and UDP/TCP headers before each packet. This allows Wireshark
67       or any other full-packet decoder to handle these dumps.
68

OPTIONS

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

SEE ALSO

166       od(1), tcpdump(8), pcap(3), wireshark(1), tshark(1), dumpcap(1), merge‐
167       cap(1), editcap(1), strptime(3).
168

NOTES

170       Text2pcap is part of the Wireshark distribution.  The latest version of
171       Wireshark can be found at <http://www.wireshark.org>.
172

AUTHORS

174         Ashok Narayanan          <ashokn[AT]cisco.com>
175
176
177
1781.0.0                             2008-03-29                      TEXT2PCAP(1)
Impressum