aboutsummaryrefslogtreecommitdiffstats
path: root/extcap/sshdump.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-08-02 15:13:13 +0200
committerRoland Knall <rknall@gmail.com>2016-08-04 14:13:53 +0000
commita671bab3373101ce593c78ee1af476719f357028 (patch)
tree0c743bb3f79740d9b5bdd6d5f8889e87ca2721f7 /extcap/sshdump.c
parent7e08f158851910954cbd9d038912a6e46b633cbe (diff)
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>
Diffstat (limited to 'extcap/sshdump.c')
-rw-r--r--extcap/sshdump.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/extcap/sshdump.c b/extcap/sshdump.c
index 4defa88d26..f656275d63 100644
--- a/extcap/sshdump.c
+++ b/extcap/sshdump.c
@@ -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;