tcprewrite.1 10 KB

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