Wireshark  4.3.0
The Wireshark network protocol analyzer
ssh-base.h
Go to the documentation of this file.
1 
14 #ifndef __SSHBASE_H__
15 #define __SSHBASE_H__
16 
17 #include <libssh/libssh.h>
18 
19 #include <glib.h>
20 
21 #include <extcap/extcap-base.h>
22 
23 #ifndef STDERR_FILENO
24 #define STDERR_FILENO 2
25 #endif
26 
27 #ifndef STDOUT_FILENO
28 #define STDOUT_FILENO 1
29 #endif
30 
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-interface", ws_required_argument, NULL, OPT_REMOTE_INTERFACE}, \
37  { "remote-filter", ws_required_argument, NULL, OPT_REMOTE_FILTER}, \
38  { "remote-count", ws_required_argument, NULL, OPT_REMOTE_COUNT}, \
39  { "sshkey", ws_required_argument, NULL, OPT_SSHKEY}, \
40  { "sshkey-passphrase", ws_required_argument, NULL, OPT_SSHKEY_PASSPHRASE}, \
41  { "proxycommand", ws_required_argument, NULL, OPT_PROXYCOMMAND}, \
42  { "ssh-sha1", ws_no_argument, NULL, OPT_SSH_SHA1}
43 
44 typedef struct _ssh_params {
45  char* host;
46  uint16_t port;
47  char* username;
48  char* password;
49  char* sshkey_path;
50  char* sshkey_passphrase;
51  char* proxycommand;
52  bool ssh_sha1;
53  int debug;
54 } ssh_params_t;
55 
56 /* Add libssh version information to an extcap_parameters structure */
57 void add_libssh_info(extcap_parameters * extcap_conf);
58 
59 /* Create a ssh connection using all the possible authentication methods */
60 ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_info);
61 
62 /* Write a formatted message in the channel */
63 int ssh_channel_printf(ssh_channel channel, const char* fmt, ...);
64 
65 /* Clean the current ssh session and channel. */
66 void ssh_cleanup(ssh_session* sshs, ssh_channel* channel);
67 
68 /* Init the ssh_params_t structure */
69 ssh_params_t* ssh_params_new(void);
70 
71 /* Clean the ssh params */
72 void ssh_params_free(ssh_params_t* ssh_params);
73 
74 /* Sets the libssh log level to match the ws log level */
75 void ssh_params_set_log_level(ssh_params_t* ssh_params, enum ws_log_level level);
76 
77 #endif
78 
79 /*
80  * Editor modelines - https://www.wireshark.org/tools/modelines.html
81  *
82  * Local variables:
83  * c-basic-offset: 8
84  * tab-width: 8
85  * indent-tabs-mode: t
86  * End:
87  *
88  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
89  * :indentSize=8:tabSize=8:noTabs=false:
90  */
Definition: extcap-base.h:60
Definition: ssh-base.h:44