tcprewrite_opts.def 6.9 KB

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