2 * ssh-base has base utility functions to connect to hosts via ssh
4 * Copyright 2016, Dario Lombardo
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include <libssh/libssh.h>
21 #define STDERR_FILENO 2
25 #define STDOUT_FILENO 1
28 #define SSH_BASE_OPTIONS \
29 { "remote-host", required_argument, NULL, OPT_REMOTE_HOST}, \
30 { "remote-port", required_argument, NULL, OPT_REMOTE_PORT}, \
31 { "remote-username", required_argument, NULL, OPT_REMOTE_USERNAME}, \
32 { "remote-password", required_argument, NULL, OPT_REMOTE_PASSWORD}, \
33 { "remote-interface", required_argument, NULL, OPT_REMOTE_INTERFACE}, \
34 { "remote-filter", required_argument, NULL, OPT_REMOTE_FILTER}, \
35 { "remote-count", required_argument, NULL, OPT_REMOTE_COUNT}, \
36 { "sshkey", required_argument, NULL, OPT_SSHKEY}, \
37 { "sshkey-passphrase", required_argument, NULL, OPT_SSHKEY_PASSPHRASE}, \
38 { "proxycommand", required_argument, NULL, OPT_PROXYCOMMAND}
40 typedef struct _ssh_params {
46 gchar* sshkey_passphrase;
51 /* Create a ssh connection using all the possible authentication menthods */
52 ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_info);
54 /* Write a formatted message in the channel */
55 int ssh_channel_printf(ssh_channel channel, const char* fmt, ...);
57 /* Clean the current ssh session and channel. */
58 void ssh_cleanup(ssh_session* sshs, ssh_channel* channel);
60 /* Init the ssh_params_t structure */
61 ssh_params_t* ssh_params_new(void);
63 /* Clean the ssh params */
64 void ssh_params_free(ssh_params_t* ssh_params);
69 * Editor modelines - https://www.wireshark.org/tools/modelines.html
77 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
78 * :indentSize=8:tabSize=8:noTabs=false: