2 * netsniff-ng - the packet sniffing beast
3 * By Daniel Borkmann <daniel@netsniff-ng.org>
4 * Copyright 2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL, version 2.
17 static const char *short_options
= "vhm:b:";
19 static struct option long_options
[] = {
20 {"mgmt", required_argument
, 0, 'm'},
21 {"batch", required_argument
, 0, 'b'},
22 {"version", no_argument
, 0, 'v'},
23 {"help", no_argument
, 0, 'h'},
27 static void help(void)
29 printf("\ngremlin %s, a threaded packet beast with Cisco-cli\n",
31 printf("http://www.netsniff-ng.org\n\n");
32 printf("Usage: gremlin [options]\n");
34 printf(" -m|--mgmt <dev> Bound management netdev\n");
35 printf(" -b|--batch <file> Batch file to process\n");
36 printf(" -v|--version Print version\n");
37 printf(" -h|--help Print this help\n");
39 printf("Examples:\n");
40 printf(" gremlin --mgmt eth5\n");
41 printf(" gremlin --batch cli-test.batch\n");
44 printf(" gremlin uses parts of Herbert Haas' legendary Mausezahn\n");
45 printf(" traffic generator. Its backend was replaced for reasons of\n");
46 printf(" better performance and its functionality was extended.\n");
48 printf("Please report bugs to <bugs@netsniff-ng.org>\n");
49 printf("Copyright (C) 2011-2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,\n");
50 printf("Swiss federal institute of technology (ETH Zurich)\n");
51 printf("License: GNU GPL version 2\n");
52 printf("This is free software: you are free to change and redistribute it.\n");
53 printf("There is NO WARRANTY, to the extent permitted by law.\n\n");
57 static void version(void)
59 printf("\ngremlin %s, a threaded packet beast with Cisco-cli\n",
61 printf("http://www.netsniff-ng.org\n\n");
62 printf("Please report bugs to <bugs@netsniff-ng.org>\n");
63 printf("Copyright (C) 2011-2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,\n");
64 printf("Swiss federal institute of technology (ETH Zurich)\n");
65 printf("License: GNU GPL version 2\n");
66 printf("This is free software: you are free to change and redistribute it.\n");
67 printf("There is NO WARRANTY, to the extent permitted by law.\n\n");
71 int main(int argc
, char **argv
)
73 int ret
, c
, opt_index
;
80 while (argc
> 2 && (c
= getopt_long(argc
, argv
, short_options
,
81 long_options
, &opt_index
)) != EOF
) {
90 file
= xstrdup(optarg
);
93 netdev
= xstrdup(optarg
);
99 panic("Option -%c requires an argument!\n",
103 whine("Unknown option character "
104 "`0x%X\'!\n", optopt
);
112 if (!file
&& !netdev
)