tcprewrite_opts.def 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2024 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  5. *
  6. * The Tcpreplay Suite of tools is free software: you can redistribute it
  7. * and/or modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or with the authors permission any later version.
  10. *
  11. * The Tcpreplay Suite is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with the Tcpreplay Suite. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. autogen definitions options;
  20. copyright = {
  21. date = "2000-2024";
  22. owner = "Aaron Turner and Fred Klassen";
  23. eaddr = "tcpreplay-users@lists.sourceforge.net";
  24. type = gpl;
  25. author = <<- EOText
  26. Copyright 2013-2024 Fred Klassen - AppNeta
  27. Copyright 2000-2012 Aaron Turner
  28. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  29. The latest version of this software is always available from:
  30. http://tcpreplay.appneta.com/
  31. EOText;
  32. };
  33. package = "tcprewrite";
  34. prog-name = "tcprewrite";
  35. prog-title = "Rewrite the packets in a pcap file.";
  36. long-opts;
  37. gnu-usage;
  38. help-value = "H";
  39. save-opts-value = "";
  40. load-opts-value = "";
  41. config-header = "config.h";
  42. #include tcpedit/tcpedit_opts.def
  43. detail = <<- EOText
  44. Tcprewrite is a tool to rewrite packets stored in @file{pcap(3)} file format,
  45. such as created by tools such as @file{tcpdump(1)} and @file{wireshark(1)}.
  46. Once a pcap file has had it's packets rewritten, they can be replayed back
  47. out on the network using @file{tcpreplay(1)}.
  48. tcprewrite currently supports reading the following DLT types:
  49. @item
  50. @var{DLT_C_HDLC} aka Cisco HDLC
  51. @item
  52. @var{DLT_EN10MB} aka Ethernet
  53. @item
  54. @var{DLT_LINUX_SLL} aka Linux Cooked Socket
  55. @item
  56. @var{DLT_LINUX_SLL2} aka Linux Cooked Socket v2
  57. @item
  58. @var{DLT_RAW} aka RAW IP
  59. @item
  60. @var{DLT_NULL} aka BSD Loopback
  61. @item
  62. @var{DLT_LOOP} aka OpenBSD Loopback
  63. @item
  64. @var{DLT_IEEE802_11} aka 802.11a/b/g
  65. @item
  66. @var{DLT_IEEE802_11_RADIO} aka 802.11a/b/g with Radiotap headers
  67. @item
  68. @var{DLT_JUNIPER_ETHER} aka Juniper Encapsulated Ethernet
  69. @item
  70. @var{DLT_PPP_SERIAL} aka PPP over Serial
  71. Please see the --dlt option for supported DLT types for writing.
  72. The packet editing features of tcprewrite which distinguish between "client"
  73. and "server" traffic requires a tcpprep(1) cache file.
  74. For more details, please see the Tcpreplay Manual at:
  75. http://tcpreplay.appneta.com
  76. EOText;
  77. man-doc = <<- EOMan
  78. .SH "SEE ALSO"
  79. tcpdump(1), tcpbridge(1), tcpreplay(1), tcpprep(1), tcpcapinfo(1)
  80. EOMan;
  81. config-header = "config.h";
  82. include = "#include \"defines.h\"\n"
  83. "#include \"common.h\"\n"
  84. "#include \"config.h\"\n"
  85. "#include \"tcprewrite.h\"\n"
  86. "#include <stdlib.h>\n"
  87. "#include <string.h>\n"
  88. "extern tcprewrite_opt_t options;\n";
  89. homerc = "$$/";
  90. flag = {
  91. ifdef = DEBUG;
  92. name = dbug;
  93. value = d;
  94. arg-type = number;
  95. descrip = "Enable debugging output";
  96. arg-range = "0->5";
  97. arg-default = 0;
  98. max = 1;
  99. immediate;
  100. doc = <<- EOText
  101. If configured with --enable-debug, then you can specify a verbosity
  102. level for debugging output. Higher numbers increase verbosity.
  103. EOText;
  104. };
  105. flag = {
  106. name = infile;
  107. value = i;
  108. arg-type = string;
  109. descrip = "Input pcap file to be processed";
  110. max = 1;
  111. immediate;
  112. must-set;
  113. doc = "";
  114. };
  115. flag = {
  116. name = outfile;
  117. value = o;
  118. arg-type = string;
  119. descrip = "Output pcap file";
  120. max = 1;
  121. must-set;
  122. doc = "";
  123. /* options.outfile is set in post_args, because we need to make
  124. * sure that options.infile is processed first
  125. */
  126. };
  127. flag = {
  128. name = cachefile;
  129. value = c;
  130. arg-type = string;
  131. max = 1;
  132. descrip = "Split traffic via tcpprep cache file";
  133. settable;
  134. flag-code = <<- EOCachefile
  135. options.cache_packets =
  136. read_cache(&options.cachedata, OPT_ARG(CACHEFILE), &options.comment);
  137. EOCachefile;
  138. doc = <<- EOText
  139. Use tcpprep cache file to split traffic based upon client/server relationships.
  140. EOText;
  141. };
  142. /* Verbose decoding via tcpdump */
  143. flag = {
  144. ifdef = ENABLE_VERBOSE;
  145. name = verbose;
  146. value = v;
  147. max = 1;
  148. immediate;
  149. descrip = "Print decoded packets via tcpdump to STDOUT";
  150. settable;
  151. doc = "";
  152. };
  153. flag = {
  154. ifdef = ENABLE_VERBOSE;
  155. name = decode;
  156. flags-must = verbose;
  157. value = A;
  158. arg-type = string;
  159. max = 1;
  160. descrip = "Arguments passed to tcpdump decoder";
  161. doc = <<- EOText
  162. When enabling verbose mode (@var{-v}) you may also specify one or
  163. more additional arguments to pass to @code{tcpdump} to modify
  164. the way packets are decoded. By default, -n and -l are used.
  165. Be sure to quote the arguments so that they are not interpreted
  166. by tcprewrite. Please see the tcpdump(1) man page for a complete list of
  167. options.
  168. EOText;
  169. };
  170. /* Fragroute */
  171. flag = {
  172. ifdef = ENABLE_FRAGROUTE;
  173. name = fragroute;
  174. arg-type = string;
  175. max = 1;
  176. descrip = "Parse fragroute configuration file";
  177. doc = <<- EOText
  178. Enable advanced evasion techniques using the built-in fragroute(8)
  179. engine. See the fragroute(8) man page for more details. Important:
  180. tcprewrite does not support the delay, echo or print commands.
  181. EOText;
  182. };
  183. flag = {
  184. ifdef = ENABLE_FRAGROUTE;
  185. name = fragdir;
  186. flags-must = cachefile;
  187. arg-type = string;
  188. max = 1;
  189. descrip = "Which flows to apply fragroute to: c2s, s2c, both";
  190. doc = <<- EOText
  191. Apply the fragroute engine to packets going c2s, s2c or both when
  192. using a cache file.
  193. EOText;
  194. };
  195. flag = {
  196. name = skip-soft-errors;
  197. max = 1;
  198. descrip = "Skip writing packets with soft errors";
  199. doc = <<- EOText
  200. In some cases, packets can not be decoded or the requested editing
  201. is not possible. Normally these packets are written to the output
  202. file unedited so that tcpprep cache files can still be used, but if
  203. you wish, these packets can be suppressed.
  204. One example of this is 802.11 management frames which contain no data.
  205. EOText;
  206. };
  207. flag = {
  208. name = version;
  209. value = V;
  210. descrip = "Print version information";
  211. flag-code = <<- EOVersion
  212. fprintf(stderr, "tcprewrite version: %s (build %s)", VERSION, git_version());
  213. #ifdef DEBUG
  214. fprintf(stderr, " (debug)");
  215. #endif
  216. fprintf(stderr, "\n");
  217. fprintf(stderr, "Copyright 2013-2024 by Fred Klassen <tcpreplay at appneta dot com> - AppNeta\n");
  218. fprintf(stderr, "Copyright 2000-2012 by Aaron Turner <aturner at synfin dot net>\n");
  219. fprintf(stderr, "The entire Tcpreplay Suite is licensed under the GPLv3\n");
  220. fprintf(stderr, "Cache file supported: %s\n", CACHEVERSION);
  221. #ifdef HAVE_LIBDNET
  222. fprintf(stderr, "Compiled against libdnet: %s\n", LIBDNET_VERSION);
  223. #else
  224. fprintf(stderr, "Not compiled with libdnet.\n");
  225. #endif
  226. #ifdef HAVE_WINPCAP
  227. fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
  228. #elif defined HAVE_PF_RING_PCAP
  229. fprintf(stderr, "Compiled against PF_RING libpcap: %s\n", get_pcap_version());
  230. #else
  231. fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
  232. #endif
  233. #ifdef ENABLE_64BITS
  234. fprintf(stderr, "64 bit packet counters: enabled\n");
  235. #else
  236. fprintf(stderr, "64 bit packet counters: disabled\n");
  237. #endif
  238. #ifdef ENABLE_VERBOSE
  239. fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
  240. #else
  241. fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
  242. #endif
  243. #ifdef ENABLE_FRAGROUTE
  244. fprintf(stderr, "Fragroute engine: enabled\n");
  245. #else
  246. fprintf(stderr, "Fragroute engine: disabled\n");
  247. #endif
  248. exit(0);
  249. EOVersion;
  250. doc = "";
  251. };
  252. flag = {
  253. name = less-help;
  254. value = h;
  255. immediate;
  256. descrip = "Display less usage information and exit";
  257. flag-code = <<- EOHelp
  258. USAGE(EXIT_FAILURE);
  259. EOHelp;
  260. doc = "";
  261. };
  262. flag = {
  263. name = suppress-warnings;
  264. value = w;
  265. immediate;
  266. descrip = "suppress printing warning messages";
  267. settable;
  268. doc = "";
  269. };