tcpprep.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <!--#exec cmd="header tcpprep" -->
  2. <ul>
  3. </ul><H2>NAME </H2><ul>
  4. tcpprep - Create a tcpreplay cache cache file from a pcap file.
  5. </ul><H2>SYNOPSIS </H2><ul>
  6. <b>tcpprep</b>
  7. [<b>-<i>flag</i></b> [<i>value</i>]]... [<b>--<i>opt-name</i></b> [[=| ]<i>value</i>]]...
  8. <p>
  9. All arguments must be options.
  10. <p>
  11. tcpprep is a <i>pcap(3)</i> file pre-processor which creates a cache
  12. file which provides "rules" for <i>tcprewrite(1)</i> and <i>tcpreplay(1)</i>
  13. on how to process and send packets.
  14. </ul><H2>DESCRIPTION </H2><ul>
  15. This manual page documents, briefly, the <b>tcpprep</b> command.
  16. The basic operation of tcpreplay is to resend all packets from the
  17. input file(s) out a single file. Tcpprep processes a pcap file and
  18. applies a set of user-specified rules to create a cache file which
  19. tells tcpreplay wether or not to send each packet and which interface the
  20. packet should be sent out of.
  21. </ul><H2>OPTIONS </H2><ul>
  22. <p><dl compact><dt><b>-d</b> <i>number</i>, <b>--dbug</b>=<b><i>number</i></b>
  23. <dd>Enable debugging output.
  24. This option may appear up to 1 times.
  25. This option takes an integer number as its argument.
  26. The value of <i>number</i> is constrained to being:
  27. <pre>
  28. in the range 0 through 5
  29. <br></pre>
  30. The default <i>number</i> for this option is:
  31. </dl><br>
  32. 0
  33. <p>
  34. If configured with --enable-debug, then you can specify a verbosity
  35. level for debugging output. Higher numbers increase verbosity.
  36. <p><dl compact><dt><b>-a</b> <i>string</i>, <b>--auto</b>=<b><i>string</i></b>
  37. <dd>Auto-split mode.
  38. This option may appear up to 1 times.
  39. This option must not appear in combination with any of the following options:
  40. cidr, port, regex, mac.
  41. </dl>
  42. <p>
  43. Tcpprep will try to automatically determine the primary function of hosts
  44. based on the traffic captured and classify each host as client or server.
  45. In order to do so, you must provide a hint to tcpprep as to how to search
  46. for clients and servers. Valid hints are:
  47. <p>
  48. <p>
  49. <b>bridge</b>
  50. Bridge mode processes each packet to try to determine if the sender is a
  51. client or server. Once all the packets are processed, the results are weighed
  52. according to the server/client ratio (<b>--ratio</b>) and systems are assigned an
  53. interface. If tcpprep is unable to determine what role a system plays, tcpprep
  54. will abort.
  55. <p>
  56. <b>router</b>
  57. Router mode works just like bridge mode, except that after weighing is done,
  58. systems which are undetermined are considered a server if they fall inside a
  59. network known to contain other servers. Router has a greater chance of
  60. successfully splitting clients and servers but is not 100% foolproof.
  61. <p>
  62. <b>client</b>
  63. Client mode works just like bridge mode, except that unclassified systems are
  64. treated as clients. Client mode should always complete successfully.
  65. <p>
  66. <b>server</b>
  67. Server mode works just like bridge mode, except that unclassified systems are
  68. treated as servers. Server mode should always complete successfully.
  69. <br>
  70. <p><dl compact><dt><b>-c</b> <i>string</i>, <b>--cidr</b>=<b><i>string</i></b>
  71. <dd>CIDR-split mode.
  72. This option may appear up to 1 times.
  73. This option must not appear in combination with any of the following options:
  74. auto, port, regex, mac.
  75. </dl>
  76. <p>
  77. Specify a comma delimited list of CIDR netblocks to match against
  78. the source IP of each packet. Packets matching any of the CIDR's
  79. are classified as servers.
  80. <p><dl compact><dt><b>-r</b> <i>string</i>, <b>--regex</b>=<b><i>string</i></b>
  81. <dd>Regex-split mode.
  82. This option may appear up to 1 times.
  83. This option must not appear in combination with any of the following options:
  84. auto, port, cidr, mac.
  85. </dl>
  86. <p>
  87. Specify a regular expression to match against the source IP of each
  88. packet. Packets matching the regex are classified as servers.
  89. <p><dl compact><dt><b>-p</b>, <b>--port</b>
  90. <dd>Port-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, regex, cidr, mac.
  94. </dl>
  95. <p>
  96. Specifies that TCP and UDP traffic should be classified as client
  97. or server based upon the destination port of the header.
  98. <p><dl compact><dt><b>-e</b> <i>string</i>, <b>--mac</b>=<b><i>string</i></b>
  99. <dd>Source MAC split mode.
  100. This option may appear up to 1 times.
  101. This option must not appear in combination with any of the following options:
  102. auto, regex, cidr, port.
  103. </dl>
  104. <p>
  105. Specify a list of MAC addresses to match against the source MAC
  106. of each packet. Packets matching one of the values are classified
  107. as servers.
  108. <p><dl compact><dt><b>-C</b> <i>string</i>, <b>--comment</b>=<b><i>string</i></b>
  109. <dd>Embeded cache file comment.
  110. This option may appear up to 1 times.
  111. </dl>
  112. <p>
  113. Specify a comment to be imbedded within the output cache file and later
  114. viewed.
  115. <p><dl compact><dt><b>--no-arg-comment</b>
  116. <dd>Do not embed any cache file comment.
  117. This option may appear up to 1 times.
  118. </dl>
  119. <p>
  120. By default, tcpprep includes the arguments passed on the command line
  121. in the cache file comment (in addition to any user specified --comment).
  122. If for some reason you do not wish to include this, specify this option.
  123. <p><dl compact><dt><b>-x</b> <i>string</i>, <b>--include</b>=<b><i>string</i></b>
  124. <dd>Include only packets matching rule.
  125. This option may appear up to 1 times.
  126. This option must not appear in combination with any of the following options:
  127. exclude.
  128. </dl>
  129. <p>
  130. Override default of processing all packets stored in the capture file and only
  131. send/edit packets which match the provided rule. Rules can be one of:
  132. <p>
  133. <p>
  134. <i>S:&lt;CIDR1&gt;,... </i>
  135. - Source IP must match specified CIDR(s)
  136. <p>
  137. <i>D:&lt;CIDR1&gt;,... </i>
  138. - Destination IP must match specified CIDR(s)
  139. <p>
  140. <i>B:&lt;CIDR1&gt;,... </i>
  141. - Both source and destination IP must match specified CIDR(s)
  142. <p>
  143. <i>E:&lt;CIDR1&gt;,... </i>
  144. - Either IP must match specified CIDR(s)
  145. <p>
  146. <i>P:&lt;LIST&gt; </i>
  147. - Must be one of the listed packets where the list
  148. corresponds to the packet number in the capture file.
  149. <pre>
  150. -x P:1-5,9,15,72-
  151. <br></pre>
  152. would process packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
  153. end of the file
  154. <p>
  155. <i>F:'&lt;bpf&gt;'</i>
  156. - BPF filter. See the <i>tcpdump(8)</i> man page for syntax.
  157. <br>
  158. <p><dl compact><dt><b>-X</b> <i>string</i>, <b>--exclude</b>=<b><i>string</i></b>
  159. <dd>Exclude any packet matching this rule.
  160. This option may appear up to 1 times.
  161. This option must not appear in combination with any of the following options:
  162. include.
  163. </dl>
  164. <p>
  165. Override default of processing all packets stored in the capture file and only
  166. send/edit packets which do NOT match the provided rule. Rules can be one of:
  167. <p>
  168. <p>
  169. <i>S:&lt;CIDR1&gt;,... </i>
  170. - Source IP must not match specified CIDR(s)
  171. <p>
  172. <i>D:&lt;CIDR1&gt;,... </i>
  173. - Destination IP must not match specified CIDR(s)
  174. <p>
  175. <i>B:&lt;CIDR1&gt;,... </i>
  176. - Both source and destination IP must not match specified CIDR(s)
  177. <p>
  178. <i>E:&lt;CIDR1&gt;,... </i>
  179. - Either IP must not match specified CIDR(s)
  180. <p>
  181. <i>P:&lt;LIST&gt; </i>
  182. - Must not be one of the listed packets where the list
  183. corresponds to the packet number in the capture file.
  184. <pre>
  185. -x P:1-5,9,15,72-
  186. <br></pre>
  187. would skip packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
  188. end of the file
  189. <br>
  190. <p><dl compact><dt><b>-o</b> <i>string</i>, <b>--cachefile</b>=<b><i>string</i></b>
  191. <dd>Output cache file.
  192. This option may appear up to 1 times.
  193. </dl>
  194. <p>
  195. <p><p><dl compact><dt><b>-i</b> <i>string</i>, <b>--pcap</b>=<b><i>string</i></b>
  196. <dd>Input pcap file to process.
  197. This option may appear up to 1 times.
  198. </dl>
  199. <p>
  200. <p><p><dl compact><dt><b>-P</b> <i>string</i>, <b>--print-comment</b>=<b><i>string</i></b>
  201. <dd>Print embedded comment in the specified cache file.
  202. </dl>
  203. <p>
  204. <p><p><dl compact><dt><b>-I</b> <i>string</i>, <b>--print-info</b>=<b><i>string</i></b>
  205. <dd>Print basic info from the specified cache file.
  206. </dl>
  207. <p>
  208. <p><p><dl compact><dt><b>-S</b> <i>string</i>, <b>--print-stats</b>=<b><i>string</i></b>
  209. <dd>Print statistical information about the specified cache file.
  210. </dl>
  211. <p>
  212. <p><p><dl compact><dt><b>-s</b> <i>string</i>, <b>--services</b>=<b><i>string</i></b>
  213. <dd>Load services file for server ports.
  214. </dl>
  215. <p>
  216. This option has not been fully documented.
  217. <p><dl compact><dt><b>-N</b>, <b>--nonip</b>
  218. <dd>Send non-IP traffic out server interface.
  219. </dl>
  220. <p>
  221. By default, non-IP traffic which can not be classified as client
  222. or server is classified as "client". Specifiying <b>--nonip</b>
  223. will reclassify non-IP traffic as "server".
  224. <p><dl compact><dt><b>-R</b> <i>string</i>, <b>--ratio</b>=<b><i>string</i></b>
  225. <dd>Ratio of client to server packets.
  226. This option may appear up to 1 times.
  227. This option must appear in combination with the following options:
  228. auto.
  229. The default <i>string</i> for this option is:
  230. </dl><br>
  231. 2.0
  232. <p>
  233. Since a given host may have both client and server traffic being sent
  234. to/from it, tcpprep uses a ratio to weigh these packets. If you would
  235. like to override the default of 2:1 server to client packets required for
  236. a host to be classified as a server, specify it as a floating point value.
  237. <p><dl compact><dt><b>-m</b> <i>number</i>, <b>--minmask</b>=<b><i>number</i></b>
  238. <dd>Minimum network mask length in auto mode.
  239. This option may appear up to 1 times.
  240. This option must appear in combination with the following options:
  241. auto.
  242. This option takes an integer number as its argument.
  243. The value of <i>number</i> is constrained to being:
  244. <pre>
  245. in the range 0 through 32
  246. <br></pre>
  247. The default <i>number</i> for this option is:
  248. </dl><br>
  249. 30
  250. <p>
  251. By default, auto modes use a minimum network mask length of 30 bits
  252. to build networks containing clients and servers. This allows you
  253. to override this value. Larger values will increase performance but
  254. may provide inaccurate results.
  255. <p><dl compact><dt><b>-M</b> <i>number</i>, <b>--maxmask</b>=<b><i>number</i></b>
  256. <dd>Maximum network mask length in auto mode.
  257. This option may appear up to 1 times.
  258. This option must appear in combination with the following options:
  259. auto.
  260. This option takes an integer number as its argument.
  261. The value of <i>number</i> is constrained to being:
  262. <pre>
  263. in the range 0 through 32
  264. <br></pre>
  265. The default <i>number</i> for this option is:
  266. </dl><br>
  267. 8
  268. <p>
  269. By default, auto modes use a maximum network mask length of 8 bits
  270. to build networks containing clients and servers. This allows you
  271. to override this value. Larger values will decrease performance
  272. and accuracy but will provide greater chance of success.
  273. <p><dl compact><dt><b>-v</b>, <b>--verbose</b>
  274. <dd>Print decoded packets via tcpdump to STDOUT.
  275. This option may appear up to 1 times.
  276. </dl>
  277. <p>
  278. <p><p><dl compact><dt><b>-A</b> <i>string</i>, <b>--decode</b>=<b><i>string</i></b>
  279. <dd>Arguments passed to tcpdump decoder.
  280. This option may appear up to 1 times.
  281. This option must appear in combination with the following options:
  282. verbose.
  283. </dl>
  284. <p>
  285. When enabling verbose mode (<b>-v</b>) you may also specify one or
  286. more additional arguments to pass to <b>tcpdump</b> to modify
  287. the way packets are decoded. By default, -n and -l are used.
  288. Be sure to quote the arguments so that they are not interpreted
  289. by tcprewrite. The following arguments are valid:
  290. [ -aAeNqRStuvxX ]
  291. [ -E spi@ipaddr algo:secret,... ]
  292. [ -s snaplen ]
  293. <p><dl compact><dt><b>-V</b>, <b>--version</b>
  294. <dd>Print version information.
  295. </dl>
  296. <p>
  297. <p><p><dl compact><dt><b>-h</b>, <b>--less-help</b>
  298. <dd>Display less usage information and exit.
  299. </dl>
  300. <p>
  301. This option has not been fully documented.
  302. <p><dl compact><dt><b>-H</b>,<b> --help</b>
  303. <dd>Display usage information and exit.
  304. <dt><b>-!</b>,<b> --more-help</b>
  305. <dd>Extended usage information passed thru pager.
  306. <dt><b>-</b> [<i>rcfile</i>],<b> --save-opts</b>[=<i>rcfile</i>]
  307. <dd>Save the option state to <i>rcfile</i>. The default is the <i>last</i>
  308. configuration file listed in the <b>OPTION PRESETS</b> section, below.
  309. <dt><b>-</b> <i>rcfile</i>,<b> --load-opts</b>=<i>rcfile</i>,<b> --no-load-opts</b>
  310. <dd>Load options from <i>rcfile</i>.
  311. The <i>no-load-opts</i> form will disable the loading
  312. of earlier RC/INI files. <i>--no-load-opts</i> is handled early,
  313. out of order.
  314. </dl>
  315. </ul><H2>OPTION PRESETS </H2><ul>
  316. Any option that is not marked as <i>not presettable</i> may be preset
  317. by loading values from configuration ("RC" or ".INI") file(s).
  318. The <i>homerc</i> file is "<i>$$/</i>", unless that is a directory.
  319. In that case, the file "<i>.tcppreprc</i>"
  320. is searched for within that directory.
  321. </ul><H2>SEE ALSO </H2><ul>
  322. tcpdump(1), tcprewrite(1), tcpreplay(1)
  323. </ul><H2>AUTHOR </H2><ul>
  324. Copyright 2000-2005 Aaron Turner
  325. <p>For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  326. <p>
  327. Released under the Free BSD License.
  328. <p>
  329. This manual page was <i>AutoGen</i>-erated from the <b>tcpprep</b>
  330. option definitions.
  331. </ul>
  332. <!--#exec cmd="trailer" -->