tcprewrite.1 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. .TH TCPREWRITE 1 2007-04-21 "(tcprewrite )" "Programmer's Manual"
  2. .\" DO NOT EDIT THIS FILE (tcprewrite.1)
  3. .\"
  4. .\" It has been AutoGen-ed Saturday April 21, 2007 at 10:41:05 AM 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 reading the following DLT types:
  23. .sp 1
  24. \fBDLT_C_HDLC\fP aka Cisco HDLC
  25. .sp 1
  26. \fBDLT_EN10MB\fP aka Ethernet
  27. .sp 1
  28. \fBDLT_LINUX_SLL\fP aka Linux Cooked Socket
  29. .sp 1
  30. \fBDLT_RAW\fP aka RAW IP
  31. .sp 1
  32. \fBDLT_NULL\fP aka BSD Loopback
  33. .sp 1
  34. \fBDLT_LOOP\fP aka OpenBSD Loopback
  35. Please see the \--dlt option for supported DLT types for writing.
  36. The packet editing features of tcprewrite which distinguish between "client"
  37. and "server" traffic requires a tcpprep(1) cache file.
  38. For more details, please see the Tcpreplay Manual at:
  39. http://tcpreplay.synfin.net/wiki/manual
  40. .SH OPTIONS
  41. .SS ""
  42. .TP
  43. .BR \-r " \fIstring\fP, " \--portmap "=" \fIstring\fP
  44. Rewrite TCP/UDP ports.
  45. This option may appear up to 1 times.
  46. .sp
  47. Specify a list of comma delimited port mappingings consisting of
  48. colon delimited port number pairs. Each colon delimited port pair
  49. consists of the port to match followed by the port number to rewrite.
  50. Example:
  51. .nf
  52. \--portmap=80:8000,8080:80
  53. .fi
  54. .TP
  55. .BR \-s " \fInumber\fP, " \--seed "=" \fInumber\fP
  56. Randomize src/dst IP addresses w/ given seed.
  57. This option may appear up to 1 times.
  58. This option takes an integer number as its argument.
  59. .sp
  60. Causes the source and destination IP addresses to be pseudo
  61. randomized but still maintain client/server relationships.
  62. Since the randomization is deterministic based on the seed,
  63. you can reuse the same seed value to recreate the traffic.
  64. .TP
  65. .BR \-N " \fIstring\fP, " \--pnat "=" \fIstring\fP
  66. Rewrite IP addresses using pseudo-NAT.
  67. This option may appear up to 2 times.
  68. .sp
  69. Takes a comma delimited series of colon delimited CIDR
  70. netblock pairs. Each netblock pair is evaluated in order against
  71. the IP addresses. If the IP address in the packet matches the
  72. first netblock, it is rewriten using the second netblock as a
  73. mask against the high order bits.
  74. Example:
  75. .nf
  76. \--pnat=192.168.0.0/16:10.77.0.0/16,172.16.0.0/12:10.1.0.0/24
  77. .fi
  78. .TP
  79. .BR \-e " \fIstring\fP, " \--endpoints "=" \fIstring\fP
  80. Rewrite IP addresses to be between two endpoints.
  81. This option may appear up to 1 times.
  82. This option must appear in combination with the following options:
  83. cachefile.
  84. .sp
  85. Takes a pair of colon delimited IP addresses which will be used to rewrite
  86. all traffic to appear to be between the two IP's.
  87. Example:
  88. .nf
  89. \--endpoints=172.16.0.1:172.16.0.2
  90. .fi
  91. .TP
  92. .BR \-b ", " \--skipbroadcast
  93. Skip rewriting broadcast/multicast IP's.
  94. .sp
  95. By default \--seed, \--pnat and \--endpoints will rewrite
  96. broadcast and multicast IP and MAC addresses. Setting this flag
  97. will keep broadcast/multicast IP and MAC addresses from being rewritten.
  98. .TP
  99. .BR \-C ", " \--fixcsum
  100. Force recalculation of IP/TCP/UDP checksums.
  101. .sp
  102. Causes each IP packet to have it's checksums recalcualted and
  103. fixed. Automatically enabled for packets modified with \fB--seed\fP,
  104. \fB--pnat\fP, \fB--endpoints\fP or \fB--fixlen\fP.
  105. .TP
  106. .BR \-m " \fInumber\fP, " \--mtu "=" \fInumber\fP
  107. Override default MTU length (1500 bytes).
  108. This option may appear up to 1 times.
  109. This option takes an integer number as its argument.
  110. The value of \fInumber\fP is constrained to being:
  111. .in +4
  112. .nf
  113. .na
  114. in the range 1 through MAXPACKET
  115. .fi
  116. .in -4
  117. .sp
  118. Override the default 1500 byte MTU size for determining the maximum padding length.
  119. .TP
  120. .BR \-E ", " \--efcs
  121. Remove Ethernet checksums (FCS) from end of frames.
  122. .sp
  123. Note, this option is pretty dangerous! We don't actually check to see if a FCS
  124. actually exists in the frame, we just blindly delete the last two bytes. Hence,
  125. you should only use this if you know know that your OS provides the FCS when
  126. reading raw packets.
  127. .TP
  128. .BR \-F " \fIstring\fP, " \--fixlen "=" \fIstring\fP
  129. Pad or truncate packet data to match header length.
  130. This option may appear up to 1 times.
  131. .sp
  132. Packets may be truncated during capture if the snaplen is smaller then the
  133. packet. This option allows you to modify the packet to pad the packet back
  134. out to the size stored in the IPv4 header or rewrite the IP header total length
  135. to reflect the stored packet length.
  136. .sp 1
  137. \fBpad\fP
  138. Truncated packets will be padded out so that the packet length matches the
  139. IPv4 total length
  140. .sp 1
  141. \fBtrunc\fP
  142. Truncated packets will have their IPv4 total length field rewritten to match
  143. the actual packet length
  144. .sp 1
  145. \fBdel\fP
  146. Delete the packet
  147. .TP
  148. .BR \--skipl2broadcast
  149. Skip rewriting broadcast/multicast Layer 2 addresses.
  150. .sp
  151. By default, editing Layer 2 addresses will rewrite
  152. broadcast and multicast MAC addresses. Setting this flag
  153. will keep broadcast/multicast MAC addresses from being rewritten.
  154. .TP
  155. .BR \--dlt "=\fIstring\fP"
  156. Override output DLT encapsulation.
  157. This option may appear up to 1 times.
  158. .sp
  159. By default, no DLT (data link type) conversion will be made.
  160. To change the DLT type of the output pcap, select one of the following values:
  161. .sp 1
  162. \fBenet\fP
  163. Ethernet aka DLT_EN10MB
  164. .sp 1
  165. \fBhdlc\fP
  166. Cisco HDLC aka DLT_C_HDLC
  167. .sp 1
  168. \fBuser\fP
  169. User specified Layer 2 header and DLT type
  170. .sp 1
  171. .br
  172. .TP
  173. .BR \--enet-dmac "=\fIstring\fP"
  174. Override destination ethernet MAC addresses.
  175. This option may appear up to 1 times.
  176. .sp
  177. Takes a pair of comma deliminated ethernet MAC addresses which
  178. will replace the destination MAC address of outbound packets.
  179. The first MAC address will be used for the server to client traffic
  180. and the optional second MAC address will be used for the client
  181. to server traffic.
  182. Example:
  183. .nf
  184. \--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66
  185. .fi
  186. .TP
  187. .BR \--enet-smac "=\fIstring\fP"
  188. Override source ethernet MAC addresses.
  189. This option may appear up to 1 times.
  190. .sp
  191. Takes a pair of comma deliminated ethernet MAC addresses which
  192. will replace the source MAC address of outbound packets.
  193. The first MAC address will be used for the server to client traffic
  194. and the optional second MAC address will be used for the client
  195. to server traffic.
  196. Example:
  197. .nf
  198. \--enet-smac=00:12:13:14:15:16,00:22:33:44:55:66
  199. .fi
  200. .TP
  201. .BR \--enet-vlan "=\fIstring\fP"
  202. Specify ethernet 802.1q VLAN tag mode.
  203. This option may appear up to 1 times.
  204. .sp
  205. Allows you to rewrite ethernet frames to add a 802.1q header to standard 802.3
  206. ethernet headers or remove the 802.1q VLAN tag information.
  207. .sp 1
  208. \fBadd\fP
  209. Rewrites the existing 802.3 ethernet header as an 802.1q VLAN header
  210. .sp 1
  211. \fBdel\fP
  212. Rewrites the existing 802.1q VLAN header as an 802.3 ethernet header
  213. .TP
  214. .BR \--enet-vlan-tag "=\fInumber\fP"
  215. Specify the new ethernet 802.1q VLAN tag value.
  216. This option may appear up to 1 times.
  217. This option must appear in combination with the following options:
  218. enet-vlan.
  219. This option takes an integer number as its argument.
  220. The value of \fInumber\fP is constrained to being:
  221. .in +4
  222. .nf
  223. .na
  224. in the range 0 through 4095
  225. .fi
  226. .in -4
  227. .sp
  228. .TP
  229. .BR \--enet-vlan-cfi "=\fInumber\fP"
  230. Specify the ethernet 802.1q VLAN CFI value.
  231. This option may appear up to 1 times.
  232. This option must appear in combination with the following options:
  233. enet-vlan.
  234. This option takes an integer number as its argument.
  235. The value of \fInumber\fP is constrained to being:
  236. .in +4
  237. .nf
  238. .na
  239. in the range 0 through 1
  240. .fi
  241. .in -4
  242. .sp
  243. .TP
  244. .BR \--enet-vlan-pri "=\fInumber\fP"
  245. Specify the ethernet 802.1q VLAN priority.
  246. This option may appear up to 1 times.
  247. This option must appear in combination with the following options:
  248. enet-vlan.
  249. This option takes an integer number as its argument.
  250. The value of \fInumber\fP is constrained to being:
  251. .in +4
  252. .nf
  253. .na
  254. in the range 0 through 7
  255. .fi
  256. .in -4
  257. .sp
  258. .TP
  259. .BR \--hdlc-control "=\fInumber\fP"
  260. Specify HDLC control value.
  261. This option may appear up to 1 times.
  262. This option takes an integer number as its argument.
  263. .sp
  264. The Cisco HDLC header has a 1 byte "control" field. Apparently this should
  265. always be 0, but if you can use any 1 byte value.
  266. .TP
  267. .BR \--hdlc-address "=\fInumber\fP"
  268. Specify HDLC address.
  269. This option may appear up to 1 times.
  270. This option takes an integer number as its argument.
  271. .sp
  272. The Cisco HDLC header has a 1 byte "address" field which has two valid
  273. values:
  274. .sp 1
  275. \fB0x0F\fP
  276. Unicast
  277. .sp 1
  278. \fB0xBF\fP
  279. Broadcast
  280. .br
  281. You can however specify any single byte value.
  282. .TP
  283. .BR \--user-dlt "=\fInumber\fP"
  284. Set output file DLT type.
  285. This option may appear up to 1 times.
  286. This option takes an integer number as its argument.
  287. .sp
  288. Set the DLT value of the output pcap file.
  289. .TP
  290. .BR \--user-dlink "=\fIstring\fP"
  291. Rewrite Data-Link layer with user specified data.
  292. This option may appear up to 2 times.
  293. .sp
  294. Provide a series of comma deliminated hex values which will be
  295. used to rewrite or create the Layer 2 header of the packets.
  296. The first instance of this argument will rewrite both server
  297. and client traffic, but if this argument is specified a second
  298. time, it will be used for the client traffic.
  299. Example:
  300. .nf
  301. \--user-dlink=01,02,03,04,05,06,00,1A,2B,3C,4D,5E,6F,08,00
  302. .fi
  303. .TP
  304. .BR \-d " \fInumber\fP, " \--dbug "=" \fInumber\fP
  305. Enable debugging output.
  306. This option may appear up to 1 times.
  307. This option takes an integer number as its argument.
  308. The value of \fInumber\fP is constrained to being:
  309. .in +4
  310. .nf
  311. .na
  312. in the range 0 through 5
  313. .fi
  314. .in -4
  315. The default \fInumber\fP for this option is:
  316. .ti +4
  317. 0
  318. .sp
  319. If configured with \--enable-debug, then you can specify a verbosity
  320. level for debugging output. Higher numbers increase verbosity.
  321. .TP
  322. .BR \-i " \fIstring\fP, " \--infile "=" \fIstring\fP
  323. Input pcap file to be processed.
  324. This option may appear up to 1 times.
  325. .sp
  326. .TP
  327. .BR \-o " \fIstring\fP, " \--outfile "=" \fIstring\fP
  328. Output pcap file.
  329. This option may appear up to 1 times.
  330. .sp
  331. .TP
  332. .BR \-c " \fIstring\fP, " \--cachefile "=" \fIstring\fP
  333. Split traffic via tcpprep cache file.
  334. This option may appear up to 1 times.
  335. .sp
  336. Use tcpprep cache file to split traffic based upon client/server relationships.
  337. .TP
  338. .BR \-v ", " \--verbose
  339. Print decoded packets via tcpdump to STDOUT.
  340. This option may appear up to 1 times.
  341. .sp
  342. .TP
  343. .BR \-A " \fIstring\fP, " \--decode "=" \fIstring\fP
  344. Arguments passed to tcpdump decoder.
  345. This option may appear up to 1 times.
  346. This option must appear in combination with the following options:
  347. verbose.
  348. .sp
  349. When enabling verbose mode (\fB-v\fP) you may also specify one or
  350. more additional arguments to pass to \fBtcpdump\fP to modify
  351. the way packets are decoded. By default, \-n and \-l are used.
  352. Be sure to quote the arguments so that they are not interpreted
  353. by tcprewrite. The following arguments are valid:
  354. [ \-aAeNqRStuvxX ]
  355. [ \-E spi@ipaddr algo:secret,... ]
  356. [ \-s snaplen ]
  357. .TP
  358. .BR \-V ", " \--version
  359. Print version information.
  360. .sp
  361. .TP
  362. .BR \-h ", " \--less-help
  363. Display less usage information and exit.
  364. .sp
  365. .TP
  366. .BR \-H , " \--help"
  367. Display usage information and exit.
  368. .TP
  369. .BR \-! , " \--more-help"
  370. Extended usage information passed thru pager.
  371. .TP
  372. .BR \- " [\fIrcfile\fP]," " \--save-opts" "[=\fIrcfile\fP]"
  373. Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
  374. configuration file listed in the \fBOPTION PRESETS\fP section, below.
  375. .TP
  376. .BR \- " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
  377. Load options from \fIrcfile\fP.
  378. The \fIno-load-opts\fP form will disable the loading
  379. of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
  380. out of order.
  381. .SH OPTION PRESETS
  382. Any option that is not marked as \fInot presettable\fP may be preset
  383. by loading values from configuration ("RC" or ".INI") file(s).
  384. The \fIhomerc\fP file is "\fI$$/\fP", unless that is a directory.
  385. In that case, the file "\fI.tcprewriterc\fP"
  386. is searched for within that directory.
  387. .SH "SEE ALSO"
  388. tcpdump(1), tcpprep(1), tcpreplay(1)
  389. .SH AUTHOR
  390. Copyright 2004-2007 Aaron Turner
  391. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  392. The latest version of this software is always available from:
  393. http://tcpreplay.synfin.net/
  394. .PP
  395. Released under the Free BSD License.
  396. .PP
  397. This manual page was \fIAutoGen\fP-erated from the \fBtcprewrite\fP
  398. option definitions.