tcpprep.1 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. .TH TCPPREP 1 2009-06-25 "(tcpprep )" "Programmer's Manual"
  2. .\" DO NOT EDIT THIS FILE (tcpprep.1)
  3. .\"
  4. .\" It has been AutoGen-ed Thursday June 25, 2009 at 12:25:11 PM PDT
  5. .\" From the definitions tcpprep_opts.def
  6. .\" and the template file agman1.tpl
  7. .\"
  8. .SH NAME
  9. tcpprep \- Create a tcpreplay cache cache file from a pcap file.
  10. .SH SYNOPSIS
  11. .B tcpprep
  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. .PP
  17. tcpprep is a \fIpcap(3)\fP file pre-processor which creates a cache
  18. file which provides "rules" for \fItcprewrite(1)\fP and \fItcpreplay(1)\fP
  19. on how to process and send packets.
  20. .SH "DESCRIPTION"
  21. This manual page briefly documents the \fBtcpprep\fP command.
  22. The basic operation of tcpreplay is to resend all packets from the
  23. input file(s) out a single file. Tcpprep processes a pcap file and
  24. applies a set of user-specified rules to create a cache file which
  25. tells tcpreplay wether or not to send each packet and which interface the
  26. packet should be sent out of.
  27. For more details, please see the Tcpreplay Manual at:
  28. http://tcpreplay.synfin.net/trac/wiki/manual
  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. This option takes an integer number as its argument.
  35. The value of \fInumber\fP is constrained to being:
  36. .in +4
  37. .nf
  38. .na
  39. in the range 0 through 5
  40. .fi
  41. .in -4
  42. The default \fInumber\fP for this option is:
  43. .ti +4
  44. 0
  45. .sp
  46. If configured with \--enable-debug, then you can specify a verbosity
  47. level for debugging output. Higher numbers increase verbosity.
  48. .TP
  49. .BR \-a " \fIstring\fP, " \--auto "=" \fIstring\fP
  50. Auto-split mode.
  51. This option may appear up to 1 times.
  52. This option must not appear in combination with any of the following options:
  53. cidr, port, regex, mac.
  54. .sp
  55. Tcpprep will try to automatically determine the primary function of hosts
  56. based on the traffic captured and classify each host as client or server.
  57. In order to do so, you must provide a hint to tcpprep as to how to search
  58. for clients and servers. Valid hints are:
  59. .sp 1
  60. \fBbridge\fP
  61. Bridge mode processes each packet to try to determine if the sender is a
  62. client or server. Once all the packets are processed, the results are weighed
  63. according to the server/client ratio (\fB--ratio\fP) and systems are assigned an
  64. interface. If tcpprep is unable to determine what role a system plays, tcpprep
  65. will abort.
  66. .sp 1
  67. \fBrouter\fP
  68. Router mode works just like bridge mode, except that after weighing is done,
  69. systems which are undetermined are considered a server if they fall inside a
  70. network known to contain other servers. Router has a greater chance of
  71. successfully splitting clients and servers but is not 100% foolproof.
  72. .sp 1
  73. \fBclient\fP
  74. Client mode works just like bridge mode, except that unclassified systems are
  75. treated as clients. Client mode should always complete successfully.
  76. .sp 1
  77. \fBserver\fP
  78. Server mode works just like bridge mode, except that unclassified systems are
  79. treated as servers. Server mode should always complete successfully.
  80. .sp 1
  81. \fBfirst\fP
  82. First mode works by looking at the first time each IP is seen in the SRC and DST
  83. fields in the IP header. If the host is first seen in the SRC field, it is a
  84. client and if it's first seen in the DST field, it is marked as a server. This
  85. effectively replicates the processing of the tomahawk test tool. First
  86. mode should always complete successfully.
  87. .br
  88. .TP
  89. .BR \-c " \fIstring\fP, " \--cidr "=" \fIstring\fP
  90. CIDR-split mode.
  91. This option may appear up to 1 times.
  92. This option must not appear in combination with any of the following options:
  93. auto, port, regex, mac.
  94. .sp
  95. Specify a comma delimited list of CIDR netblocks to match against
  96. the source IP of each packet. Packets matching any of the CIDR's
  97. are classified as servers.
  98. IPv4 Example:
  99. .nf
  100. \--cidr=192.168.0.0/16,172.16.0.0/12,10.0.0.0/8
  101. .fi
  102. IPv6 Example:
  103. .nf
  104. \--cidr=[::ffff:0:0/96],[fe80::/16]
  105. .fi
  106. .TP
  107. .BR \-r " \fIstring\fP, " \--regex "=" \fIstring\fP
  108. Regex-split mode.
  109. This option may appear up to 1 times.
  110. This option must not appear in combination with any of the following options:
  111. auto, port, cidr, mac.
  112. .sp
  113. Specify a regular expression to match against the source IP of each
  114. packet. Packets matching the regex are classified as servers.
  115. .TP
  116. .BR \-p ", " \--port
  117. Port-split mode.
  118. This option may appear up to 1 times.
  119. This option must not appear in combination with any of the following options:
  120. auto, regex, cidr, mac.
  121. .sp
  122. Specifies that TCP and UDP traffic over IPv4 and IPv6 should be classified
  123. as client or server based upon the destination port of the header.
  124. .TP
  125. .BR \-e " \fIstring\fP, " \--mac "=" \fIstring\fP
  126. Source MAC split mode.
  127. This option may appear up to 1 times.
  128. This option must not appear in combination with any of the following options:
  129. auto, regex, cidr, port.
  130. .sp
  131. Specify a list of MAC addresses to match against the source MAC
  132. of each packet. Packets matching one of the values are classified
  133. as servers.
  134. .TP
  135. .BR \--reverse
  136. Matches to be client instead of server.
  137. This option may appear up to 1 times.
  138. .sp
  139. Normally the \fB--mac\fP, \fB--regex\fP and \fB--cidr\fP flags specify are used to specify
  140. the servers and non-IP packets are classified as clients. By using \fB--reverse\fP, these
  141. features are reversed so that the flags specify clients and non-IP packets are classified as
  142. servers.
  143. .TP
  144. .BR \-C " \fIstring\fP, " \--comment "=" \fIstring\fP
  145. Embeded cache file comment.
  146. This option may appear up to 1 times.
  147. .sp
  148. Specify a comment to be imbedded within the output cache file and later
  149. viewed.
  150. .TP
  151. .BR \--no-arg-comment
  152. Do not embed any cache file comment.
  153. This option may appear up to 1 times.
  154. .sp
  155. By default, tcpprep includes the arguments passed on the command line
  156. in the cache file comment (in addition to any user specified \--comment).
  157. If for some reason you do not wish to include this, specify this option.
  158. .TP
  159. .BR \-x " \fIstring\fP, " \--include "=" \fIstring\fP
  160. Include only packets matching rule.
  161. This option may appear up to 1 times.
  162. This option must not appear in combination with any of the following options:
  163. exclude.
  164. .sp
  165. Override default of processing all packets stored in the capture file and only
  166. send/edit packets which match the provided rule. Rules can be one of:
  167. .sp
  168. .IR "S:<CIDR1>,... "
  169. - Source IP must match specified IPv4/v6 CIDR(s)
  170. .sp
  171. .IR "D:<CIDR1>,... "
  172. - Destination IP must match specified IPv4/v6 CIDR(s)
  173. .sp
  174. .IR "B:<CIDR1>,... "
  175. - Both source and destination IP must match specified IPv4/v6 CIDR(s)
  176. .sp
  177. .IR "E:<CIDR1>,... "
  178. - Either IP must match specified IPv4/v6 CIDR(s)
  179. .sp
  180. .IR "P:<LIST> "
  181. - Must be one of the listed packets where the list
  182. corresponds to the packet number in the capture file.
  183. .nf
  184. \-x P:1-5,9,15,72-
  185. .fi
  186. would process packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
  187. end of the file
  188. .sp
  189. .IR "F:'<bpf>'"
  190. - BPF filter. See the \fItcpdump(8)\fP man page for syntax.
  191. .br
  192. .TP
  193. .BR \-X " \fIstring\fP, " \--exclude "=" \fIstring\fP
  194. Exclude any packet matching this rule.
  195. This option may appear up to 1 times.
  196. This option must not appear in combination with any of the following options:
  197. include.
  198. .sp
  199. Override default of processing all packets stored in the capture file and only
  200. send/edit packets which do NOT match the provided rule. Rules can be one of:
  201. .sp
  202. .IR "S:<CIDR1>,... "
  203. - Source IP must not match specified IPv4/v6 CIDR(s)
  204. .sp
  205. .IR "D:<CIDR1>,... "
  206. - Destination IP must not match specified IPv4/v6 CIDR(s)
  207. .sp
  208. .IR "B:<CIDR1>,... "
  209. - Both source and destination IP must not match specified IPv4/v6 CIDR(s)
  210. .sp
  211. .IR "E:<CIDR1>,... "
  212. - Either IP must not match specified IPv4/v6 CIDR(s)
  213. .sp
  214. .IR "P:<LIST> "
  215. - Must not be one of the listed packets where the list
  216. corresponds to the packet number in the capture file.
  217. .nf
  218. \-x P:1-5,9,15,72-
  219. .fi
  220. would skip packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
  221. end of the file
  222. .br
  223. .TP
  224. .BR \-o " \fIstring\fP, " \--cachefile "=" \fIstring\fP
  225. Output cache file.
  226. This option may appear up to 1 times.
  227. .sp
  228. .TP
  229. .BR \-i " \fIstring\fP, " \--pcap "=" \fIstring\fP
  230. Input pcap file to process.
  231. This option may appear up to 1 times.
  232. .sp
  233. .TP
  234. .BR \-P " \fIstring\fP, " \--print-comment "=" \fIstring\fP
  235. Print embedded comment in the specified cache file.
  236. This option may appear up to 1 times.
  237. .sp
  238. .TP
  239. .BR \-I " \fIstring\fP, " \--print-info "=" \fIstring\fP
  240. Print basic info from the specified cache file.
  241. This option may appear up to 1 times.
  242. .sp
  243. .TP
  244. .BR \-S " \fIstring\fP, " \--print-stats "=" \fIstring\fP
  245. Print statistical information about the specified cache file.
  246. This option may appear up to 1 times.
  247. .sp
  248. .TP
  249. .BR \-s " \fIstring\fP, " \--services "=" \fIstring\fP
  250. Load services file for server ports.
  251. This option may appear up to 1 times.
  252. This option must appear in combination with the following options:
  253. port.
  254. .sp
  255. Uses a list of ports used by servers in the same format as of /etc/services:
  256. <service_name> <port>/<protocol> # comment
  257. Example:
  258. http 80/tcp
  259. .TP
  260. .BR \-N ", " \--nonip
  261. Send non-IP traffic out server interface.
  262. This option may appear up to 1 times.
  263. .sp
  264. By default, non-IP traffic which can not be classified as client
  265. or server is classified as "client". Specifiying \fB--nonip\fP
  266. will reclassify non-IP traffic as "server". Note that the meaning
  267. of this flag is reversed if \fB--reverse\fP is used.
  268. .TP
  269. .BR \-R " \fIstring\fP, " \--ratio "=" \fIstring\fP
  270. Ratio of client to server packets.
  271. This option may appear up to 1 times.
  272. This option must appear in combination with the following options:
  273. auto.
  274. The default \fIstring\fP for this option is:
  275. .ti +4
  276. 2.0
  277. .sp
  278. Since a given host may have both client and server traffic being sent
  279. to/from it, tcpprep uses a ratio to weigh these packets. If you would
  280. like to override the default of 2:1 server to client packets required for
  281. a host to be classified as a server, specify it as a floating point value.
  282. .TP
  283. .BR \-m " \fInumber\fP, " \--minmask "=" \fInumber\fP
  284. Minimum network mask length in auto mode.
  285. This option may appear up to 1 times.
  286. This option must appear in combination with the following options:
  287. auto.
  288. This option takes an integer number as its argument.
  289. The value of \fInumber\fP is constrained to being:
  290. .in +4
  291. .nf
  292. .na
  293. in the range 0 through 32
  294. .fi
  295. .in -4
  296. The default \fInumber\fP for this option is:
  297. .ti +4
  298. 30
  299. .sp
  300. By default, auto modes use a minimum network mask length of 30 bits
  301. to build networks containing clients and servers. This allows you
  302. to override this value. Larger values will increase performance but
  303. may provide inaccurate results.
  304. .TP
  305. .BR \-M " \fInumber\fP, " \--maxmask "=" \fInumber\fP
  306. Maximum network mask length in auto mode.
  307. This option may appear up to 1 times.
  308. This option must appear in combination with the following options:
  309. auto.
  310. This option takes an integer number as its argument.
  311. The value of \fInumber\fP is constrained to being:
  312. .in +4
  313. .nf
  314. .na
  315. in the range 0 through 32
  316. .fi
  317. .in -4
  318. The default \fInumber\fP for this option is:
  319. .ti +4
  320. 8
  321. .sp
  322. By default, auto modes use a maximum network mask length of 8 bits
  323. to build networks containing clients and servers. This allows you
  324. to override this value. Larger values will decrease performance
  325. and accuracy but will provide greater chance of success.
  326. .TP
  327. .BR \-v ", " \--verbose
  328. Print decoded packets via tcpdump to STDOUT.
  329. This option may appear up to 1 times.
  330. .sp
  331. .TP
  332. .BR \-A " \fIstring\fP, " \--decode "=" \fIstring\fP
  333. Arguments passed to tcpdump decoder.
  334. This option may appear up to 1 times.
  335. This option must appear in combination with the following options:
  336. verbose.
  337. .sp
  338. When enabling verbose mode (\fB-v\fP) you may also specify one or
  339. more additional arguments to pass to \fBtcpdump\fP to modify
  340. the way packets are decoded. By default, \-n and \-l are used.
  341. Be sure to quote the arguments so that they are not interpreted
  342. by tcprewrite. The following arguments are valid:
  343. [ \-aAeNqRStuvxX ]
  344. [ \-E spi@ipaddr algo:secret,... ]
  345. [ \-s snaplen ]
  346. .TP
  347. .BR \-V ", " \--version
  348. Print version information.
  349. .sp
  350. .TP
  351. .BR \-h ", " \--less-help
  352. Display less usage information and exit.
  353. .sp
  354. This option has not been fully documented.
  355. .TP
  356. .BR \-H , " \--help"
  357. Display usage information and exit.
  358. .TP
  359. .BR \-! , " \--more-help"
  360. Extended usage information passed thru pager.
  361. .TP
  362. .BR \- " [\fIrcfile\fP]," " \--save-opts" "[=\fIrcfile\fP]"
  363. Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
  364. configuration file listed in the \fBOPTION PRESETS\fP section, below.
  365. .TP
  366. .BR \- " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
  367. Load options from \fIrcfile\fP.
  368. The \fIno-load-opts\fP form will disable the loading
  369. of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
  370. out of order.
  371. .SH OPTION PRESETS
  372. Any option that is not marked as \fInot presettable\fP may be preset
  373. by loading values from configuration ("RC" or ".INI") file(s).
  374. The \fIhomerc\fP file is "\fI$$/\fP", unless that is a directory.
  375. In that case, the file "\fI.tcppreprc\fP"
  376. is searched for within that directory.
  377. .SH "SEE ALSO"
  378. tcpdump(1), tcprewrite(1), tcpreplay(1)
  379. .SH AUTHOR
  380. Copyright 2000-2008 Aaron Turner
  381. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  382. The latest version of this software is always available from:
  383. http://tcpreplay.synfin.net/
  384. .PP
  385. Released under the Free BSD License.
  386. .PP
  387. This manual page was \fIAutoGen\fP-erated from the \fBtcpprep\fP
  388. option definitions.