tcprewrite.1 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. .TH TCPREWRITE 1 2010-04-04 "(tcprewrite )" "Programmer's Manual"
  2. .\" DO NOT EDIT THIS FILE (tcprewrite.1)
  3. .\"
  4. .\" It has been AutoGen-ed April 4, 2010 at 05:59:20 PM by AutoGen 5.9.9
  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 briefly documents 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. .sp 1
  36. \fBDLT_IEEE802_11\fP aka 802.11a/b/g
  37. .sp 1
  38. \fBDLT_IEEE802_11_RADIO\fP aka 802.11a/b/g with Radiotap headers
  39. Please see the \--dlt option for supported DLT types for writing.
  40. The packet editing features of tcprewrite which distinguish between "client"
  41. and "server" traffic requires a tcpprep(1) cache file.
  42. For more details, please see the Tcpreplay Manual at:
  43. http://tcpreplay.synfin.net/trac/wiki/manual
  44. .SH OPTIONS
  45. .SS ""
  46. .TP
  47. .BR \-r " \fIstring\fP, " \--portmap "=" \fIstring\fP
  48. Rewrite TCP/UDP ports.
  49. This option may appear up to \-1 times.
  50. .sp
  51. Specify a list of comma delimited port mappingings consisting of
  52. colon delimited port number pairs. Each colon delimited port pair
  53. consists of the port to match followed by the port number to rewrite.
  54. Examples:
  55. .nf
  56. \--portmap=80:8000 \--portmap=8080:80 # 80->8000 and 8080->80
  57. \--portmap=8000,8080,88888:80 # 3 different ports become 80
  58. \--portmap=8000-8999:80 # ports 8000 to 8999 become 80
  59. .fi
  60. .TP
  61. .BR \-s " \fInumber\fP, " \--seed "=" \fInumber\fP
  62. Randomize src/dst IPv4/v6 addresses w/ given seed.
  63. This option may appear up to 1 times.
  64. This option takes an integer number as its argument.
  65. .sp
  66. Causes the source and destination IPv4/v6 addresses to be pseudo
  67. randomized but still maintain client/server relationships.
  68. Since the randomization is deterministic based on the seed,
  69. you can reuse the same seed value to recreate the traffic.
  70. .TP
  71. .BR \-N " \fIstring\fP, " \--pnat "=" \fIstring\fP
  72. Rewrite IPv4/v6 addresses using pseudo-NAT.
  73. This option may appear up to 2 times.
  74. This option must not appear in combination with any of the following options:
  75. srcipmap.
  76. .sp
  77. Takes a comma delimited series of colon delimited CIDR
  78. netblock pairs. Each netblock pair is evaluated in order against
  79. the IP addresses. If the IP address in the packet matches the
  80. first netblock, it is rewriten using the second netblock as a
  81. mask against the high order bits.
  82. IPv4 Example:
  83. .nf
  84. \--pnat=192.168.0.0/16:10.77.0.0/16,172.16.0.0/12:10.1.0.0/24
  85. .fi
  86. IPv6 Example:
  87. .nf
  88. \--pnat=[2001:db8::/32]:[dead::/16],[2001:db8::/32]:[::ffff:0:0/96]
  89. .fi
  90. .TP
  91. .BR \-S " \fIstring\fP, " \--srcipmap "=" \fIstring\fP
  92. Rewrite source IPv4/v6 addresses using pseudo-NAT.
  93. This option may appear up to 1 times.
  94. This option must not appear in combination with any of the following options:
  95. pnat.
  96. .sp
  97. Works just like the \--pnat option, but only affects the source IP
  98. addresses in the IPv4/v6 header.
  99. .TP
  100. .BR \-D " \fIstring\fP, " \--dstipmap "=" \fIstring\fP
  101. Rewrite destination IPv4/v6 addresses using pseudo-NAT.
  102. This option may appear up to 1 times.
  103. This option must not appear in combination with any of the following options:
  104. pnat.
  105. .sp
  106. Works just like the \--pnat option, but only affects the destination IP
  107. addresses in the IPv4/v6 header.
  108. .TP
  109. .BR \-e " \fIstring\fP, " \--endpoints "=" \fIstring\fP
  110. Rewrite IP addresses to be between two endpoints.
  111. This option may appear up to 1 times.
  112. This option must appear in combination with the following options:
  113. cachefile.
  114. .sp
  115. Takes a pair of colon delimited IPv4/v6 addresses which will be used to rewrite
  116. all traffic to appear to be between the two IP's.
  117. IPv4 Example:
  118. .nf
  119. \--endpoints=172.16.0.1:172.16.0.2
  120. .fi
  121. IPv6 Example:
  122. .nf
  123. \--endpoints=[2001:db8::dead:beef]:[::ffff:0:0:ac:f:0:2]
  124. .fi
  125. .TP
  126. .BR \-b ", " \--skipbroadcast
  127. Skip rewriting broadcast/multicast IPv4/v6 addresses.
  128. .sp
  129. By default \--seed, \--pnat and \--endpoints will rewrite
  130. broadcast and multicast IPv4/v6 and MAC addresses. Setting this flag
  131. will keep broadcast/multicast IPv4/v6 and MAC addresses from being rewritten.
  132. .TP
  133. .BR \-C ", " \--fixcsum
  134. Force recalculation of IPv4/TCP/UDP header checksums.
  135. .sp
  136. Causes each IPv4/v6 packet to have it's checksums recalcualted and
  137. fixed. Automatically enabled for packets modified with \fB--seed\fP,
  138. \fB--pnat\fP, \fB--endpoints\fP or \fB--fixlen\fP.
  139. .TP
  140. .BR \-m " \fInumber\fP, " \--mtu "=" \fInumber\fP
  141. Override default MTU length (1500 bytes).
  142. This option may appear up to 1 times.
  143. This option takes an integer number as its argument.
  144. The value of \fInumber\fP is constrained to being:
  145. .in +4
  146. .nf
  147. .na
  148. in the range 1 through MAXPACKET
  149. .fi
  150. .in -4
  151. .sp
  152. Override the default 1500 byte MTU size for determining the maximum padding length
  153. (--fixlen=pad) or when truncating (--mtu-trunc).
  154. .TP
  155. .BR \--mtu-trunc
  156. Truncate packets larger then specified MTU.
  157. This option may appear up to 1 times.
  158. .sp
  159. Similar to \--fixlen, this option will truncate data in packets from Layer 3 and above to be
  160. no larger then the MTU.
  161. .TP
  162. .BR \-E ", " \--efcs
  163. Remove Ethernet checksums (FCS) from end of frames.
  164. .sp
  165. Note, this option is pretty dangerous! We don't actually check to see if a FCS
  166. actually exists in the frame, we just blindly delete the last two bytes. Hence,
  167. you should only use this if you know know that your OS provides the FCS when
  168. reading raw packets.
  169. .TP
  170. .BR \--ttl "=\fIstring\fP"
  171. Modify the IPv4/v6 TTL/Hop Limit.
  172. .sp
  173. Allows you to modify the TTL/Hop Limit of all the IPv4/v6 packets. Specify a number to hard-code
  174. the value or +/-value to increase or decrease by the value provided (limited to 1-255).
  175. Examples:
  176. .nf
  177. \--ttl=10
  178. \--ttl=+7
  179. \--ttl=-64
  180. .fi
  181. .TP
  182. .BR \--tos "=\fInumber\fP"
  183. Set the IPv4 TOS/DiffServ/ECN byte.
  184. This option may appear up to 1 times.
  185. This option takes an integer number as its argument.
  186. The value of \fInumber\fP is constrained to being:
  187. .in +4
  188. .nf
  189. .na
  190. in the range 0 through 255
  191. .fi
  192. .in -4
  193. .sp
  194. Allows you to override the TOS (also known as DiffServ/ECN) value in IPv4.
  195. .TP
  196. .BR \--tclass "=\fInumber\fP"
  197. Set the IPv6 Traffic Class byte.
  198. This option may appear up to 1 times.
  199. This option takes an integer number as its argument.
  200. The value of \fInumber\fP is constrained to being:
  201. .in +4
  202. .nf
  203. .na
  204. in the range 0 through 255
  205. .fi
  206. .in -4
  207. .sp
  208. Allows you to override the IPv6 Traffic Class field.
  209. .TP
  210. .BR \--flowlabel "=\fInumber\fP"
  211. Set the IPv6 Flow Label.
  212. This option may appear up to 1 times.
  213. This option takes an integer number as its argument.
  214. The value of \fInumber\fP is constrained to being:
  215. .in +4
  216. .nf
  217. .na
  218. in the range 0 through 1048575
  219. .fi
  220. .in -4
  221. .sp
  222. Allows you to override the 20bit IPv6 Flow Label field. Has no effect on IPv4
  223. packets.
  224. .TP
  225. .BR \-F " \fIstring\fP, " \--fixlen "=" \fIstring\fP
  226. Pad or truncate packet data to match header length.
  227. This option may appear up to 1 times.
  228. .sp
  229. Packets may be truncated during capture if the snaplen is smaller then the
  230. packet. This option allows you to modify the packet to pad the packet back
  231. out to the size stored in the IPv4/v6 header or rewrite the IP header total length
  232. to reflect the stored packet length.
  233. .sp 1
  234. \fBpad\fP
  235. Truncated packets will be padded out so that the packet length matches the
  236. IPv4 total length
  237. .sp 1
  238. \fBtrunc\fP
  239. Truncated packets will have their IPv4 total length field rewritten to match
  240. the actual packet length
  241. .sp 1
  242. \fBdel\fP
  243. Delete the packet
  244. .TP
  245. .BR \--skipl2broadcast
  246. Skip rewriting broadcast/multicast Layer 2 addresses.
  247. .sp
  248. By default, editing Layer 2 addresses will rewrite
  249. broadcast and multicast MAC addresses. Setting this flag
  250. will keep broadcast/multicast MAC addresses from being rewritten.
  251. .TP
  252. .BR \--dlt "=\fIstring\fP"
  253. Override output DLT encapsulation.
  254. This option may appear up to 1 times.
  255. .sp
  256. By default, no DLT (data link type) conversion will be made.
  257. To change the DLT type of the output pcap, select one of the following values:
  258. .sp 1
  259. \fBenet\fP
  260. Ethernet aka DLT_EN10MB
  261. .sp 1
  262. \fBhdlc\fP
  263. Cisco HDLC aka DLT_C_HDLC
  264. .sp 1
  265. \fBuser\fP
  266. User specified Layer 2 header and DLT type
  267. .br
  268. .TP
  269. .BR \--enet-dmac "=\fIstring\fP"
  270. Override destination ethernet MAC addresses.
  271. This option may appear up to 1 times.
  272. .sp
  273. Takes a pair of comma deliminated ethernet MAC addresses which
  274. will replace the destination MAC address of outbound packets.
  275. The first MAC address will be used for the server to client traffic
  276. and the optional second MAC address will be used for the client
  277. to server traffic.
  278. Example:
  279. .nf
  280. \--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66
  281. .fi
  282. .TP
  283. .BR \--enet-smac "=\fIstring\fP"
  284. Override source ethernet MAC addresses.
  285. This option may appear up to 1 times.
  286. .sp
  287. Takes a pair of comma deliminated ethernet MAC addresses which
  288. will replace the source MAC address of outbound packets.
  289. The first MAC address will be used for the server to client traffic
  290. and the optional second MAC address will be used for the client
  291. to server traffic.
  292. Example:
  293. .nf
  294. \--enet-smac=00:12:13:14:15:16,00:22:33:44:55:66
  295. .fi
  296. .TP
  297. .BR \--enet-vlan "=\fIstring\fP"
  298. Specify ethernet 802.1q VLAN tag mode.
  299. This option may appear up to 1 times.
  300. .sp
  301. Allows you to rewrite ethernet frames to add a 802.1q header to standard 802.3
  302. ethernet headers or remove the 802.1q VLAN tag information.
  303. .sp 1
  304. \fBadd\fP
  305. Rewrites the existing 802.3 ethernet header as an 802.1q VLAN header
  306. .sp 1
  307. \fBdel\fP
  308. Rewrites the existing 802.1q VLAN header as an 802.3 ethernet header
  309. .TP
  310. .BR \--enet-vlan-tag "=\fInumber\fP"
  311. Specify the new ethernet 802.1q VLAN tag value.
  312. This option may appear up to 1 times.
  313. This option must appear in combination with the following options:
  314. enet-vlan.
  315. This option takes an integer number as its argument.
  316. The value of \fInumber\fP is constrained to being:
  317. .in +4
  318. .nf
  319. .na
  320. in the range 0 through 4095
  321. .fi
  322. .in -4
  323. .sp
  324. .TP
  325. .BR \--enet-vlan-cfi "=\fInumber\fP"
  326. Specify the ethernet 802.1q VLAN CFI value.
  327. This option may appear up to 1 times.
  328. This option must appear in combination with the following options:
  329. enet-vlan.
  330. This option takes an integer number as its argument.
  331. The value of \fInumber\fP is constrained to being:
  332. .in +4
  333. .nf
  334. .na
  335. in the range 0 through 1
  336. .fi
  337. .in -4
  338. .sp
  339. .TP
  340. .BR \--enet-vlan-pri "=\fInumber\fP"
  341. Specify the ethernet 802.1q VLAN priority.
  342. This option may appear up to 1 times.
  343. This option must appear in combination with the following options:
  344. enet-vlan.
  345. This option takes an integer number as its argument.
  346. The value of \fInumber\fP is constrained to being:
  347. .in +4
  348. .nf
  349. .na
  350. in the range 0 through 7
  351. .fi
  352. .in -4
  353. .sp
  354. .TP
  355. .BR \--hdlc-control "=\fInumber\fP"
  356. Specify HDLC control value.
  357. This option may appear up to 1 times.
  358. This option takes an integer number as its argument.
  359. .sp
  360. The Cisco HDLC header has a 1 byte "control" field. Apparently this should
  361. always be 0, but if you can use any 1 byte value.
  362. .TP
  363. .BR \--hdlc-address "=\fInumber\fP"
  364. Specify HDLC address.
  365. This option may appear up to 1 times.
  366. This option takes an integer number as its argument.
  367. .sp
  368. The Cisco HDLC header has a 1 byte "address" field which has two valid
  369. values:
  370. .sp 1
  371. \fB0x0F\fP
  372. Unicast
  373. .sp 1
  374. \fB0xBF\fP
  375. Broadcast
  376. .br
  377. You can however specify any single byte value.
  378. .TP
  379. .BR \--user-dlt "=\fInumber\fP"
  380. Set output file DLT type.
  381. This option may appear up to 1 times.
  382. This option takes an integer number as its argument.
  383. .sp
  384. Set the DLT value of the output pcap file.
  385. .TP
  386. .BR \--user-dlink "=\fIstring\fP"
  387. Rewrite Data-Link layer with user specified data.
  388. This option may appear up to 2 times.
  389. .sp
  390. Provide a series of comma deliminated hex values which will be
  391. used to rewrite or create the Layer 2 header of the packets.
  392. The first instance of this argument will rewrite both server
  393. and client traffic, but if this argument is specified a second
  394. time, it will be used for the client traffic.
  395. Example:
  396. .nf
  397. \--user-dlink=01,02,03,04,05,06,00,1A,2B,3C,4D,5E,6F,08,00
  398. .fi
  399. .TP
  400. .BR \-d " \fInumber\fP, " \--dbug "=" \fInumber\fP
  401. Enable debugging output.
  402. This option may appear up to 1 times.
  403. This option takes an integer number as its argument.
  404. The value of \fInumber\fP is constrained to being:
  405. .in +4
  406. .nf
  407. .na
  408. in the range 0 through 5
  409. .fi
  410. .in -4
  411. The default \fInumber\fP for this option is:
  412. .ti +4
  413. 0
  414. .sp
  415. If configured with \--enable-debug, then you can specify a verbosity
  416. level for debugging output. Higher numbers increase verbosity.
  417. .TP
  418. .BR \-i " \fIstring\fP, " \--infile "=" \fIstring\fP
  419. Input pcap file to be processed.
  420. This option may appear up to 1 times.
  421. .sp
  422. .TP
  423. .BR \-o " \fIstring\fP, " \--outfile "=" \fIstring\fP
  424. Output pcap file.
  425. This option may appear up to 1 times.
  426. .sp
  427. .TP
  428. .BR \-c " \fIstring\fP, " \--cachefile "=" \fIstring\fP
  429. Split traffic via tcpprep cache file.
  430. This option may appear up to 1 times.
  431. .sp
  432. Use tcpprep cache file to split traffic based upon client/server relationships.
  433. .TP
  434. .BR \-v ", " \--verbose
  435. Print decoded packets via tcpdump to STDOUT.
  436. This option may appear up to 1 times.
  437. .sp
  438. .TP
  439. .BR \-A " \fIstring\fP, " \--decode "=" \fIstring\fP
  440. Arguments passed to tcpdump decoder.
  441. This option may appear up to 1 times.
  442. This option must appear in combination with the following options:
  443. verbose.
  444. .sp
  445. When enabling verbose mode (\fB-v\fP) you may also specify one or
  446. more additional arguments to pass to \fBtcpdump\fP to modify
  447. the way packets are decoded. By default, \-n and \-l are used.
  448. Be sure to quote the arguments so that they are not interpreted
  449. by tcprewrite. Please see the tcpdump(1) man page for a complete list of
  450. options.
  451. .TP
  452. .BR \--fragroute "=\fIstring\fP"
  453. Parse fragroute configuration file.
  454. This option may appear up to 1 times.
  455. .sp
  456. Enable advanced evasion techniques using the built-in fragroute(8)
  457. engine. See the fragroute(8) man page for more details. Important:
  458. tcprewrite does not support the delay, echo or print commands.
  459. .TP
  460. .BR \--fragdir "=\fIstring\fP"
  461. Which flows to apply fragroute to: c2s, s2c, both.
  462. This option may appear up to 1 times.
  463. This option must appear in combination with the following options:
  464. cachefile.
  465. .sp
  466. Apply the fragroute engine to packets going c2s, s2c or both when
  467. using a cache file.
  468. .TP
  469. .BR \--skip-soft-errors
  470. Skip writing packets with soft errors.
  471. This option may appear up to 1 times.
  472. .sp
  473. In some cases, packets can't be decoded or the requested editing
  474. is not possible. Normally these packets are written to the output
  475. file unedited so that tcpprep cache files can still be used, but if
  476. you wish, these packets can be suppressed.
  477. One example of this is 802.11 management frames which contain no data.
  478. .TP
  479. .BR \-V ", " \--version
  480. Print version information.
  481. .sp
  482. .TP
  483. .BR \-h ", " \--less-help
  484. Display less usage information and exit.
  485. .sp
  486. .TP
  487. .BR \-H , " \--help"
  488. Display usage information and exit.
  489. .TP
  490. .BR \-! , " \--more-help"
  491. Extended usage information passed thru pager.
  492. .TP
  493. .BR \- " [\fIrcfile\fP]," " \--save-opts" "[=\fIrcfile\fP]"
  494. Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
  495. configuration file listed in the \fBOPTION PRESETS\fP section, below.
  496. .TP
  497. .BR \- " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
  498. Load options from \fIrcfile\fP.
  499. The \fIno-load-opts\fP form will disable the loading
  500. of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
  501. out of order.
  502. .SH OPTION PRESETS
  503. Any option that is not marked as \fInot presettable\fP may be preset
  504. by loading values from configuration ("RC" or ".INI") file(s).
  505. The \fIhomerc\fP file is "\fI$$/\fP", unless that is a directory.
  506. In that case, the file "\fI.tcprewriterc\fP"
  507. is searched for within that directory.
  508. .SH "SEE ALSO"
  509. tcpdump(1), tcpprep(1), tcpreplay(1)
  510. .SH AUTHOR
  511. Copyright 2000-2010 Aaron Turner
  512. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  513. The latest version of this software is always available from:
  514. http://tcpreplay.synfin.net/
  515. .PP
  516. Released under the Free BSD License.
  517. .PP
  518. This manual page was \fIAutoGen\fP-erated from the \fBtcprewrite\fP
  519. option definitions.