tcprewrite.1 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. .TH TCPREWRITE 1 2006-08-07 "" "Programmer's Manual"
  2. .\" DO NOT EDIT THIS FILE (tcprewrite.1)
  3. .\"
  4. .\" It has been AutoGen-ed Monday August 7, 2006 at 09:28:41 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. This option must appear in combination with the following options:
  127. cachefile.
  128. .sp
  129. Takes a pair of colon delimited IP addresses which will be used to rewrite
  130. all traffic to appear to be between the two IP's.
  131. Example:
  132. .nf
  133. --endpoints=172.16.0.1:172.16.0.2
  134. .fi
  135. .TP
  136. .BR -b ", " --skipbroadcast
  137. Skip rewriting broadcast/multicast IP's.
  138. .sp
  139. By default, --dmac, --smac, --seed, --pnat and --endpoints will rewrite
  140. broadcast and multicast IP and MAC addresses. Setting this flag
  141. will keep broadcast/multicast IP and MAC addresses from being rewritten.
  142. .TP
  143. .BR -C ", " --fixcsum
  144. Force recalculation of IP/TCP/UDP checksums.
  145. .sp
  146. Causes each IP packet to have it's checksums recalcualted and
  147. fixed. Automatically enabled for packets modified with \fB--seed\fP,
  148. \fB--pnat\fP, \fB--endpoints\fP or \fB--fixlen\fP.
  149. .TP
  150. .BR -m " \fInumber\fP, " --mtu "=" \fInumber\fP
  151. Override default MTU length (1500 bytes).
  152. This option may appear up to 1 times.
  153. This option takes an integer number as its argument.
  154. The value of \fInumber\fP is constrained to being:
  155. .in +4
  156. .nf
  157. .na
  158. in the range 1 through MAXPACKET
  159. .fi
  160. .in -4
  161. .sp
  162. Override the default 1500 byte MTU size for determining the maximum padding length.
  163. .TP
  164. .BR -F " \fIstring\fP, " --fixlen "=" \fIstring\fP
  165. Pad or truncate packet data to match header length.
  166. This option may appear up to 1 times.
  167. .sp
  168. Packets may be truncated during capture if the snaplen is smaller then the
  169. packet. This option allows you to modify the packet to pad the packet back
  170. out to the size stored in the IPv4 header or rewrite the IP header total length
  171. to reflect the stored packet length.
  172. .sp 1
  173. \fBpad\fP
  174. Truncated packets will be padded out so that the packet length matches the
  175. IPv4 total length
  176. .sp 1
  177. \fBtrunc\fP
  178. Truncated packets will have their IPv4 total length field rewritten to match
  179. the actual packet length
  180. .sp 1
  181. \fBdel\fP
  182. Delete the packet
  183. .TP
  184. .BR -T " \fIstring\fP, " --vlan "=" \fIstring\fP
  185. Specify 802.1q VLAN tag mode.
  186. This option may appear up to 1 times.
  187. .sp
  188. Allows you to rewrite ethernet frames to add a 802.1q header to standard 802.3
  189. ethernet headers or remove the 802.1q VLAN tag information.
  190. .sp 1
  191. \fBadd\fP
  192. Rewrites the existing 802.3 ethernet header as an 802.1q VLAN header
  193. .sp 1
  194. \fBdel\fP
  195. Rewrites the existing 802.1q VLAN header as an 802.3 ethernet header
  196. .TP
  197. .BR -t " \fInumber\fP, " --vlan-tag "=" \fInumber\fP
  198. Specify the new 802.1q VLAN tag value.
  199. This option may appear up to 1 times.
  200. This option must appear in combination with the following options:
  201. vlan.
  202. This option takes an integer number as its argument.
  203. The value of \fInumber\fP is constrained to being:
  204. .in +4
  205. .nf
  206. .na
  207. in the range 0 through 4095
  208. .fi
  209. .in -4
  210. .sp
  211. .TP
  212. .BR -f " \fInumber\fP, " --vlan-cfi "=" \fInumber\fP
  213. Specify the 802.1q VLAN CFI value.
  214. This option may appear up to 1 times.
  215. This option must appear in combination with the following options:
  216. vlan.
  217. This option takes an integer number as its argument.
  218. The value of \fInumber\fP is constrained to being:
  219. .in +4
  220. .nf
  221. .na
  222. in the range 0 through 1
  223. .fi
  224. .in -4
  225. .sp
  226. .TP
  227. .BR -p " \fInumber\fP, " --vlan-pri "=" \fInumber\fP
  228. Specify the 802.1q VLAN priority.
  229. This option may appear up to 1 times.
  230. This option must appear in combination with the following options:
  231. vlan.
  232. This option takes an integer number as its argument.
  233. The value of \fInumber\fP is constrained to being:
  234. .in +4
  235. .nf
  236. .na
  237. in the range 0 through 7
  238. .fi
  239. .in -4
  240. .sp
  241. .TP
  242. .BR -L " \fInumber\fP, " --dlt "=" \fInumber\fP
  243. Change DLT type for output pcap file.
  244. This option may appear up to 1 times.
  245. This option takes an integer number as its argument.
  246. The value of \fInumber\fP is constrained to being:
  247. .in +4
  248. .nf
  249. .na
  250. in the range 0 through 65535
  251. .fi
  252. .in -4
  253. .sp
  254. By default, tcprewrite uses the same DLT (data link type) for the
  255. output pcap as the input pcap. However, if you are changing the
  256. Layer 2 data with --dlink, then you probably also want to change the
  257. DLT type stored in the pcap. Common DLT types are:
  258. .sp 1
  259. \fB0\fP
  260. No Layer 2 header (DLT_NULL)
  261. .sp 1
  262. \fB1\fP
  263. Ethernet (DLT_EN10MB)
  264. .sp 1
  265. \fB10\fP
  266. FDDI (DLT_FDDI)
  267. .sp 1
  268. \fB12\fP
  269. BSD Raw header (DLT_RAW)
  270. .sp 1
  271. \fB104\fP
  272. Cisco HDLC (DLT_C_HDLC)
  273. .sp 1
  274. \fB113\fP
  275. Linux SLL pseudo-header (DLT_LINUX_SLL)
  276. For a full list of DLT types, see: src/common/dlt_names.h
  277. .TP
  278. .BR -d " \fInumber\fP, " --dbug "=" \fInumber\fP
  279. Enable debugging output.
  280. This option may appear up to 1 times.
  281. This option takes an integer number as its argument.
  282. The value of \fInumber\fP is constrained to being:
  283. .in +4
  284. .nf
  285. .na
  286. in the range 0 through 5
  287. .fi
  288. .in -4
  289. The default \fInumber\fP for this option is:
  290. .ti +4
  291. 0
  292. .sp
  293. If configured with --enable-debug, then you can specify a verbosity
  294. level for debugging output. Higher numbers increase verbosity.
  295. .TP
  296. .BR -i " \fIstring\fP, " --infile "=" \fIstring\fP
  297. Input pcap file to be processed.
  298. This option may appear up to 1 times.
  299. .sp
  300. .TP
  301. .BR -o " \fIstring\fP, " --outfile "=" \fIstring\fP
  302. Output pcap file.
  303. This option may appear up to 1 times.
  304. .sp
  305. .TP
  306. .BR -c " \fIstring\fP, " --cachefile "=" \fIstring\fP
  307. Split traffic via tcpprep cache file.
  308. This option may appear up to 1 times.
  309. .sp
  310. Use tcpprep cache file to split traffic based upon client/server relationships.
  311. .TP
  312. .BR -v ", " --verbose
  313. Print decoded packets via tcpdump to STDOUT.
  314. This option may appear up to 1 times.
  315. .sp
  316. .TP
  317. .BR -A " \fIstring\fP, " --decode "=" \fIstring\fP
  318. Arguments passed to tcpdump decoder.
  319. This option may appear up to 1 times.
  320. This option must appear in combination with the following options:
  321. verbose.
  322. .sp
  323. When enabling verbose mode (\fB-v\fP) you may also specify one or
  324. more additional arguments to pass to \fBtcpdump\fP to modify
  325. the way packets are decoded. By default, -n and -l are used.
  326. Be sure to quote the arguments so that they are not interpreted
  327. by tcprewrite. The following arguments are valid:
  328. [ -aAeNqRStuvxX ]
  329. [ -E spi@ipaddr algo:secret,... ]
  330. [ -s snaplen ]
  331. .TP
  332. .BR -V ", " --version
  333. Print version information.
  334. .sp
  335. .TP
  336. .BR -h ", " --less-help
  337. Display less usage information and exit.
  338. .sp
  339. .TP
  340. .BR \-H , " \--help"
  341. Display usage information and exit.
  342. .TP
  343. .BR \-! , " \--more-help"
  344. Extended usage information passed thru pager.
  345. .TP
  346. .BR \- " [\fIrcfile\fP]," " \--save-opts" "[=\fIrcfile\fP]"
  347. Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
  348. configuration file listed in the \fBOPTION PRESETS\fP section, below.
  349. .TP
  350. .BR \- " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " --no-load-opts"
  351. Load options from \fIrcfile\fP.
  352. The \fIno-load-opts\fP form will disable the loading
  353. of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
  354. out of order.
  355. .SH OPTION PRESETS
  356. Any option that is not marked as \fInot presettable\fP may be preset
  357. by loading values from configuration ("RC" or ".INI") file(s).
  358. The \fIhomerc\fP file is "\fI$$/\fP", unless that is a directory.
  359. In that case, the file "\fI.tcprewriterc\fP"
  360. is searched for within that directory.
  361. .SH "SEE ALSO"
  362. tcpdump(1), tcpprep(1), tcpreplay(1)
  363. .SH AUTHOR
  364. Copyright 2004-2005 Aaron Turner
  365. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  366. .PP
  367. Released under the Free BSD License.
  368. .PP
  369. This manual page was \fIAutoGen\fP-erated from the \fBtcprewrite\fP
  370. option definitions.