flowreplay_opts.def 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. autogen definitions options;
  2. copyright = {
  3. date = "2004-2005";
  4. owner = "Aaron Turner";
  5. type = "bsd";
  6. author = <<- EOText
  7. Copyright 2000-2005 Aaron Turner
  8. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  9. EOText;
  10. };
  11. package = "flowreplay";
  12. prog-name = "flowreplay";
  13. prog-title = "Connect to servers based on network traffic stored in pcap files";
  14. long-opts;
  15. gnu-usage;
  16. help-value = "H";
  17. save-opts-value = "";
  18. load-opts-value = "";
  19. argument = "<pcap_file(s)>";
  20. config-header = "config.h";
  21. include = "#include \"defines.h\"\n"
  22. "#include \"flowreplay.h\"\n"
  23. "#include \"common.h\"\n"
  24. "extern char pcap_version[];\n"
  25. "extern flowreplay_opt_t options;\n";
  26. homerc = "$$/";
  27. explain = <<- EOExplain
  28. flowreplay is a tool for using network traffic stored in pcap(3) files as
  29. the basis for replaying connections to servers.
  30. EOExplain;
  31. detail = <<- EODetail
  32. Please note that flowreplay is currently in *alpha*. As such, it is still
  33. very much a work in progress and currently will not work for most uses. If
  34. you have the skill and interest to help make flowreplay work better, please
  35. contact Aaron Turner.
  36. EODetail;
  37. flag = {
  38. name = dbug;
  39. value = d;
  40. arg-type = number;
  41. max = 1;
  42. immediate;
  43. arg-range = "0->5";
  44. arg-default = 0;
  45. descrip = "Enable debugging output";
  46. doc = <<- EOText
  47. If configured with --enable-debug, then you can specify a verbosity
  48. level for debugging output. Higher numbers increase verbosity.
  49. EOText;
  50. };
  51. /* Verbose decoding via tcpdump */
  52. flag = {
  53. ifdef = HAVE_TCPDUMP;
  54. name = verbose;
  55. value = v;
  56. max = 1;
  57. immediate;
  58. descrip = "Print decoded packets via tcpdump to STDOUT";
  59. settable;
  60. doc = "";
  61. };
  62. flag = {
  63. ifdef = HAVE_TCPDUMP;
  64. name = decode;
  65. flags-must = verbose;
  66. value = A;
  67. arg-type = string;
  68. max = 1;
  69. descrip = "Arguments passed to tcpdump decoder";
  70. doc = <<- EOText
  71. When enabling verbose mode (@var{-v}) you may also specify one or more
  72. additional arguments to pass to @code{tcpdump} to modify the way packets
  73. are decoded. By default, -n and -l are used. Be sure to
  74. quote the arguments like: -A "-axxx" so that they are not interpreted
  75. by tcpreplay. The following arguments are vaild:
  76. [ -aAeNqRStuvxX ]
  77. [ -E spi@ipaddr algo:secret,... ]
  78. [ -s snaplen ]
  79. EOText;
  80. };
  81. flag = {
  82. name = mode;
  83. value = m;
  84. arg-type = string;
  85. max = 1;
  86. must-set;
  87. descrip = "Replay mode";
  88. doc = <<- EOText
  89. Flowreplay needs to know handle client/server exchanges to properly time.
  90. The options are:
  91. @table @bullet
  92. @item @var{send}
  93. Replay traffic as fast as possible. Do not wait for server to reply.
  94. @item @var{wait}
  95. Wait @var{--wait} sec.usec for the server to reply before sending.
  96. @item @var{bytes}
  97. Wait until the server has sent the number of bytes stored in the pcap file.
  98. @item @var{user}
  99. Send packets based on user interaction.
  100. @end table
  101. EOText;
  102. flag-code = <<- EOText
  103. if (strcasecmp(OPT_ARG(MODE), "send") == 0) {
  104. options.sendmode = MODE_SEND;
  105. } else if (strcasecmp(OPT_ARG(MODE), "wait") == 0) {
  106. options.sendmode = MODE_WAIT;
  107. } else if (strcasecmp(OPT_ARG(MODE), "bytes") == 0) {
  108. options.sendmode = MODE_BYTES;
  109. } else if (strcasecmp(OPT_ARG(MODE), "user") == 0) {
  110. options.sendmode = MODE_USER;
  111. } else {
  112. errx(1, "Invalid --mode: %s", OPT_ARG(MODE));
  113. }
  114. EOText;
  115. };
  116. flag = {
  117. name = wait;
  118. value = w;
  119. arg-type = string;
  120. max = 1;
  121. default = "2.0";
  122. descrip = "Number of sec.usec to wait between client's turn to send";
  123. doc = <<- EOText
  124. If @var{--mode} is @var{wait}, then you can specify the amount of time to
  125. wait for the server to complete it's side of the transaction before starting
  126. to send the client side again.
  127. EOText;
  128. flag-code = <<- EOText
  129. float2timer(atof(OPT_ARG(WAIT)), &options.timeout);
  130. EOText;
  131. };
  132. flag = {
  133. name = targetip;
  134. value = t;
  135. arg-type = string;
  136. max = 1;
  137. must-set;
  138. descrip = "Target host to connect to";
  139. flag-code = <<- EOText
  140. #ifdef INET_ATON
  141. if (inet_aton(OPT_ARG(TARGETIP), &options.targetaddr) == 0)
  142. errx(1, "Invalid target IP address: %s", OPT_ARG(TARGETIP));
  143. #else
  144. if ((options.targetaddr.s_addr = inet_addr(OPT_ARG(TARGETIP))) == -1)
  145. errx(1, "Invalid target IP address: %s", OPT_ARG(TARGETIP));
  146. #endif
  147. EOText;
  148. };
  149. flag = {
  150. name = filter;
  151. value = f;
  152. arg-type = string;
  153. max = 1;
  154. descrip = "BPF filter to limit which flows are replayed";
  155. doc = "";
  156. };
  157. flag = {
  158. name = clientnet;
  159. value = c;
  160. arg-type = string;
  161. descrip = "Client network(s)";
  162. flag-code = <<- EOText
  163. char *cidr = safe_strdup(OPT_ARG(CLIENTNET));
  164. if (!parse_cidr(&options.clients, cidr, ","))
  165. errx(1, "Unable to parse CIDR: %s", OPT_ARG(CLIENTNET));
  166. free(cidr);
  167. EOText;
  168. };
  169. flag = {
  170. name = servernet;
  171. value = s;
  172. arg-type = string;
  173. descrip = "Server network(s)";
  174. flag-code = <<- EOText
  175. char *cidr = safe_strdup(OPT_ARG(SERVERNET));
  176. if (!parse_cidr(&options.servers, cidr, ","))
  177. errx(1, "Unable to parse CIDR: %s", OPT_ARG(SERVERNET));
  178. free(cidr);
  179. EOText;
  180. };
  181. flag = {
  182. name = nosyn;
  183. value = n;
  184. descrip = "Disable Syn packet requirement to start connections";
  185. flag-code = <<- EOText
  186. options.nosyn = 1;
  187. EOText;
  188. };
  189. flag = {
  190. name = slimit;
  191. value = l;
  192. descrip = "Service limit to proto/port";
  193. arg-type = string;
  194. flag-code = <<- EOText
  195. char *p_parse = NULL, *myarg;
  196. myarg = safe_strdup(OPT_ARG(SLIMIT));
  197. p_parse = strtok(myarg, "/");
  198. if (strcasecmp(p_parse, "TCP") == 0) {
  199. options.proto = IPPROTO_TCP;
  200. } else if (strcasecmp(p_parse, "UDP") == 0) {
  201. options.proto = IPPROTO_UDP;
  202. } else {
  203. errx(1, "Unsupported protocol: %s", p_parse);
  204. }
  205. /* if port is specified, set it */
  206. if ((p_parse = strtok(NULL, "/")))
  207. options.port = htons(atoi(p_parse));
  208. EOText;
  209. };
  210. flag = {
  211. name = version;
  212. value = V;
  213. descrip = "Print version information";
  214. flag-code = <<- EOVersion
  215. fprintf(stderr, "flowreplay version: %s (build %s)", VERSION, svn_version());
  216. #ifdef DEBUG
  217. fprintf(stderr, " (debug)");
  218. #endif
  219. fprintf(stderr, "\n");
  220. fprintf(stderr, "Copyright 2001-2006 by Aaron Turner <aturner@synfin.net>\n");
  221. fprintf(stderr, "Compiled against libnet: %s\n", LIBNET_VERSION);
  222. fprintf(stderr, "Compiled against libpcap: %s\n", pcap_version);
  223. #ifdef ENABLE_64BITS
  224. fprintf(stderr, "64 bit packet counters: enabled\n");
  225. #else
  226. fprintf(stderr, "64 bit packet counters: disabled\n");
  227. #endif
  228. #ifdef HAVE_TCPDUMP
  229. fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
  230. #else
  231. fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
  232. #endif
  233. exit(0);
  234. EOVersion;
  235. doc = "";
  236. };
  237. flag = {
  238. name = less-help;
  239. value = "h";
  240. immediate;
  241. descrip = "Display less usage information and exit";
  242. flag-code = <<- EOHelp
  243. USAGE(EXIT_FAILURE);
  244. EOHelp;
  245. doc = "";
  246. };