2010-02-12 01:08:07 +03:00
|
|
|
/*
|
|
|
|
Copyright 2010 Aris Adamantiadis
|
2010-01-21 23:54:20 +03:00
|
|
|
|
2010-02-12 01:08:07 +03:00
|
|
|
This file is part of the SSH Library
|
|
|
|
|
|
|
|
You are free to copy this file, modify it in any way, consider it being public
|
|
|
|
domain. This does not apply to the rest of the library though, but it is
|
|
|
|
allowed to cut-and-paste working code from this file to any license of
|
|
|
|
program.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This file demonstrates the use of the C++ wrapper to libssh */
|
|
|
|
|
|
|
|
#include <iostream>
|
2010-01-21 23:54:20 +03:00
|
|
|
#include <libssh/libsshpp.hpp>
|
|
|
|
|
|
|
|
int main(int argc, const char **argv){
|
2010-02-13 00:17:50 +03:00
|
|
|
ssh::Session session,s2;
|
2010-02-12 01:08:07 +03:00
|
|
|
try {
|
|
|
|
if(argc>1)
|
|
|
|
session.setOption(SSH_OPTIONS_HOST,argv[1]);
|
|
|
|
else
|
|
|
|
session.setOption(SSH_OPTIONS_HOST,"localhost");
|
|
|
|
session.connect();
|
|
|
|
session.userauthAutopubkey();
|
|
|
|
} catch (ssh::SshException e){
|
|
|
|
std::cout << "Error during connection : ";
|
|
|
|
std::cout << e.getError() << std::endl;
|
|
|
|
}
|
2010-02-13 00:17:50 +03:00
|
|
|
//s2=session;
|
2010-01-21 23:54:20 +03:00
|
|
|
return 0;
|
|
|
|
}
|