diff options
author | Dario Lombardo <lomato@gmail.com> | 2020-07-16 15:39:54 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-07-18 04:04:59 +0000 |
commit | a60bc4da846a32824fa4f60871fb6c16eb0067e5 (patch) | |
tree | e4150ce4fe5385187d25b9cef964012f45f4b95e /extcap | |
parent | b15ebdf0ab423c2f1fdd233e02d4498baa94096e (diff) | |
download | wireshark-a60bc4da846a32824fa4f60871fb6c16eb0067e5.tar.gz wireshark-a60bc4da846a32824fa4f60871fb6c16eb0067e5.tar.bz2 wireshark-a60bc4da846a32824fa4f60871fb6c16eb0067e5.zip |
sshdump: allow for multiple instances.
sshdump can now be copied in multiple instances. Each instance will
show up a different interface and will have its own profile.
This will help users connecting to different hosts. Instead of changing
profiles, sshdump can be cloned, and each instance will be used for a
single host.
Change-Id: If4fb42cf78021c6f16213ae91cbf41ec7f61ca77
Reviewed-on: https://code.wireshark.org/review/37883
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'extcap')
-rw-r--r-- | extcap/sshdump.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/extcap/sshdump.c b/extcap/sshdump.c index 5d5861cb5b..df3b50f86f 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -27,11 +27,13 @@ #include <cli_main.h> +static gchar* sshdump_extcap_interface; +#define DEFAULT_SSHDUMP_EXTCAP_INTERFACE "sshdump" + #define SSHDUMP_VERSION_MAJOR "1" #define SSHDUMP_VERSION_MINOR "0" #define SSHDUMP_VERSION_RELEASE "0" -#define SSH_EXTCAP_INTERFACE "sshdump" #define SSH_READ_BLOCK_SIZE 256 enum { @@ -267,8 +269,8 @@ static int list_config(char *interface, unsigned int remote_port) return EXIT_FAILURE; } - if (g_strcmp0(interface, SSH_EXTCAP_INTERFACE)) { - g_warning("ERROR: interface must be %s", SSH_EXTCAP_INTERFACE); + if (g_strcmp0(interface, sshdump_extcap_interface)) { + g_warning("ERROR: interface must be %s", sshdump_extcap_interface); return EXIT_FAILURE; } @@ -352,6 +354,9 @@ int main(int argc, char *argv[]) char* help_header = NULL; gboolean use_sudo = FALSE; gboolean noprom = FALSE; + gchar* interface_description = g_strdup("SSH remote capture"); + + sshdump_extcap_interface = g_path_get_basename(argv[0]); /* * Get credential information for later use. @@ -374,7 +379,13 @@ int main(int argc, char *argv[]) SSHDUMP_VERSION_RELEASE, help_url); g_free(help_url); add_libssh_info(extcap_conf); - extcap_base_register_interface(extcap_conf, SSH_EXTCAP_INTERFACE, "SSH remote capture", 147, "Remote capture dependent DLT"); + if (g_strcmp0(sshdump_extcap_interface, DEFAULT_SSHDUMP_EXTCAP_INTERFACE)) { + gchar* temp = interface_description; + interface_description = g_strdup_printf("%s, custom version", interface_description); + g_free(temp); + } + extcap_base_register_interface(extcap_conf, sshdump_extcap_interface, interface_description, 147, "Remote capture dependent DLT"); + g_free(interface_description); help_header = g_strdup_printf( " %s --extcap-interfaces\n" @@ -382,8 +393,8 @@ int main(int argc, char *argv[]) " %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 " "--remote-username myuser --remote-interface eth2 --remote-capture-command 'tcpdump -U -i eth0 -w -' " - "--fifo=FILENAME --capture\n", argv[0], argv[0], SSH_EXTCAP_INTERFACE, argv[0], - SSH_EXTCAP_INTERFACE, argv[0], SSH_EXTCAP_INTERFACE); + "--fifo=FILENAME --capture\n", argv[0], argv[0], sshdump_extcap_interface, argv[0], + sshdump_extcap_interface, argv[0], sshdump_extcap_interface); extcap_help_add_header(extcap_conf, help_header); g_free(help_header); extcap_help_add_option(extcap_conf, "--help", "print this help"); |