flowreplay_opts.def 7.3 KB

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