forked from rubdos/libssh2pp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.cpp
26 lines (23 loc) · 786 Bytes
/
tests.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "libssh2.hpp"
#include <iostream>
#include <bitset>
int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl;
try
{
libssh2::session s;
s.open("127.0.0.1", 8989);
libssh2::fingerprint f = s.get_host_fingerprint();
std::cout << "SHA1 fingerprint: " << f.get_hex_sha1() << std::endl
<< "MD5 fingerprint: " << f.get_hex_md5() << std::endl;
std::cout << "Auth methods for ruben: " << std::bitset<8>(s.get_auth_methods("ruben")) << std::endl;
s.auth_password("username","password");
libssh2::channel* c = s.open_channel();
c->request_pty();
}
catch(libssh2::exception e)
{
std::cerr << e.what() << std::endl;
}
return 0;
}