tcprewrite.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <!--#exec cmd="header tcprewrite" -->
  2. <ul>
  3. </ul><H2>NAME </H2><ul>
  4. tcprewrite - Rewrite the packets in a pcap file.
  5. </ul><H2>SYNOPSIS </H2><ul>
  6. <b>tcprewrite</b>
  7. [<b>-<i>flag</i></b> [<i>value</i>]]... [<b>--<i>opt-name</i></b> [[=| ]<i>value</i>]]...
  8. <p>
  9. All arguments must be options.
  10. </ul><H2>DESCRIPTION </H2><ul>
  11. This manual page documents, briefly, the <b>tcprewrite</b> command.
  12. Tcprewrite is a tool to rewrite packets stored in <i>pcap(3)</i> file format, such
  13. as crated by tools such as <i>tcpdump(1)</i> and <i>ethereal(1)</i>. Once a pcap
  14. file has had it's packets rewritten, they can be replayed back out on the network
  15. using <i>tcpreplay(1)</i>.
  16. <p>tcprewrite currently supports the following DLT types:
  17. * DLT_C_HDLC
  18. * DLT_EN10MB
  19. * DLT_LINUX_SSL
  20. * DLT_RAW
  21. <p>The packet editing features of tcprewrite which distinguish between "client"
  22. and "server" traffic requires a tcpprep(1) cache file.
  23. </ul><H2>OPTIONS </H2><ul>
  24. <p><dl compact><dt><b>-d</b> <i>number</i>, <b>--dbug</b>=<b><i>number</i></b>
  25. <dd>Enable debugging output.
  26. This option may appear up to 1 times.
  27. The default <i>number</i> for this option is:
  28. </dl><br>
  29. 0
  30. <p>
  31. If configured with --enable-debug, then you can specify a verbosity
  32. level for debugging output. Higher numbers increase verbosity.
  33. <p><dl compact><dt><b>-D</b> <i>string</i>, <b>--dmac</b>=<b><i>string</i></b>
  34. <dd>Rewrite destination MAC addresses.
  35. This option may appear up to 1 times.
  36. </dl>
  37. <p>
  38. Takes a pair of comma deliminated ethernet MAC addresses which
  39. will replace the destination MAC address of outbound packets.
  40. The first MAC address will be used for the server traffic
  41. and the optional second MAC address will be used for the client
  42. traffic.
  43. <p>Example:
  44. <pre>
  45. --dmac 00:12:13:14:15:16,00:22:33:44:55:66
  46. <br></pre>
  47. <p><dl compact><dt><b>-S</b> <i>string</i>, <b>--smac</b>=<b><i>string</i></b>
  48. <dd>Rewrite source MAC addresses.
  49. This option may appear up to 1 times.
  50. </dl>
  51. <p>
  52. Takes a pair of comma deliminated ethernet MAC addresses which
  53. will replace the source MAC address of outbound packets.
  54. The first MAC address will be used for the server traffic
  55. and the optional second MAC address will be used for the client traffic.
  56. <p>Example:
  57. <pre>
  58. --smac 00:12:13:14:15:16,00:22:33:44:55:66
  59. <br></pre>
  60. <p><dl compact><dt><b>-P</b> <i>number</i>, <b>--proto</b>=<b><i>number</i></b>
  61. <dd>Override L2 protocol type for DLT_RAW.
  62. This option may appear up to 1 times.
  63. </dl>
  64. <p>
  65. By default, pcap files encapsulated using DLT_RAW will have their protocol
  66. set to ETHERTYPE_IP (0x0800).
  67. <p><dl compact><dt><b>-l</b> <i>string</i>, <b>--dlink</b>=<b><i>string</i></b>
  68. <dd>Rewrite Data-Link layer with specified data.
  69. This option may appear up to 2 times.
  70. </dl>
  71. <p>
  72. Provide a series of comma deliminated hex values which will be
  73. used to rewrite or create the Layer 2 header of the packets.
  74. The first instance of this argument will rewrite both server
  75. and client traffic, but if this argument is specified a second
  76. time, it will be used for the client traffic.
  77. <p>Example:
  78. <pre>
  79. --dlink 01,02,03,04,05,06,00,11,22,33,44,55,66,08,00
  80. <br></pre>
  81. <p><dl compact><dt><b>-r</b> <i>string</i>, <b>--portmap</b>=<b><i>string</i></b>
  82. <dd>Rewrite TCP/UDP ports.
  83. This option may appear up to 1 times.
  84. </dl>
  85. <p>
  86. Specify a list of comma delimited port mappingings consisting of
  87. colon delimited port number pairs. Each colon delimited port pair
  88. consists of the port to match followed by the port number to rewrite.
  89. <p>Example:
  90. <pre>
  91. --portmap 80:8000,8080:80
  92. <br></pre>
  93. <p><dl compact><dt><b>-s</b> <i>number</i>, <b>--seed</b>=<b><i>number</i></b>
  94. <dd>Randomize src/dst IP addresses w/ given seed.
  95. This option may appear up to 1 times.
  96. </dl>
  97. <p>
  98. Causes the source and destination IP addresses to be pseudo
  99. randomized but still maintain client/server relationships.
  100. Since the randomization is deterministic based on the seed,
  101. you can reuse the same seed value to recreate the traffic.
  102. <p><dl compact><dt><b>-N</b> <i>string</i>, <b>--pnat</b>=<b><i>string</i></b>
  103. <dd>Rewrite IP addresses using pseudo-NAT.
  104. This option may appear up to 2 times.
  105. </dl>
  106. <p>
  107. Takes a comma delimited series of colon delimited CIDR
  108. netblock pairs. Each netblock pair is evaluated in order against
  109. the IP addresses. If the IP address in the packet matches the
  110. first netblock, it is rewriten using the second netblock as a
  111. mask against the high order bits.
  112. <p>Example:
  113. <pre>
  114. --pnat 192.168.0.0/16:10.77.0.0/16,172.16.0.0/12:10.1.0.0/24
  115. <br></pre>
  116. <p><dl compact><dt><b>-e</b> <i>string</i>, <b>--endpoints</b>=<b><i>string</i></b>
  117. <dd>Rewrite IP addresses to be between two endpoints.
  118. This option may appear up to 1 times.
  119. </dl>
  120. <p>
  121. Takes a pair of colon delimited IP addresses which will be used to rewrite
  122. all traffic to appear to be between the two IP's.
  123. <p>Example:
  124. <pre>
  125. --endpoints 172.16.0.1:172.16.0.2
  126. <br></pre>
  127. <p><dl compact><dt><b>-C</b>, <b>--fixcsum</b>
  128. <dd>Force recalculation of IP/TCP/UDP checksums.
  129. </dl>
  130. <p>
  131. Causes each IP packet to have it's checksums recalcualted and
  132. fixed. Automatically enabled for packets modified with <b>--seed</b>,
  133. <b>--pnat</b>, <b>--endpoints</b> or <b>--fixlen</b>.
  134. <p><dl compact><dt><b>-i</b> <i>string</i>, <b>--infile</b>=<b><i>string</i></b>
  135. <dd>Input pcap file to be processed.
  136. This option may appear up to 1 times.
  137. </dl>
  138. <p>
  139. <p><p><dl compact><dt><b>-o</b> <i>string</i>, <b>--outfile</b>=<b><i>string</i></b>
  140. <dd>Output pcap file.
  141. This option may appear up to 1 times.
  142. </dl>
  143. <p>
  144. <p><p><dl compact><dt><b>-c</b> <i>string</i>, <b>--cachefile</b>=<b><i>string</i></b>
  145. <dd>Split traffic via tcpprep cache file.
  146. This option may appear up to 1 times.
  147. </dl>
  148. <p>
  149. Use tcpprep cache file to split traffic based upon client/server relationships.
  150. <p><dl compact><dt><b>-m</b> <i>number</i>, <b>--mtu</b>=<b><i>number</i></b>
  151. <dd>Override default MTU length (1500 bytes).
  152. This option may appear up to 1 times.
  153. </dl>
  154. <p>
  155. Override the default 1500 byte MTU size for determining the maximum padding length.
  156. <p><dl compact><dt><b>-E</b>, <b>--efcs</b>
  157. <dd>Remove Ethernet checksums (FCS) from end of frames.
  158. </dl>
  159. <p>
  160. <p><p><dl compact><dt><b>-F</b> <i>string</i>, <b>--fixlen</b>=<b><i>string</i></b>
  161. <dd>Pad or truncate packet data to match header length.
  162. This option may appear up to 1 times.
  163. </dl>
  164. <p>
  165. Packets may be truncated during capture if the snaplen is smaller then the
  166. packet. This option allows you to modify the packet to pad the packet back
  167. out to the size stored in the IPv4 header or rewrite the IP header total length
  168. to reflect the stored packet length.
  169. <p>
  170. <b>pad</b>
  171. Truncated packets will be padded out so that the packet length matches the
  172. IPv4 total length
  173. <p>
  174. <b>trunc</b>
  175. Truncated packets will have their IPv4 total length field rewritten to match
  176. the actual packet length
  177. <p><dl compact><dt><b>-T</b> <i>string</i>, <b>--vlan</b>=<b><i>string</i></b>
  178. <dd>Specify 802.1q VLAN tag mode.
  179. This option may appear up to 1 times.
  180. </dl>
  181. <p>
  182. Allows you to rewrite ethernet frames to add a 802.1q header to standard 802.3
  183. ethernet headers or remove the 802.1q VLAN tag information.
  184. <p>
  185. <b>add</b>
  186. Rewrites the existing 802.3 ethernet header as an 802.1q VLAN header
  187. <p>
  188. <b>del</b>
  189. Rewrites the existing 802.1q VLAN header as an 802.3 ethernet header
  190. <p><dl compact><dt><b>-t</b> <i>number</i>, <b>--vlan-tag</b>=<b><i>number</i></b>
  191. <dd>Specify the new 802.1q VLAN tag value.
  192. This option may appear up to 1 times.
  193. This option must appear in combination with the following options:
  194. vlan.
  195. </dl>
  196. <p>
  197. <p><p><dl compact><dt><b>-c</b> <i>number</i>, <b>--vlan-cfi</b>=<b><i>number</i></b>
  198. <dd>Specify the 802.1q VLAN CFI value.
  199. This option may appear up to 1 times.
  200. This option must appear in combination with the following options:
  201. vlan.
  202. </dl>
  203. <p>
  204. <p><p><dl compact><dt><b>-p</b> <i>number</i>, <b>--vlan-pri</b>=<b><i>number</i></b>
  205. <dd>Specify the 802.1q VLAN priority.
  206. This option may appear up to 1 times.
  207. This option must appear in combination with the following options:
  208. vlan.
  209. </dl>
  210. <p>
  211. <p><p><dl compact><dt><b>-v</b>, <b>--verbose</b>
  212. <dd>Print decoded packets via tcpdump to STDOUT.
  213. This option may appear up to 1 times.
  214. </dl>
  215. <p>
  216. <p><p><dl compact><dt><b>-A</b> <i>string</i>, <b>--decode</b>=<b><i>string</i></b>
  217. <dd>Arguments passed to tcpdump decoder.
  218. This option may appear up to 1 times.
  219. This option must appear in combination with the following options:
  220. verbose.
  221. </dl>
  222. <p>
  223. When enabling verbose mode (<b>-v</b>) you may also specify one or
  224. more additional arguments to pass to <b>tcpdump</b> to modify
  225. the way packets are decoded. By default, -n and -l are used.
  226. Be sure to quote the arguments so that they are not interpreted
  227. by tcprewrite. The following arguments are valid:
  228. [ -aAeNqRStuvxX ]
  229. [ -E spi@ipaddr algo:secret,... ]
  230. [ -s snaplen ]
  231. <p><dl compact><dt><b>-V</b>, <b>--version</b>
  232. <dd>Print version information.
  233. </dl>
  234. <p>
  235. <p><p><dl compact><dt><b>-h</b>, <b>--less-help</b>
  236. <dd>Display less usage information and exit.
  237. </dl>
  238. <p>
  239. <p><p><dl compact><dt><b>-H</b>,<b> --help</b>
  240. <dd>Display usage information and exit.
  241. <dt><b>-!</b>,<b> --more-help</b>
  242. <dd>Extended usage information passed thru pager.
  243. <dt><b>-</b> [<i>rcfile</i>],<b> --save-opts</b>[=<i>rcfile</i>]
  244. <dd>Save the option state to <i>rcfile</i>. The default is the <i>last</i>
  245. configuration file listed in the <b>OPTION PRESETS</b> section, below.
  246. <dt><b>-</b> <i>rcfile</i>,<b> --load-opts</b>=<i>rcfile</i>,<b> --no-load-opts</b>
  247. <dd>Load options from <i>rcfile</i>.
  248. The <i>no-load-opts</i> form will disable the loading
  249. of earlier RC/INI files. <i>--no-load-opts</i> is handled early,
  250. out of order.
  251. </dl>
  252. </ul><H2>OPTION PRESETS </H2><ul>
  253. Any option that is not marked as <i>not presettable</i> may be preset
  254. by loading values from configuration ("RC" or ".INI") file(s).
  255. The <i>homerc</i> file is "<i>$$/</i>", unless that is a directory.
  256. In that case, the file "<i>.tcprewriterc</i>"
  257. is searched for within that directory.
  258. </ul><H2>SEE ALSO </H2><ul>
  259. tcpdump(1), tcpprep(1), tcpreplay(1)
  260. </ul><H2>AUTHOR </H2><ul>
  261. Copyright 2004-2005 Aaron Turner
  262. <p>For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  263. <p>
  264. Released under the Free BSD License.
  265. <p>
  266. This manual page was <i>AutoGen</i>-erated from the <b>tcprewrite</b>
  267. option definitions.
  268. </ul>
  269. <!--#exec cmd="trailer" -->