text2pcap.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="generator" content="Asciidoctor 2.0.17">
  8. <title>text2pcap(1)</title>
  9. <link rel="stylesheet" href="./ws.css">
  10. </head>
  11. <body class="manpage">
  12. <div id="header">
  13. <h1>text2pcap(1) Manual Page</h1>
  14. <h2 id="_name">NAME</h2>
  15. <div class="sectionbody">
  16. <p>text2pcap - Generate a capture file from an ASCII hexdump of packets</p>
  17. </div>
  18. </div>
  19. <div id="content">
  20. <div class="sect1">
  21. <h2 id="_synopsis">SYNOPSIS</h2>
  22. <div class="sectionbody">
  23. <div class="paragraph">
  24. <p><span class="nowrap"><strong>text2pcap</strong></span>
  25. <span class="nowrap">[ <strong>-a</strong> ]</span>
  26. <span class="nowrap">[ <strong>-b</strong> 2|8|16|64 ]</span>
  27. <span class="nowrap">[ <strong>-D</strong> ]</span>
  28. <span class="nowrap">[ <strong>-e</strong> &lt;l3pid&gt; ]</span>
  29. <span class="nowrap">[ <strong>-E</strong> &lt;encapsulation type&gt; ]</span>
  30. <span class="nowrap">[ <strong>-F</strong> &lt;file format&gt; ]</span>
  31. <span class="nowrap">[ <strong>-h</strong> ]</span>
  32. <span class="nowrap">[ <strong>-i</strong> &lt;proto&gt; ]</span>
  33. <span class="nowrap">[ <strong>-l</strong> &lt;typenum&gt; ]</span>
  34. <span class="nowrap">[ <strong>-N</strong> &lt;intf-name&gt; ]</span>
  35. <span class="nowrap">[ <strong>-m</strong> &lt;max-packet&gt; ]</span>
  36. <span class="nowrap">[ <strong>-o</strong> hex|oct|dec|none ]</span>
  37. <span class="nowrap">[ <strong>-q</strong> ]</span>
  38. <span class="nowrap">[ <strong>-r</strong> &lt;regex&gt; ]</span>
  39. <span class="nowrap">[ <strong>-s</strong> &lt;srcport&gt;,&lt;destport&gt;,&lt;tag&gt; ]</span>
  40. <span class="nowrap">[ <strong>-S</strong> &lt;srcport&gt;,&lt;destport&gt;,&lt;ppi&gt; ]</span>
  41. <span class="nowrap">[ <strong>-t</strong> &lt;timefmt&gt; ]</span>
  42. <span class="nowrap">[ <strong>-T</strong> &lt;srcport&gt;,&lt;destport&gt; ]</span>
  43. <span class="nowrap">[ <strong>-u</strong> &lt;srcport&gt;,&lt;destport&gt; ]</span>
  44. <span class="nowrap">[ <strong>-v</strong> ]</span>
  45. <span class="nowrap">[ <strong>-4</strong> &lt;srcip&gt;,&lt;destip&gt; ]</span>
  46. <span class="nowrap">[ <strong>-6</strong> &lt;srcip&gt;,&lt;destip&gt; ]</span>
  47. <span class="nowrap">&lt;<em>infile</em>&gt;|-</span>
  48. <span class="nowrap">&lt;<em>outfile</em>&gt;|-</span></p>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="sect1">
  53. <h2 id="_description">DESCRIPTION</h2>
  54. <div class="sectionbody">
  55. <div class="paragraph">
  56. <p><strong>Text2pcap</strong> is a program that reads in an ASCII hex dump and writes the
  57. data described into a capture file. <strong>text2pcap</strong> can read hexdumps with
  58. multiple packets in them, and build a capture file of multiple packets.
  59. <strong>Text2pcap</strong> is also capable of generating dummy Ethernet, IP, and UDP, TCP
  60. or SCTP headers, in order to build fully processable packet dumps from
  61. hexdumps of application-level data only.</p>
  62. </div>
  63. <div class="paragraph">
  64. <p><strong>Text2pcap</strong> can write the file in several output formats.
  65. The <strong>-F</strong> flag can be used to specify the format in which to write the
  66. capture file, <strong>text2pcap -F</strong> provides a list of the available output
  67. formats. By default, it writes the packets to <em>outfile</em> in the <strong>pcapng</strong>
  68. file format.</p>
  69. </div>
  70. <div class="paragraph">
  71. <p><strong>Text2pcap</strong> understands a hexdump of the form generated by <em>od -Ax
  72. -tx1 -v</em>. In other words, each byte is individually displayed, with
  73. spaces separating the bytes from each other. Hex digits can be upper
  74. or lowercase.</p>
  75. </div>
  76. <div class="paragraph">
  77. <p>In normal operation, each line must begin with an offset describing the
  78. position in the packet, followed a colon, space, or tab separating it from
  79. the bytes. There is no limit on the width or number of bytes per line, but
  80. lines with only hex bytes without a leading offset are ignored (in other words,
  81. line breaks should not be inserted in long lines that wrap.) Offsets are more
  82. than two digits; they are in hex by default, but can also be in octal or
  83. decimal - see <strong>-o</strong>. Each packet must begin with offset zero, and an offset
  84. zero indicates the beginning of a new packet. Offset values must be correct;
  85. an unexpected value causes the current packet to be aborted and the next
  86. packet start awaited. There is also a single packet mode with no offsets;
  87. see <strong>-o</strong>.</p>
  88. </div>
  89. <div class="paragraph">
  90. <p>Packets may be preceded by a direction indicator ('I' or 'O') and/or a
  91. timestamp if indicated by the command line (see <strong>-D</strong> and <strong>-t</strong>). If both are
  92. present, the direction indicator precedes the timestamp. The format of the
  93. timestamps is specified as a mandatory parameter to <strong>-t</strong>. If no timestamp is
  94. parsed, in the case of the first packet the current system time is used, while
  95. subsequent packets are written with timestamps one microsecond later than that
  96. of the previous packet.</p>
  97. </div>
  98. <div class="paragraph">
  99. <p>Other text in the input data is ignored. Any text before the offset is
  100. ignored, including email forwarding characters '&gt;'. Any text on a line
  101. after the bytes is ignored, e.g. an ASCII character dump (but see <strong>-a</strong> to
  102. ensure that hex digits in the character dump are ignored). Any line where
  103. the first non-whitespace character is a '#' will be ignored as a comment.
  104. Any lines of text between the bytestring lines are considered preamble;
  105. the beginning of the preamble is scanned for the direction indicator and
  106. timestamp as mentioned above and otherwise ignored.</p>
  107. </div>
  108. <div class="paragraph">
  109. <p>Any line beginning with #TEXT2PCAP is a directive and options
  110. can be inserted after this command to be processed by <strong>text2pcap</strong>.
  111. Currently there are no directives implemented; in the future, these may
  112. be used to give more fine grained control on the dump and the way it
  113. should be processed e.g. timestamps, encapsulation type etc.</p>
  114. </div>
  115. <div class="paragraph">
  116. <p>In general, short of these restrictions, <strong>text2pcap</strong> is pretty liberal
  117. about reading in hexdumps and has been tested with a variety of
  118. mangled outputs (including being forwarded through email multiple
  119. times, with limited line wrap etc.)</p>
  120. </div>
  121. <div class="paragraph">
  122. <p>Here is a sample dump that <strong>text2pcap</strong> can recognize, with optional
  123. directional indicator and timestamp:</p>
  124. </div>
  125. <div class="literalblock">
  126. <div class="content">
  127. <pre>I 2019-05-14T19:04:57Z
  128. 000000 00 0e b6 00 00 02 00 0e b6 00 00 01 08 00 45 00
  129. 000010 00 28 00 00 00 00 ff 01 37 d1 c0 00 02 01 c0 00
  130. 000020 02 02 08 00 a6 2f 00 01 00 01 48 65 6c 6c 6f 20
  131. 000030 57 6f 72 6c 64 21
  132. 000036</pre>
  133. </div>
  134. </div>
  135. <div class="paragraph">
  136. <p><strong>Text2pcap</strong> is also capable of scanning a text input file using a custom Perl
  137. compatible regular expression that matches a single packet. <strong>text2pcap</strong>
  138. searches the given file (which must end with '\n') for non-overlapping non-empty
  139. strings matching the regex. Named capturing subgroups, which must match
  140. exactly once per packet, are used to identify fields to import. The following
  141. fields are supported in regex mode, one mandatory and three optional:</p>
  142. </div>
  143. <div class="literalblock">
  144. <div class="content">
  145. <pre>"data" Actual captured frame data to import
  146. "time" Timestamp of packet
  147. "dir" Direction of packet
  148. "seqno" Arbitrary ID of packet</pre>
  149. </div>
  150. </div>
  151. <div class="paragraph">
  152. <p>The 'data' field is the captured data, which must be in a selected encoding:
  153. hexadecimal (the default), octal, binary, or base64 and containing no
  154. characters in the data field outside the encoding set besides whitespace.
  155. The 'time' field is parsed according to the format in the <strong>-t</strong> parameter.
  156. The first character of the 'dir' field is compared against a set of characters
  157. corresponding to inbound and outbound that default to "iI&lt;" for inbound and
  158. "oO&gt;" for outbound to assign a direction. The 'seqno' field is assumed to
  159. be a positive integer base 10 used for an arbitrary ID. An optional field&#8217;s
  160. information will only be written if the field is present in the regex and if
  161. the capture file format supports it. (E.g., the pcapng format supports all
  162. three fields, but the pcap format only supports timestamps.)</p>
  163. </div>
  164. <div class="paragraph">
  165. <p>Here is a sample dump that the regex mode can process with the regex
  166. '^(?&lt;dir&gt;[&lt;&gt;])\s(?&lt;time&gt;\d+:\d\d:\d\d.\d+)\s(?&lt;data&gt;[0-9a-fA-F]+)$' along
  167. with timestamp format '%H:%M:%S.%f', directional indications of '&lt;' and '&gt;',
  168. and hex encoding:</p>
  169. </div>
  170. <div class="literalblock">
  171. <div class="content">
  172. <pre>&gt; 0:00:00.265620 a130368b000000080060
  173. &gt; 0:00:00.280836 a1216c8b00000000000089086b0b82020407
  174. &lt; 0:00:00.295459 a2010800000000000000000800000000
  175. &gt; 0:00:00.296982 a1303c8b00000008007088286b0bc1ffcbf0f9ff
  176. &gt; 0:00:00.305644 a121718b0000000000008ba86a0b8008
  177. &lt; 0:00:00.319061 a2010900000000000000001000600000
  178. &gt; 0:00:00.330937 a130428b00000008007589186b0bb9ffd9f0fdfa3eb4295e99f3aaffd2f005
  179. &gt; 0:00:00.356037 a121788b0000000000008a18</pre>
  180. </div>
  181. </div>
  182. <div class="paragraph">
  183. <p>The regex is compiled with multiline support, and it is recommended to use
  184. the anchors '^' and '$' for best results.</p>
  185. </div>
  186. <div class="paragraph">
  187. <p><strong>Text2pcap</strong> also allows the user to read in dumps of application-level
  188. data and insert dummy L2, L3 and L4 headers before each packet. This allows
  189. Wireshark or any other full-packet decoder to handle these dumps.
  190. If the encapsulation type is Ethernet, the user can elect to insert Ethernet
  191. headers, Ethernet and IP, or Ethernet, IP and UDP/TCP/SCTP headers before
  192. each packet. The fake headers can also be used with the Raw IP, Raw IPv4,
  193. or Raw IPv6 encapsulations, with the Ethernet header omitted. These
  194. encapsulation options can be used in both hexdump mode and regex mode.</p>
  195. </div>
  196. <div class="paragraph">
  197. <p>When &lt;<em>infile</em>&gt; or &lt;<em>outfile</em>&gt; are '-', standard input or standard
  198. output, respectively, are used.</p>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="sect1">
  203. <h2 id="_options">OPTIONS</h2>
  204. <div class="sectionbody">
  205. <div class="dlist">
  206. <dl>
  207. <dt class="hdlist1">-a</dt>
  208. <dd>
  209. <div class="openblock">
  210. <div class="content">
  211. <div class="paragraph">
  212. <p>Enables ASCII text dump identification. It allows one to identify the start of
  213. the ASCII text dump and not include it in the packet even if it looks like HEX.
  214. This parameter has no effect in regex mode.</p>
  215. </div>
  216. <div class="paragraph">
  217. <p><strong>NOTE:</strong> Do not enable it if the input file does not contain the ASCII text dump.</p>
  218. </div>
  219. </div>
  220. </div>
  221. </dd>
  222. <dt class="hdlist1">-b 2|8|16|64</dt>
  223. <dd>
  224. <div class="openblock">
  225. <div class="content">
  226. <div class="paragraph">
  227. <p>Specify the base (radix) of the encoding of the packet data in regex mode.
  228. The supported options are 2 (binary), 8 (octal), 16 (hexadecimal), and 64
  229. (base64 encoding), with hex as the default. This parameter has no effect
  230. in hexdump mode.</p>
  231. </div>
  232. </div>
  233. </div>
  234. </dd>
  235. <dt class="hdlist1">-D</dt>
  236. <dd>
  237. <div class="openblock">
  238. <div class="content">
  239. <div class="paragraph">
  240. <p>Indicates that the text before each input packet may start either with an I
  241. or O indicating that the packet is inbound or outbound. If both this flag
  242. and the <em>t</em> flag are used, the directional indicator is expected before
  243. the time code.
  244. This parameter has no effect in regex mode, where the presence of the <code>&lt;dir&gt;</code>
  245. capturing group determines whether direction indicators are expected.</p>
  246. </div>
  247. <div class="paragraph">
  248. <p>Direction indication is stored in the packet headers if the output format
  249. supports it (e.g. pcapng), and is also used when generating dummy headers
  250. to swap the source and destination addresses and ports as appropriate.</p>
  251. </div>
  252. </div>
  253. </div>
  254. </dd>
  255. <dt class="hdlist1">-e &lt;l3pid&gt;</dt>
  256. <dd>
  257. <div class="openblock">
  258. <div class="content">
  259. <div class="paragraph">
  260. <p>Include a dummy Ethernet header before each packet. Specify the L3PID
  261. for the Ethernet header in hex. Use this option if your dump has Layer
  262. 3 header and payload (e.g. IP header), but no Layer 2
  263. encapsulation. Example: <em>-e 0x806</em> to specify an ARP packet.</p>
  264. </div>
  265. <div class="paragraph">
  266. <p>For IP packets, instead of generating a fake Ethernet header you can
  267. also use <em>-E rawip</em> or <em>-l 101</em> to indicate raw IP encapsulation.
  268. Note that raw IP encapsulation does not work for any non-IP Layer 3 packet
  269. (e.g. ARP), whereas generating a dummy Ethernet header with <em>-e</em> works
  270. for any sort of L3 packet.</p>
  271. </div>
  272. </div>
  273. </div>
  274. </dd>
  275. <dt class="hdlist1">-E &lt;encapsulation type&gt;</dt>
  276. <dd>
  277. <div class="openblock">
  278. <div class="content">
  279. <div class="paragraph">
  280. <p>Sets the packet encapsulation type of the output capture file.
  281. <strong>text2pcap -E</strong> provides a list of the available types; note that not
  282. all file formats support all encapsulation types. The default type is
  283. ether (Ethernet).</p>
  284. </div>
  285. <div class="paragraph">
  286. <p><strong>NOTE:</strong> This sets the encapsulation type of the output file, but does
  287. not translate the packet headers or add additional headers. It is used
  288. to specify the encapsulation that matches the input data.</p>
  289. </div>
  290. </div>
  291. </div>
  292. </dd>
  293. <dt class="hdlist1">-F &lt;file format&gt;</dt>
  294. <dd>
  295. <div class="openblock">
  296. <div class="content">
  297. <div class="paragraph">
  298. <p>Sets the file format of the output capture file. <strong>Text2pcap</strong> can write
  299. the file in several formats; <strong>text2pcap -F</strong> provides a list of the
  300. available output formats. The default is the <strong>pcapng</strong> format.</p>
  301. </div>
  302. </div>
  303. </div>
  304. </dd>
  305. <dt class="hdlist1">-h</dt>
  306. <dd>
  307. <p>Displays a help message.</p>
  308. </dd>
  309. <dt class="hdlist1">-i &lt;proto&gt;</dt>
  310. <dd>
  311. <div class="openblock">
  312. <div class="content">
  313. <div class="paragraph">
  314. <p>Include dummy IP headers before each packet. Specify the IP protocol
  315. for the packet in decimal. Use this option if your dump is the payload
  316. of an IP packet (i.e. has complete L4 information) but does not have
  317. an IP header with each packet. Note that an appropriate Ethernet header
  318. is automatically included with each packet as well if the link-layer
  319. type is Ethernet.
  320. Example: <em>-i 46</em> to specify an RSVP packet (IP protocol 46). See
  321. <a href="https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml" class="bare">https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml</a> for
  322. the complete list of assigned internet protocol numbers.</p>
  323. </div>
  324. </div>
  325. </div>
  326. </dd>
  327. <dt class="hdlist1">-l &lt;typenum&gt;</dt>
  328. <dd>
  329. <div class="openblock">
  330. <div class="content">
  331. <div class="paragraph">
  332. <p>Sets the packet encapsulation type of the output capture file, using
  333. pcap link-layer header type numbers. Default is Ethernet (1).
  334. See <a href="https://www.tcpdump.org/linktypes.html" class="bare">https://www.tcpdump.org/linktypes.html</a> for the complete list
  335. of possible encapsulations.
  336. Example: <em>-l 7</em> for ARCNet packets encapsulated BSD-style.</p>
  337. </div>
  338. </div>
  339. </div>
  340. </dd>
  341. <dt class="hdlist1">-m &lt;max-packet&gt;</dt>
  342. <dd>
  343. <div class="openblock">
  344. <div class="content">
  345. <div class="paragraph">
  346. <p>Set the maximum packet length, default is 262144.
  347. Useful for testing various packet boundaries when only an application
  348. level datastream is available. Example:</p>
  349. </div>
  350. <div class="paragraph">
  351. <p><em>od -Ax -tx1 -v stream | text2pcap -m1460 -T1234,1234 - stream.pcap</em></p>
  352. </div>
  353. <div class="paragraph">
  354. <p>will convert from plain datastream format to a sequence of Ethernet
  355. TCP packets.</p>
  356. </div>
  357. </div>
  358. </div>
  359. </dd>
  360. <dt class="hdlist1">-N &lt;intf-name&gt;</dt>
  361. <dd>
  362. <p>Specify a name for the interface included when writing a pcapng format file.</p>
  363. </dd>
  364. <dt class="hdlist1">-o hex|oct|dec|none</dt>
  365. <dd>
  366. <div class="openblock">
  367. <div class="content">
  368. <div class="paragraph">
  369. <p>Specify the radix for the offsets (hex, octal, decimal, or none). Defaults to
  370. hex. This corresponds to the <code>-A</code> option for <em>od</em>. This parameter has no
  371. effect in regex mode.</p>
  372. </div>
  373. <div class="paragraph">
  374. <p><strong>NOTE:</strong> With <em>-o none</em>, only one packet will be created, ignoring any
  375. direction indicators or timestamps after the first byte along with any offsets.</p>
  376. </div>
  377. </div>
  378. </div>
  379. </dd>
  380. <dt class="hdlist1">-P &lt;dissector&gt;</dt>
  381. <dd>
  382. <div class="openblock">
  383. <div class="content">
  384. <div class="paragraph">
  385. <p>Include an EXPORTED_PDU header before each packet. Specify, as a
  386. string, the dissector to be called for the packet (DISSECTOR_NAME tag).
  387. Use this option if your dump is the payload for a single upper layer
  388. protocol (so specifying a link layer type would not work) and you wish
  389. to create a capture file without a full dummy protocol stack.
  390. Automatically sets the link layer type to Wireshark Upper PDU export.
  391. Without this option, if the Upper PDU export link layer type (252) is
  392. selected the dissector defaults to "data".</p>
  393. </div>
  394. </div>
  395. </div>
  396. </dd>
  397. <dt class="hdlist1">-q</dt>
  398. <dd>
  399. <p>Don&#8217;t display the summary of the options selected at the beginning, or the count of packets processed at the end.</p>
  400. </dd>
  401. <dt class="hdlist1">-r &lt;regex&gt;</dt>
  402. <dd>
  403. <div class="openblock">
  404. <div class="content">
  405. <div class="paragraph">
  406. <p>Process the file in regex mode using <em>regex</em> as described above.</p>
  407. </div>
  408. <div class="paragraph">
  409. <p><strong>NOTE:</strong> The regex mode uses memory-mapped I/O and does not work on
  410. streams that do not support seeking, like terminals and pipes.</p>
  411. </div>
  412. </div>
  413. </div>
  414. </dd>
  415. <dt class="hdlist1">-s &lt;srcport&gt;,&lt;destport&gt;,&lt;tag&gt;</dt>
  416. <dd>
  417. <div class="openblock">
  418. <div class="content">
  419. <div class="paragraph">
  420. <p>Include dummy SCTP headers before each packet. Specify, in decimal, the
  421. source and destination SCTP ports, and verification tag, for the packet.
  422. Use this option if your dump is the SCTP payload of a packet but does
  423. not include any SCTP, IP or Ethernet headers. Note that appropriate
  424. Ethernet and IP headers are automatically also included with each
  425. packet. A CRC32C checksum will be put into the SCTP header.</p>
  426. </div>
  427. </div>
  428. </div>
  429. </dd>
  430. <dt class="hdlist1">-S &lt;srcport&gt;,&lt;destport&gt;,&lt;ppi&gt;</dt>
  431. <dd>
  432. <div class="openblock">
  433. <div class="content">
  434. <div class="paragraph">
  435. <p>Include dummy SCTP headers before each packet. Specify, in decimal, the
  436. source and destination SCTP ports, and a verification tag of 0, for the
  437. packet, and prepend a dummy SCTP DATA chunk header with a payload
  438. protocol identifier if <em>ppi</em>. Use this option if your dump is the SCTP
  439. payload of a packet but does not include any SCTP, IP or Ethernet
  440. headers. Note that appropriate Ethernet and IP headers are
  441. automatically included with each packet. A CRC32C checksum will be put
  442. into the SCTP header.</p>
  443. </div>
  444. </div>
  445. </div>
  446. </dd>
  447. <dt class="hdlist1">-t &lt;timefmt&gt;</dt>
  448. <dd>
  449. <div class="openblock">
  450. <div class="content">
  451. <div class="paragraph">
  452. <p>Treats the text before the packet as a date/time code; <em>timefmt</em> is a
  453. format string supported by strftime(3), supplemented with the field
  454. descriptor '%f' for fractional seconds up to nanoseconds.
  455. Example: The time "10:15:14.5476" has the format code "%H:%M:%S.%f"
  456. The special format string <em>ISO</em> indicates that the string should be
  457. parsed according to the ISO-8601 specification. This parameter is used
  458. in regex mode if and only if the <code>&lt;time&gt;</code> capturing group is present.</p>
  459. </div>
  460. <div class="paragraph">
  461. <p><strong>NOTE:</strong> Date/time fields from the current date/time are
  462. used as the default for unspecified fields.</p>
  463. </div>
  464. </div>
  465. </div>
  466. </dd>
  467. <dt class="hdlist1">-T &lt;srcport&gt;,&lt;destport&gt;</dt>
  468. <dd>
  469. <div class="openblock">
  470. <div class="content">
  471. <div class="paragraph">
  472. <p>Include dummy TCP headers before each packet. Specify the source and
  473. destination TCP ports for the packet in decimal. Use this option if
  474. your dump is the TCP payload of a packet but does not include any TCP,
  475. IP or Ethernet headers. Note that appropriate Ethernet and IP headers
  476. are automatically also included with each packet.
  477. Sequence numbers will start at 0.</p>
  478. </div>
  479. </div>
  480. </div>
  481. </dd>
  482. <dt class="hdlist1">-u &lt;srcport&gt;,&lt;destport&gt;</dt>
  483. <dd>
  484. <div class="openblock">
  485. <div class="content">
  486. <div class="paragraph">
  487. <p>Include dummy UDP headers before each packet. Specify the source and
  488. destination UDP ports for the packet in decimal. Use this option if
  489. your dump is the UDP payload of a packet but does not include any UDP,
  490. IP or Ethernet headers. Note that appropriate Ethernet and IP headers
  491. are automatically also included with each packet.
  492. Example: <em>-u1000,69</em> to make the packets look like TFTP/UDP packets.</p>
  493. </div>
  494. </div>
  495. </div>
  496. </dd>
  497. <dt class="hdlist1">-v</dt>
  498. <dd>
  499. <p>Print the version and exit.</p>
  500. </dd>
  501. <dt class="hdlist1">-4 &lt;srcip&gt;,&lt;destip&gt;</dt>
  502. <dd>
  503. <div class="openblock">
  504. <div class="content">
  505. <div class="paragraph">
  506. <p>Prepend dummy IP header with specified IPv4 dest and source address.
  507. This option should be accompanied by one of the following options: -i, -s, -S, -T, -u
  508. Use this option to apply "custom" IP addresses.
  509. Example: <em>-4 10.0.0.1,10.0.0.2</em> to use 10.0.0.1 and 10.0.0.2 for all IP packets.</p>
  510. </div>
  511. </div>
  512. </div>
  513. </dd>
  514. <dt class="hdlist1">-6 &lt;srcip&gt;,&lt;destip&gt;</dt>
  515. <dd>
  516. <div class="openblock">
  517. <div class="content">
  518. <div class="paragraph">
  519. <p>Prepend dummy IP header with specified IPv6 dest and source address.
  520. This option should be accompanied by one of the following options: -i, -s, -S, -T, -u
  521. Use this option to apply "custom" IP addresses.
  522. Example: <em>-6 2001:db8::b3ff:fe1e:8329,2001:0db8:85a3::8a2e:0370:7334</em> to
  523. use 2001:db8::b3ff:fe1e:8329 and 2001:0db8:85a3::8a2e:0370:7334 for all IP packets.</p>
  524. </div>
  525. </div>
  526. </div>
  527. </dd>
  528. </dl>
  529. </div>
  530. </div>
  531. </div>
  532. <div class="sect1">
  533. <h2 id="_diagnostic_options">DIAGNOSTIC OPTIONS</h2>
  534. <div class="sectionbody">
  535. <div class="dlist">
  536. <dl>
  537. <dt class="hdlist1">--log-level &lt;level&gt;</dt>
  538. <dd>
  539. <p>Set the active log level.
  540. Supported levels in lowest to highest order are "noisy", "debug", "info", "message", "warning", "critical", and "error".
  541. Messages at each level and higher will be printed, for example "warning" prints "warning", "critical", and "error" messages and "noisy" prints all messages.
  542. Levels are case insensitive.</p>
  543. </dd>
  544. <dt class="hdlist1">--log-fatal &lt;level&gt;</dt>
  545. <dd>
  546. <p>Abort the program if any messages are logged at the specified level or higher.
  547. For example, "warning" aborts on any "warning", "critical", or "error" messages.</p>
  548. </dd>
  549. </dl>
  550. </div>
  551. <div class="dlist">
  552. <dl>
  553. <dt class="hdlist1">--log-domains &lt;list&gt;</dt>
  554. <dd>
  555. <p>Only print messages for the specified log domains, e.g. "GUI,Epan,sshdump".
  556. List of domains must be comma-separated.</p>
  557. </dd>
  558. <dt class="hdlist1">--log-debug &lt;list&gt;</dt>
  559. <dd>
  560. <p>Force the specified domains to log at the "debug" level.
  561. List of domains must be comma-separated.</p>
  562. </dd>
  563. <dt class="hdlist1">--log-noisy &lt;list&gt;</dt>
  564. <dd>
  565. <p>Force the specified domains to log at the "noisy" level.
  566. List of domains must be comma-separated.</p>
  567. </dd>
  568. <dt class="hdlist1">--log-file &lt;path&gt;</dt>
  569. <dd>
  570. <p>Write log messages and stderr output to the specified file.</p>
  571. </dd>
  572. </dl>
  573. </div>
  574. </div>
  575. </div>
  576. <div class="sect1">
  577. <h2 id="_see_also">SEE ALSO</h2>
  578. <div class="sectionbody">
  579. <div class="paragraph">
  580. <p>od(1), <a href="https://www.tcpdump.org/manpages/pcap.3pcap.html">pcap</a>(3), <a href="wireshark.html">wireshark</a>(1), <a href="tshark.html">tshark</a>(1), <a href="dumpcap.html">dumpcap</a>(1), <a href="mergecap.html">mergecap</a>(1),
  581. <a href="editcap.html">editcap</a>(1), strftime(3), <a href="https://www.tcpdump.org/manpages/pcap-filter.7.html">pcap-filter</a>(7) or <a href="https://www.tcpdump.org/manpages/tcpdump.1.html">tcpdump</a>(8)</p>
  582. </div>
  583. </div>
  584. </div>
  585. <div class="sect1">
  586. <h2 id="_notes">NOTES</h2>
  587. <div class="sectionbody">
  588. <div class="paragraph">
  589. <p>This is the manual page for <strong>Text2pcap</strong> 4.0.5.
  590. <strong>Text2pcap</strong> is part of the <strong>Wireshark</strong> distribution.
  591. The latest version of <strong>Wireshark</strong> can be found at <a href="https://www.wireshark.org" class="bare">https://www.wireshark.org</a>.</p>
  592. </div>
  593. </div>
  594. </div>
  595. <div class="sect1">
  596. <h2 id="_authors">AUTHORS</h2>
  597. <div class="sectionbody">
  598. <div class="paragraph">
  599. <div class="title">Original Author</div>
  600. <p>Ashok Narayanan &lt;ashokn[AT]cisco.com&gt;</p>
  601. </div>
  602. </div>
  603. </div>
  604. </div>
  605. </body>
  606. </html>