forked from osmocom/wireshark
extcap: restyle the help function.
Change-Id: Ia742dffb1fd4cd5780b8ba44f7064d1874e473da Reviewed-on: https://code.wireshark.org/review/16842 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
parent
7e08f15885
commit
a671bab337
|
@ -1048,27 +1048,6 @@ static int list_config(char *interface) {
|
|||
return EXIT_CODE_INVALID_INTERFACE;
|
||||
}
|
||||
|
||||
|
||||
static void help(void) {
|
||||
unsigned int i_opt;
|
||||
|
||||
printf("Help\n");
|
||||
printf(" Usage:\n"
|
||||
" androiddump --extcap-interfaces [--adb-server-ip=<arg>] [--adb-server-tcp-port=<arg>]\n"
|
||||
" androiddump --extcap-interface=INTERFACE --extcap-dlts\n"
|
||||
" androiddump --extcap-interface=INTERFACE --extcap-config\n"
|
||||
" androiddump --extcap-interface=INTERFACE --fifo=PATH_FILENAME --capture \n");
|
||||
|
||||
printf("\n Parameters:\n");
|
||||
for (i_opt = 0; i_opt < (sizeof(longopts) / sizeof(longopts[0])) - 1; i_opt += 1) {
|
||||
printf(" --%s%s\n", longopts[i_opt].name,
|
||||
(longopts[i_opt].has_arg == required_argument) ? "=<arg>" :
|
||||
((longopts[i_opt].has_arg == optional_argument) ? "[=arg]" : ""));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Android Bluetooth Hcidump */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
@ -2530,6 +2509,7 @@ int main(int argc, char **argv) {
|
|||
const char *default_bt_local_ip = "127.0.0.1";
|
||||
unsigned short default_bt_local_tcp_port = 4330;
|
||||
extcap_parameters * extcap_conf = NULL;
|
||||
char *help_header = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
|
@ -2537,16 +2517,37 @@ int main(int argc, char **argv) {
|
|||
attach_parent_console();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
extcap_conf = g_new0(extcap_parameters, 1);
|
||||
|
||||
extcap_base_set_util_info(extcap_conf, ANDROIDDUMP_VERSION_MAJOR, ANDROIDDUMP_VERSION_MINOR, ANDROIDDUMP_VERSION_RELEASE, NULL);
|
||||
|
||||
help_header = g_strdup_printf(
|
||||
" %s --extcap-interfaces [--adb-server-ip=<arg>] [--adb-server-tcp-port=<arg>]\n"
|
||||
" %s --extcap-interface=INTERFACE --extcap-dlts\n"
|
||||
" %s --extcap-interface=INTERFACE --extcap-config\n"
|
||||
" %s --extcap-interface=INTERFACE --fifo=PATH_FILENAME --capture \n",
|
||||
argv[0], argv[0], argv[0], argv[0]);
|
||||
extcap_help_add_header(extcap_conf, help_header);
|
||||
g_free(help_header);
|
||||
|
||||
extcap_help_add_option(extcap_conf, "--help", "print this help");
|
||||
extcap_help_add_option(extcap_conf, "--version", "print the version");
|
||||
extcap_help_add_option(extcap_conf, "--verbose", "verbose mode");
|
||||
extcap_help_add_option(extcap_conf, "--adb-server-ip <IP>", "the IP address of the ADB server");
|
||||
extcap_help_add_option(extcap_conf, "--adb-server-tcp-port <port>", "the TCP port of the ADB server");
|
||||
extcap_help_add_option(extcap_conf, "--logcat-text <text>", "logcat text");
|
||||
extcap_help_add_option(extcap_conf, "--bt-server-tcp-port <port>", "bluetooth server TCP port");
|
||||
extcap_help_add_option(extcap_conf, "--bt-forward-socket <path>", "bluetooth forward socket");
|
||||
extcap_help_add_option(extcap_conf, "--bt-local-ip <IP>", "the bluetooth local IP");
|
||||
extcap_help_add_option(extcap_conf, "--bt-local-tcp-port <port>", "the bluetooth local TCP port");
|
||||
|
||||
opterr = 0;
|
||||
optind = 0;
|
||||
|
||||
if (argc == 1) {
|
||||
help();
|
||||
extcap_help_print(extcap_conf);
|
||||
return EXIT_CODE_SUCCESS;
|
||||
}
|
||||
extcap_conf = g_new0(extcap_parameters, 1);
|
||||
|
||||
extcap_base_set_util_info(extcap_conf, ANDROIDDUMP_VERSION_MAJOR, ANDROIDDUMP_VERSION_MINOR, ANDROIDDUMP_VERSION_RELEASE, NULL);
|
||||
|
||||
while ((result = getopt_long(argc, argv, "", longopts, &option_idx)) != -1) {
|
||||
switch (result) {
|
||||
|
@ -2555,7 +2556,7 @@ int main(int argc, char **argv) {
|
|||
printf("%s.%s.%s\n", ANDROIDDUMP_VERSION_MAJOR, ANDROIDDUMP_VERSION_MINOR, ANDROIDDUMP_VERSION_RELEASE);
|
||||
return EXIT_CODE_SUCCESS;
|
||||
case OPT_HELP:
|
||||
help();
|
||||
extcap_help_print(extcap_conf);
|
||||
return EXIT_CODE_SUCCESS;
|
||||
case OPT_CONFIG_ADB_SERVER_IP:
|
||||
adb_server_ip = optarg;
|
||||
|
|
|
@ -469,37 +469,6 @@ cleanup:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void help(const char* binname)
|
||||
{
|
||||
printf("Help\n");
|
||||
printf(" Usage:\n");
|
||||
printf(" %s --extcap-interfaces\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --extcap-dlts\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --extcap-config\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --remote-host myhost --remote-port 22222 "
|
||||
"--remote-username myuser --remote-interface gigabit0/0 "
|
||||
"--fifo=FILENAME --capture\n", binname);
|
||||
printf("\n\n");
|
||||
printf(" --help: print this help\n");
|
||||
printf(" --version: print the version\n");
|
||||
printf(" --verbose: print more messages\n");
|
||||
printf(" --extcap-interfaces: list the interfaces\n");
|
||||
printf(" --extcap-interface <iface>: specify the interface\n");
|
||||
printf(" --extcap-dlts: list the DTLs for an interface\n");
|
||||
printf(" --extcap-config: list the additional configuration for an interface\n");
|
||||
printf(" --extcap-capture-filter <filter>: the capture filter\n");
|
||||
printf(" --capture: run the capture\n");
|
||||
printf(" --fifo <file>: dump data to file or fifo\n");
|
||||
printf(" --remote-host <host>: the remote SSH host\n");
|
||||
printf(" --remote-port <port>: the remote SSH port (default: 22)\n");
|
||||
printf(" --remote-username <username>: the remote SSH username (default: the current user)\n");
|
||||
printf(" --remote-password <password>: the remote SSH password. If not specified, ssh-agent and ssh-key are used\n");
|
||||
printf(" --sshkey <public key path>: the path of the ssh key\n");
|
||||
printf(" --sshkey-passphrase <public key passphrase>: the passphrase to unlock public ssh\n");
|
||||
printf(" --remote-interface <iface>: the remote capture interface\n");
|
||||
printf(" --remote-filter <filter>: a filter for remote capture (default: don't capture data for local interfaces IPs)\n");
|
||||
}
|
||||
|
||||
static int list_config(char *interface, unsigned int remote_port)
|
||||
{
|
||||
unsigned inc = 0;
|
||||
|
@ -568,6 +537,7 @@ int main(int argc, char **argv)
|
|||
unsigned long int count = 0;
|
||||
int ret = EXIT_FAILURE;
|
||||
extcap_parameters * extcap_conf = g_new0(extcap_parameters, 1);
|
||||
char* help_header = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
|
@ -578,11 +548,35 @@ int main(int argc, char **argv)
|
|||
extcap_base_set_util_info(extcap_conf, CISCODUMP_VERSION_MAJOR, CISCODUMP_VERSION_MINOR, CISCODUMP_VERSION_RELEASE, NULL);
|
||||
extcap_base_register_interface(extcap_conf, CISCODUMP_EXTCAP_INTERFACE, "Cisco remote capture", 147, "Remote capture dependent DLT");
|
||||
|
||||
help_header = g_strdup_printf(
|
||||
" %s --extcap-interfaces\n"
|
||||
" %s --extcap-interface=INTERFACE --extcap-dlts\n"
|
||||
" %s --extcap-interface=INTERFACE --extcap-config\n"
|
||||
" %s --extcap-interface=INTERFACE --remote-host myhost --remote-port 22222 "
|
||||
"--remote-username myuser --remote-interface gigabit0/0 "
|
||||
"--fifo=FILENAME --capture\n", argv[0], argv[0], argv[0], argv[0]);
|
||||
extcap_help_add_header(extcap_conf, help_header);
|
||||
g_free(help_header);
|
||||
|
||||
extcap_help_add_option(extcap_conf, "--help", "print this help");
|
||||
extcap_help_add_option(extcap_conf, "--version", "print the version");
|
||||
extcap_help_add_option(extcap_conf, "--verbose", "print more messages");
|
||||
extcap_help_add_option(extcap_conf, "--remote-host <host>", "the remote SSH host");
|
||||
extcap_help_add_option(extcap_conf, "--remote-port <port>", "the remote SSH port (default: 22)");
|
||||
extcap_help_add_option(extcap_conf, "--remote-username <username>", "the remote SSH username (default: the current user)");
|
||||
extcap_help_add_option(extcap_conf, "--remote-password <password>", "the remote SSH password. "
|
||||
"If not specified, ssh-agent and ssh-key are used");
|
||||
extcap_help_add_option(extcap_conf, "--sshkey <public key path>", "the path of the ssh key");
|
||||
extcap_help_add_option(extcap_conf, "--sshkey-passphrase <public key passphrase>", "the passphrase to unlock public ssh");
|
||||
extcap_help_add_option(extcap_conf, "--remote-interface <iface>", "the remote capture interface");
|
||||
extcap_help_add_option(extcap_conf, "--remote-filter <filter>", "a filter for remote capture "
|
||||
"(default: don't capture data for lal interfaces IPs)");
|
||||
|
||||
opterr = 0;
|
||||
optind = 0;
|
||||
|
||||
if (argc == 1) {
|
||||
help(argv[0]);
|
||||
extcap_help_print(extcap_conf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -594,7 +588,7 @@ int main(int argc, char **argv)
|
|||
switch (result) {
|
||||
|
||||
case OPT_HELP:
|
||||
help(argv[0]);
|
||||
extcap_help_print(extcap_conf);
|
||||
ret = EXIT_SUCCESS;
|
||||
goto end;
|
||||
|
||||
|
|
|
@ -52,6 +52,11 @@ typedef struct _extcap_interface
|
|||
char * dltdescription;
|
||||
} extcap_interface;
|
||||
|
||||
typedef struct _extcap_option {
|
||||
char * optname;
|
||||
char * optdesc;
|
||||
} extcap_option_t;
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOLEAN IsHandleRedirected(DWORD handle)
|
||||
{
|
||||
|
@ -260,6 +265,13 @@ static void extcap_iface_free(gpointer data)
|
|||
g_free(iface);
|
||||
}
|
||||
|
||||
static void extcap_help_option_free(gpointer option)
|
||||
{
|
||||
extcap_option_t* o = (extcap_option_t*)option;
|
||||
g_free(o->optname);
|
||||
g_free(o->optdesc);
|
||||
}
|
||||
|
||||
void extcap_base_cleanup(extcap_parameters ** extcap)
|
||||
{
|
||||
/* g_list_free_full() only exists since 2.28. g_list_free_full((*extcap)->interfaces, extcap_iface_free);*/
|
||||
|
@ -269,10 +281,51 @@ void extcap_base_cleanup(extcap_parameters ** extcap)
|
|||
g_free((*extcap)->interface);
|
||||
g_free((*extcap)->version);
|
||||
g_free((*extcap)->helppage);
|
||||
g_free((*extcap)->help_header);
|
||||
g_list_foreach((*extcap)->help_options, (GFunc)extcap_help_option_free, NULL);
|
||||
g_list_free((*extcap)->help_options);
|
||||
g_free(*extcap);
|
||||
*extcap = NULL;
|
||||
}
|
||||
|
||||
static void extcap_print_option(gpointer option)
|
||||
{
|
||||
extcap_option_t* o = (extcap_option_t*)option;
|
||||
printf("\t%s: %s\n", o->optname, o->optdesc);
|
||||
}
|
||||
|
||||
void extcap_help_print(extcap_parameters * extcap)
|
||||
{
|
||||
printf("\nHelp\n\nUsage:\n");
|
||||
printf("%s", extcap->help_header);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
g_list_foreach(extcap->help_options, (GFunc)extcap_print_option, NULL);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void extcap_help_add_option(extcap_parameters * extcap, const char * help_option_name, const char * help_option_desc)
|
||||
{
|
||||
extcap_option_t* o = g_new0(extcap_option_t, 1);
|
||||
o->optname = g_strdup(help_option_name);
|
||||
o->optdesc = g_strdup(help_option_desc);
|
||||
|
||||
extcap->help_options = g_list_append(extcap->help_options, o);
|
||||
}
|
||||
|
||||
|
||||
void extcap_help_add_header(extcap_parameters * extcap, char * help_header)
|
||||
{
|
||||
extcap->help_header = g_strdup(help_header);
|
||||
extcap_help_add_option(extcap, "--extcap-interfaces", "list the extcap Interfaces");
|
||||
extcap_help_add_option(extcap, "--extcap-dlts", "list the DLTs");
|
||||
extcap_help_add_option(extcap, "--extcap-interface <iface>", "specify the extcap interface");
|
||||
extcap_help_add_option(extcap, "--extcap-config", "list the additional configuration for an interface");
|
||||
extcap_help_add_option(extcap, "--capture", "run the capture");
|
||||
extcap_help_add_option(extcap, "--extcap-capture-filter <filter>", "the capture filter");
|
||||
extcap_help_add_option(extcap, "--fifo <file>", "dump data to file or fifo");
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -116,6 +116,9 @@ typedef struct _extcap_parameters
|
|||
uint8_t do_list_dlts;
|
||||
uint8_t do_list_interfaces;
|
||||
|
||||
char * help_header;
|
||||
GList * help_options;
|
||||
|
||||
} extcap_parameters;
|
||||
|
||||
void extcap_base_register_interface(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltdescription );
|
||||
|
@ -124,6 +127,11 @@ void extcap_base_set_util_info(extcap_parameters * extcap, const char * major, c
|
|||
uint8_t extcap_base_parse_options(extcap_parameters * extcap, int result, char * optargument);
|
||||
uint8_t extcap_base_handle_interface(extcap_parameters * extcap);
|
||||
void extcap_base_cleanup(extcap_parameters ** extcap);
|
||||
void extcap_help_add_header(extcap_parameters * extcap, char * help_header);
|
||||
void extcap_help_add_option(extcap_parameters * extcap, const char * help_option_name, const char * help_optionn_desc);
|
||||
void extcap_help_print(extcap_parameters * extcap);
|
||||
|
||||
void extcap_base_help(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -57,36 +57,15 @@ static struct option longopts[] = {
|
|||
};
|
||||
|
||||
|
||||
static void help(const char* binname)
|
||||
static void help(extcap_parameters* extcap_conf)
|
||||
{
|
||||
unsigned i = 0;
|
||||
char** abbrev_list;
|
||||
char** longname_list;
|
||||
|
||||
printf("Help\n");
|
||||
printf(" Usage:\n");
|
||||
printf(" %s --extcap-interfaces\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --extcap-dlts\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --extcap-config\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --type dns --count 10"
|
||||
"--fifo=FILENAME --capture\n", binname);
|
||||
printf("\n\n");
|
||||
printf(" --help: print this help\n");
|
||||
printf(" --version: print the version\n");
|
||||
printf(" --verbose: verbose mode\n");
|
||||
printf(" --extcap-interfaces: list the extcap Interfaces\n");
|
||||
printf(" --extcap-dlts: list the DLTs\n");
|
||||
printf(" --extcap-interface <iface>: specify the extcap interface\n");
|
||||
printf(" --extcap-config: list the additional configuration for an interface\n");
|
||||
printf(" --capture: run the capture\n");
|
||||
printf(" --extcap-capture-filter <filter>: the capture filter\n");
|
||||
printf(" --fifo <file>: dump data to file or fifo\n");
|
||||
printf(" --maxbytes <bytes>: max bytes per packet");
|
||||
printf(" --count <num>: number of packets to generate\n");
|
||||
printf(" --random-type: one random type is chosen for all packets\n");
|
||||
printf(" --all-random: a random type is chosen for each packet\n");
|
||||
printf(" --type <type>: the packet type\n");
|
||||
printf("\n\nPacket types:\n");
|
||||
extcap_help_print(extcap_conf);
|
||||
|
||||
printf("\nPacket types:\n");
|
||||
randpkt_example_list(&abbrev_list, &longname_list);
|
||||
while (abbrev_list[i] && longname_list[i]) {
|
||||
printf("\t%-16s%s\n", abbrev_list[i], longname_list[i]);
|
||||
|
@ -95,7 +74,6 @@ static void help(const char* binname)
|
|||
printf("\n");
|
||||
g_strfreev(abbrev_list);
|
||||
g_strfreev(longname_list);
|
||||
|
||||
}
|
||||
|
||||
static int list_config(char *interface)
|
||||
|
@ -164,12 +142,31 @@ int main(int argc, char *argv[])
|
|||
#endif /* _WIN32 */
|
||||
|
||||
extcap_parameters * extcap_conf = g_new0(extcap_parameters, 1);
|
||||
char* help_header = NULL;
|
||||
|
||||
extcap_base_set_util_info(extcap_conf, RANDPKTDUMP_VERSION_MAJOR, RANDPKTDUMP_VERSION_MINOR, RANDPKTDUMP_VERSION_RELEASE, NULL);
|
||||
extcap_base_register_interface(extcap_conf, RANDPKT_EXTCAP_INTERFACE, "Random packet generator", 147, "Generator dependent DLT");
|
||||
|
||||
help_header = g_strdup_printf(
|
||||
" %s --extcap-interfaces\n"
|
||||
" %s --extcap-interface=INTERFACE --extcap-dlts\n"
|
||||
" %s --extcap-interface=INTERFACE --extcap-config\n"
|
||||
" %s --extcap-interface=INTERFACE --type dns --count 10 "
|
||||
"--fifo=FILENAME --capture\n", argv[0], argv[0], argv[0], argv[0]);
|
||||
extcap_help_add_header(extcap_conf, help_header);
|
||||
g_free(help_header);
|
||||
|
||||
extcap_help_add_option(extcap_conf, "--help", "print this help");
|
||||
extcap_help_add_option(extcap_conf, "--version", "print the version");
|
||||
extcap_help_add_option(extcap_conf, "--verbose", "verbose mode");
|
||||
extcap_help_add_option(extcap_conf, "--maxbytes <bytes>", "max bytes per pack");
|
||||
extcap_help_add_option(extcap_conf, "--count <num>", "number of packets to generate");
|
||||
extcap_help_add_option(extcap_conf, "--random-type", "one random type is chosen for all packets");
|
||||
extcap_help_add_option(extcap_conf, "--all-random", "a random type is chosen for each packet");
|
||||
extcap_help_add_option(extcap_conf, "--type <type>", "the packet type");
|
||||
|
||||
if (argc == 1) {
|
||||
help(argv[0]);
|
||||
help(extcap_conf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -188,7 +185,7 @@ int main(int argc, char *argv[])
|
|||
goto end;
|
||||
|
||||
case OPT_HELP:
|
||||
help(argv[0]);
|
||||
help(extcap_conf);
|
||||
ret = EXIT_SUCCESS;
|
||||
goto end;
|
||||
|
||||
|
|
|
@ -221,38 +221,6 @@ cleanup:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void help(const char* binname)
|
||||
{
|
||||
printf("Help\n");
|
||||
printf(" Usage:\n");
|
||||
printf(" %s --extcap-interfaces\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --extcap-dlts\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --extcap-config\n", binname);
|
||||
printf(" %s --extcap-interface=INTERFACE --remote-host myhost --remote-port 22222 "
|
||||
"--remote-username myuser --remote-interface eth2 --remote-capture-bin /bin/dumpcap "
|
||||
"--fifo=FILENAME --capture\n", binname);
|
||||
printf("\n\n");
|
||||
printf(" --help: print this help\n");
|
||||
printf(" --version: print the version\n");
|
||||
printf(" --verbose: print more messages\n");
|
||||
printf(" --extcap-interfaces: list the interfaces\n");
|
||||
printf(" --extcap-interface <iface>: specify the interface\n");
|
||||
printf(" --extcap-dlts: list the DTLs for an interface\n");
|
||||
printf(" --extcap-config: list the additional configuration for an interface\n");
|
||||
printf(" --extcap-capture-filter <filter>: the capture filter\n");
|
||||
printf(" --capture: run the capture\n");
|
||||
printf(" --fifo <file>: dump data to file or fifo\n");
|
||||
printf(" --remote-host <host>: the remote SSH host\n");
|
||||
printf(" --remote-port <port>: the remote SSH port (default: 22)\n");
|
||||
printf(" --remote-username <username>: the remote SSH username (default: the current user)\n");
|
||||
printf(" --remote-password <password>: the remote SSH password. If not specified, ssh-agent and ssh-key are used\n");
|
||||
printf(" --sshkey <public key path>: the path of the ssh key\n");
|
||||
printf(" --sshkey-passphrase <public key passphrase>: the passphrase to unlock public ssh\n");
|
||||
printf(" --remote-interface <iface>: the remote capture interface (default: eth0)\n");
|
||||
printf(" --remote-capture-bin <capture bin>: the remote dumcap binary (default: %s)\n", DEFAULT_CAPTURE_BIN);
|
||||
printf(" --remote-filter <filter>: a filter for remote capture (default: don't listen on local local interfaces IPs)\n");
|
||||
}
|
||||
|
||||
static char* interfaces_list_to_filter(GSList* interfaces, const unsigned int remote_port)
|
||||
{
|
||||
GString* filter = g_string_new(NULL);
|
||||
|
@ -358,6 +326,7 @@ int main(int argc, char **argv)
|
|||
unsigned long int count = 0;
|
||||
int ret = EXIT_FAILURE;
|
||||
extcap_parameters * extcap_conf = g_new0(extcap_parameters, 1);
|
||||
char* help_header = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
|
@ -368,11 +337,33 @@ int main(int argc, char **argv)
|
|||
extcap_base_set_util_info(extcap_conf, SSHDUMP_VERSION_MAJOR, SSHDUMP_VERSION_MINOR, SSHDUMP_VERSION_RELEASE, NULL);
|
||||
extcap_base_register_interface(extcap_conf, SSH_EXTCAP_INTERFACE, "SSH remote capture", 147, "Remote capture dependent DLT");
|
||||
|
||||
help_header = g_strdup_printf(
|
||||
" %s --extcap-interfaces\n"
|
||||
" %s --extcap-interface=INTERFACE --extcap-dlts\n"
|
||||
" %s --extcap-interface=INTERFACE --extcap-config\n"
|
||||
" %s --extcap-interface=INTERFACE --remote-host myhost --remote-port 22222 "
|
||||
"--remote-username myuser --remote-interface eth2 --remote-capture-bin /bin/dumpcap "
|
||||
"--fifo=FILENAME --capture\n", argv[0], argv[0], argv[0], argv[0]);
|
||||
extcap_help_add_header(extcap_conf, help_header);
|
||||
g_free(help_header);
|
||||
extcap_help_add_option(extcap_conf, "--help", "print this help");
|
||||
extcap_help_add_option(extcap_conf, "--version", "print the version");
|
||||
extcap_help_add_option(extcap_conf, "--verbose", "print more messages");
|
||||
extcap_help_add_option(extcap_conf, "--remote-host <host>", "the remote SSH host");
|
||||
extcap_help_add_option(extcap_conf, "--remote-port <port>", "the remote SSH port (default: 22)");
|
||||
extcap_help_add_option(extcap_conf, "--remote-username <username>", "the remote SSH username (default: the current user)");
|
||||
extcap_help_add_option(extcap_conf, "--remote-password <password>", "the remote SSH password. If not specified, ssh-agent and ssh-key are used");
|
||||
extcap_help_add_option(extcap_conf, "--sshkey <public key path>", "the path of the ssh key");
|
||||
extcap_help_add_option(extcap_conf, "--sshkey-passphrase <public key passphrase>", "the passphrase to unlock public ssh");
|
||||
extcap_help_add_option(extcap_conf, "--remote-interface <iface>", "the remote capture interface (default: eth0)");
|
||||
extcap_help_add_option(extcap_conf, "--remote-capture-bin <capture bin>", "the remote dumcap binary (default: " DEFAULT_CAPTURE_BIN ")");
|
||||
extcap_help_add_option(extcap_conf, "--remote-filter <filter>", "a filter for remote capture (default: don't listen on local local interfaces IPs)\n");
|
||||
|
||||
opterr = 0;
|
||||
optind = 0;
|
||||
|
||||
if (argc == 1) {
|
||||
help(argv[0]);
|
||||
extcap_help_print(extcap_conf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -381,7 +372,7 @@ int main(int argc, char **argv)
|
|||
switch (result) {
|
||||
|
||||
case OPT_HELP:
|
||||
help(argv[0]);
|
||||
extcap_help_print(extcap_conf);
|
||||
ret = EXIT_SUCCESS;
|
||||
goto end;
|
||||
|
||||
|
|
Loading…
Reference in New Issue