Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / extcap / ssh-base.h
blobc95f27d810d60fd27da34c00be9fa6215fbe5a85
1 /** @file
3 * ssh-base has base utility functions to connect to hosts via ssh
5 * Copyright 2016, Dario Lombardo
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 #ifndef __SSHBASE_H__
15 #define __SSHBASE_H__
17 #include <libssh/libssh.h>
19 #include <glib.h>
21 #include <extcap/extcap-base.h>
23 #ifndef STDERR_FILENO
24 #define STDERR_FILENO 2
25 #endif
27 #ifndef STDOUT_FILENO
28 #define STDOUT_FILENO 1
29 #endif
31 #define SSH_BASE_OPTIONS \
32 { "remote-host", ws_required_argument, NULL, OPT_REMOTE_HOST}, \
33 { "remote-port", ws_required_argument, NULL, OPT_REMOTE_PORT}, \
34 { "remote-username", ws_required_argument, NULL, OPT_REMOTE_USERNAME}, \
35 { "remote-password", ws_required_argument, NULL, OPT_REMOTE_PASSWORD}, \
36 { "remote-count", ws_required_argument, NULL, OPT_REMOTE_COUNT}, \
37 { "sshkey", ws_required_argument, NULL, OPT_SSHKEY}, \
38 { "sshkey-passphrase", ws_required_argument, NULL, OPT_SSHKEY_PASSPHRASE}, \
39 { "proxycommand", ws_required_argument, NULL, OPT_PROXYCOMMAND}, \
40 { "ssh-sha1", ws_no_argument, NULL, OPT_SSH_SHA1}
42 #define SSH_BASE_PACKET_OPTIONS \
43 SSH_BASE_OPTIONS, \
44 { "remote-interface", ws_required_argument, NULL, OPT_REMOTE_INTERFACE}, \
45 { "remote-filter", ws_required_argument, NULL, OPT_REMOTE_FILTER}
47 typedef struct _ssh_params {
48 char* host;
49 uint16_t port;
50 char* username;
51 char* password;
52 char* sshkey_path;
53 char* sshkey_passphrase;
54 char* proxycommand;
55 bool ssh_sha1;
56 int debug;
57 } ssh_params_t;
59 /* Add libssh version information to an extcap_parameters structure */
60 void add_libssh_info(extcap_parameters * extcap_conf);
62 /* Create a ssh connection using all the possible authentication methods */
63 ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_info);
65 /* Write a formatted message in the channel */
66 int ssh_channel_printf(ssh_channel channel, const char* fmt, ...);
68 /* Clean the current ssh session and channel. */
69 void ssh_cleanup(ssh_session* sshs, ssh_channel* channel);
71 /* Init the ssh_params_t structure */
72 ssh_params_t* ssh_params_new(void);
74 /* Clean the ssh params */
75 void ssh_params_free(ssh_params_t* ssh_params);
77 /* Sets the libssh log level to match the ws log level */
78 void ssh_params_set_log_level(ssh_params_t* ssh_params, enum ws_log_level level);
80 #endif
83 * Editor modelines - https://www.wireshark.org/tools/modelines.html
85 * Local variables:
86 * c-basic-offset: 8
87 * tab-width: 8
88 * indent-tabs-mode: t
89 * End:
91 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
92 * :indentSize=8:tabSize=8:noTabs=false: