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 
43 typedef struct _ssh_params {
44  char* host;
45  uint16_t port;
46  char* username;
47  char* password;
48  char* sshkey_path;
49  char* sshkey_passphrase;
50  char* proxycommand;
51  bool debug;
52 } ssh_params_t;
53 
54 /* Add libssh version information to an extcap_parameters structure */
55 void add_libssh_info(extcap_parameters * extcap_conf);
56 
57 /* Create a ssh connection using all the possible authentication menthods */
58 ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_info);
59 
60 /* Write a formatted message in the channel */
61 int ssh_channel_printf(ssh_channel channel, const char* fmt, ...);
62 
63 /* Clean the current ssh session and channel. */
64 void ssh_cleanup(ssh_session* sshs, ssh_channel* channel);
65 
66 /* Init the ssh_params_t structure */
67 ssh_params_t* ssh_params_new(void);
68 
69 /* Clean the ssh params */
70 void ssh_params_free(ssh_params_t* ssh_params);
71 
72 #endif
73 
74 /*
75  * Editor modelines - https://www.wireshark.org/tools/modelines.html
76  *
77  * Local variables:
78  * c-basic-offset: 8
79  * tab-width: 8
80  * indent-tabs-mode: t
81  * End:
82  *
83  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
84  * :indentSize=8:tabSize=8:noTabs=false:
85  */
Definition: extcap-base.h:60
Definition: ssh-base.h:43