tcprewrite.1 9.2 KB

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