Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
ssh-base.h
1 /* ssh-base.h
2  * ssh-base has base utility functions to connect to hosts via ssh
3  *
4  * Copyright 2016, Dario Lombardo
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 
13 #ifndef __SSHBASE_H__
14 #define __SSHBASE_H__
15 
16 #include <libssh/libssh.h>
17 
18 #include <glib.h>
19 
20 #ifndef STDERR_FILENO
21 #define STDERR_FILENO 2
22 #endif
23 
24 #ifndef STDOUT_FILENO
25 #define STDOUT_FILENO 1
26 #endif
27 
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 
39 /* Create a ssh connection using all the possible authentication menthods */
40 ssh_session create_ssh_connection(const char* hostname, const guint16 port, const char* username,
41  const char* password, const char* sshkey_path, const char* sshkey_passphrase, char** err_info);
42 
43 /* Write a formatted message in the channel */
44 int ssh_channel_printf(ssh_channel channel, const char* fmt, ...);
45 
46 /* Clean the current ssh session and channel. */
47 void ssh_cleanup(ssh_session* sshs, ssh_channel* channel);
48 
49 #endif
50 
51 /*
52  * Editor modelines - https://www.wireshark.org/tools/modelines.html
53  *
54  * Local variables:
55  * c-basic-offset: 8
56  * tab-width: 8
57  * indent-tabs-mode: t
58  * End:
59  *
60  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
61  * :indentSize=8:tabSize=8:noTabs=false:
62  */