Home » Developing U++ » U++ Developers corner » SFTP or full SSH2 support for U++? (Discussion about implementing the SSH2 protocol using libssh2)
Re: SSH2 wrapper for U++ [message #48875 is a reply to message #45813] |
Thu, 19 October 2017 00:55 |
Oblivion
Messages: 1094 Registered: August 2007
|
Senior Contributor |
|
|
Hello,
SSH package is updated.
2017-10-17: Class names finalized:
Core/base class -> Ssh
Session class -> SshSession
SFtp class -> SFtp
Channel class -> SshChannel
Scp class -> Scp
Exec class -> SshExec
Knownhosts class -> SshHosts
SshAgents -> (will be added as such)
CreateSFtp(), CreateExec(), CreateScp(), CreateChannel() methods added to SshSession
class.
Logging further refined.
Error management further refined.
New version of crucial SSH components are re-added to the packaet.
As you can see in the above history entry, component names are being finalized. I am satisfied with these new namings, and would like to hear your commennts.
Also I added CreateSFtp(), CreateExec(), CreateScp(), CreateChannel() methods to SshSession class.
Since now we have pick semantics, these methods are IMO more elegant than explicity constructing subsystem objecs.
A simple use case would be as follows (below code is a part of SFtpDemo, by the way. (since Rebex test server is actually a SFtp server, with exec support, I did not change the example name):
void GetFileInfoViaExec(SshSession& session)
{
DLOG("---- Getting directory listing of " << file << " using SshExec (blocking):");
auto exec = session.CreateExec();
DDUMP(exec(String(cmd) + file, Cout(), Cerr()));
}
As I announced in my previous message, SSH package recently gained a completely optional NetProxy support.
(see Bazaar section https:// www.ultimatepp.org/forums/index.php?t=msg&th=10132&g oto=48812&#msg_48812 for NetProxy package)
Here is the minimal example code (this is a real test code that works):
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_FILE | LOG_COUT | LOG_TIMESTAMP);
// Ssh::Trace();
SshSession session;
session.WhenProxy = [=](TcpSocket& sock) {
NetProxy proxy(sock, proxy_host, proxy_port);
return proxy.Timeout(10000)
.Socks5()
.Auth(proxy_username, proxy_password)
.Connect(ssh_host, ssh_port);
};
if(session.Connect(ssh_host, ssh_port, username, password)) {
auto exec = session.CreateExec();
DDUMP(exec("ls -l /readme.txt", Cout(), Cerr());
}
else Cerr() << session.GetErrorDesc() << "\n";
}
RTTI support is also re-implemented.
Soon I'll move SSH package out of technical preview phase to beta. But before that I have to add documentation, a proper multithreading support, and missing classes (SshHost, SshAgents).
On multithreading:
The design of SSH core (base) class "ssh" allowed me to easily add an "internal" MT support using a compile-time switch (I did not yet publish that code).
But I haven't really decided to add MT that way. Using convenience functions (SFtpGet, SFtpPut, ScpGet, ScpPut, AsyncExec) seem a simpler and better managable way to go.
But I'd like to hear yout thoughts on that matter too.
I apprecieate reviews, bug reports, patches, suggestions, criticism.
Best regards,
Oblivion.
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Thu, 19 October 2017 10:13] Report message to a moderator
|
|
|
|
|
SFTP or full SSH2 support for U++?
By: Oblivion on Sun, 10 January 2016 12:58
|
|
|
Re: SFTP or full SSH2 support for U++?
By: mirek on Sun, 10 January 2016 23:02
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Mon, 11 January 2016 09:10
|
|
|
Re: SFTP or full SSH2 support for U++?
By: mirek on Mon, 11 January 2016 09:47
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Tue, 26 January 2016 21:02
|
|
|
Re: SFTP or full SSH2 support for U++?
By: mirek on Sun, 31 January 2016 09:26
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Mon, 01 February 2016 00:06
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Sun, 06 March 2016 23:39
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Sat, 13 May 2017 21:01
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Sun, 14 May 2017 17:46
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Wed, 28 June 2017 14:46
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Wed, 28 June 2017 15:29
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Wed, 28 June 2017 16:04
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Sat, 01 July 2017 17:35
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: koldo on Sun, 02 July 2017 19:14
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Sun, 02 July 2017 19:49
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: koldo on Mon, 03 July 2017 08:39
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Mon, 03 July 2017 10:33
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Tue, 04 July 2017 08:57
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Tue, 04 July 2017 09:12
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Sat, 12 August 2017 22:49
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Mon, 14 August 2017 12:41
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Mon, 14 August 2017 14:26
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Mon, 14 August 2017 14:46
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Mon, 14 August 2017 14:52
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Mon, 14 August 2017 14:57
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Sun, 15 October 2017 23:10
|
|
|
Re: SFTP or full SSH2 support for U++?
By: koldo on Mon, 16 October 2017 08:58
|
|
|
Re: SSH2 wrapper for U++
By: Oblivion on Thu, 19 October 2017 00:55
|
|
|
Re: SSH2 wrapper for U++
By: Tom1 on Thu, 19 October 2017 14:16
|
|
|
Re: SSH2 wrapper for U++
By: Oblivion on Thu, 19 October 2017 15:09
|
|
|
Re: SSH2 wrapper for U++
By: Tom1 on Mon, 23 October 2017 08:29
|
|
|
SSH package for U++ (alpha version)
By: Oblivion on Mon, 13 November 2017 21:25
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Tue, 14 November 2017 08:38
|
|
|
Re: SFTP or full SSH2 support for U++?
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Tue, 14 November 2017 12:41
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Tom1 on Tue, 14 November 2017 14:27
|
|
|
Re: SFTP or full SSH2 support for U++?
By: Oblivion on Tue, 14 November 2017 21:51
|
Goto Forum:
Current Time: Thu May 16 21:11:36 CEST 2024
Total time taken to generate the page: 0.02527 seconds
|