{"id":16981361,"url":"https://github.com/charonn0/rb-libssh2","last_synced_at":"2026-01-04T21:42:10.748Z","repository":{"id":44368506,"uuid":"140675291","full_name":"charonn0/RB-libssh2","owner":"charonn0","description":"A Realbasic and Xojo binding to libssh2","archived":false,"fork":false,"pushed_at":"2024-07-07T22:45:50.000Z","size":618,"stargazers_count":7,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-26T17:47:50.357Z","etag":null,"topics":["libssh2","realbasic","scp","sftp-client","ssh","xojo"],"latest_commit_sha":null,"homepage":"","language":"REALbasic","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charonn0.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"charonn0"}},"created_at":"2018-07-12T07:09:34.000Z","updated_at":"2024-07-07T22:45:53.000Z","dependencies_parsed_at":"2024-02-25T20:40:19.036Z","dependency_job_id":"cddf2df4-6b50-4142-a423-ffa3f863167c","html_url":"https://github.com/charonn0/RB-libssh2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-libssh2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-libssh2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-libssh2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-libssh2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charonn0","download_url":"https://codeload.github.com/charonn0/RB-libssh2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244883064,"owners_count":20525960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["libssh2","realbasic","scp","sftp-client","ssh","xojo"],"created_at":"2024-10-14T02:05:16.508Z","updated_at":"2026-01-04T21:42:10.714Z","avatar_url":"https://github.com/charonn0.png","language":"REALbasic","readme":"# Introduction\n[libssh2](https://www.libssh2.org/) is a cross-platform library implementing the SSH2 protocol. **RB-libssh2** is a libssh2 [binding](http://en.wikipedia.org/wiki/Language_binding) for Realbasic and Xojo (\"classic\" framework) projects. \n\nThe minimum supported libssh2 version is 1.7.0. The minimum supported Xojo version is RS2010R4.\n\n## Example\nThis example starts a command (\"uptime\") on the remote machine and reads from its StdOut stream ([**More examples**](https://github.com/charonn0/RB-libssh2/wiki/Examples)): \n\n```realbasic\n  Dim sh As SSH.Channel = SSH.OpenChannel(\"ssh://user:password@public.example.com/\")\n  Call sh.Execute(\"uptime\")\n  Dim result As String\n  Do Until sh.EOF\n    If sh.PollReadable() Then\n      result = result + sh.Read(sh.BytesReadable, 0)\n    End If\n  Loop\n  sh.Close\n```\n## Hilights\n* Password, public-key, and agent-mediated [authentication](https://github.com/charonn0/RB-libssh2/wiki/SSH.Session.SendCredentials).\n* [Known host](https://github.com/charonn0/RB-libssh2/wiki/SSH.KnownHosts) key verification\n* Download and upload using [SFTP](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples) or [SCP](https://github.com/charonn0/RB-libssh2/wiki/SCP-Examples).\n* Manage files and directories over SFTP.\n* [Execute commands](https://github.com/charonn0/RB-libssh2/wiki/Process-Start-Example) on the server and read the results.\n* [TCP forwarding and tunneling](https://github.com/charonn0/RB-libssh2/wiki/TCP-Tunneling)\n* [Stream-oriented](https://github.com/charonn0/RB-libssh2/wiki/SSH.SSHStream), using Xojo's built-in [Readable](http://docs.xojo.com/index.php/Readable) and [Writeable](http://docs.xojo.com/index.php/Writeable) interfaces. \n* A consistent, high-level API over the full range of libssh2's features.\n* 64-bit ready\n* Interact directly with libssh2 using idiomatic RB/Xojo objects, methods, and events; no shell or plugins required.\n\n## Use of this project in GUI or Web applications\nThis project does not yet support being used directly in Xojo desktop or web applications (see [Issue #1](https://github.com/charonn0/RB-libssh2/issues/1)). Instead, you should use this project in a console application, such as a [Xojo Worker](http://docs.xojo.com/Worker), that is invoked from your desktop or web application. \n\n## Become a sponsor\nIf you use this code in a commercial project, or just want to show your appreciation, please consider sponsoring me through GitHub. https://github.com/sponsors/charonn0\n\n# Synopsis\nThe SSH2 protocol permits an arbitrary number (up to 2\u003csup\u003e32\u003c/sup\u003e) of simultaneous [full-duplex](https://en.wikipedia.org/wiki/Duplex_(telecommunications)) binary data streams to be efficiently and securely [multiplexed](https://en.wikipedia.org/wiki/Multiplexing) over a single TCP connection. A data stream can be an upload or download using SFTP or SCP, the input/output of a program being executed on the server, a TCP connection to a third party forwarded through the SSH server, or your own custom protocol.\n\nFor simple, one-off operations you can usually use the [Get](https://github.com/charonn0/RB-libssh2/wiki/SSH.Get), [Put](https://github.com/charonn0/RB-libssh2/wiki/SSH.Put), [Execute](https://github.com/charonn0/RB-libssh2/wiki/SSH.Execute), or [OpenChannel](https://github.com/charonn0/RB-libssh2/wiki/SSH.OpenChannel) convenience methods in the SSH module. See also the [Connect](https://github.com/charonn0/RB-libssh2/wiki/SSH.Connect) convenience method if you want to perform several such operations on the same connection.\n\nFor more complex operations you will need to dig into the libssh2 API a bit more. libssh2 exposes its API through a number of different [handle](https://en.wikipedia.org/wiki/Handle_%28computing%29) types. Each libssh2 handle or handle equivalent corresponds to an object class implemented in the binding.\n\nFor more thorough documentation of individual classes and methods refer to the [wiki](https://github.com/charonn0/RB-libssh2/wiki).\n\n|Object Class|Comment|\n|-----------|-------|\n|[`Session`](https://github.com/charonn0/RB-libssh2/wiki/SSH.Session)|A secure connection to the server over which one or more data streams can be multiplexed.| \n|[`Channel`](https://github.com/charonn0/RB-libssh2/wiki/SSH.Channel)|A data stream that is multiplexed over a Session.|\n|[`KnownHosts`](https://github.com/charonn0/RB-libssh2/wiki/SSH.KnownHosts)|A list of known hosts and their associated key fingerprints.|\n|[`Agent`](https://github.com/charonn0/RB-libssh2/wiki/SSH.Agent)|A key management service running on the user's system.|\n|[`SFTPSession`](https://github.com/charonn0/RB-libssh2/wiki/SSH.SFTPSession)|A SFTP session that is multiplexed over a Session.|\n|[`SFTPStream`](https://github.com/charonn0/RB-libssh2/wiki/SSH.SFTPStream)|A SFTP upload, download, or other operation that is performed over a SFTPSession.|\n|[`SFTPDirectory`](https://github.com/charonn0/RB-libssh2/wiki/SSH.SFTPDirectory)|A SFTP directory listing that is performed over a SFTPSession.|\n|[`SCPStream`](https://github.com/charonn0/RB-libssh2/wiki/SSH.SCPStream)|A SCP upload or download that is multiplexed over a Session.|\n|[`SSHStream`](https://github.com/charonn0/RB-libssh2/wiki/SSH.SSHStream)|An interface which aggregates the Readable and Writeable interfaces, representing a channel or other stream.|\n|[`TCPListener`](https://github.com/charonn0/RB-libssh2/wiki/SSH.TCPListener)|A listener for accepting forwarded TCP connections from the server.|\n|[`TCPTunnel`](https://github.com/charonn0/RB-libssh2/wiki/SSH.TCPTunnel)|A Channel over which a TCP connection is forwarded.|\n\nThe general order of operations is something like this:\n\n1. Create a new instance of the `Session` class.\n1. Call [Session.Connect](https://github.com/charonn0/RB-libssh2/wiki/SSH.Session.Connect) with the address and port of the server, or a Xojo `TCPSocket` which is already connected to the server.\n1. Optionally use the `KnownHosts` class to [load a list of acceptable server fingerprints](https://github.com/charonn0/RB-libssh2/wiki/SSH.KnownHosts.Load), and then [compare the newly connected session's fingerprint to that list](https://github.com/charonn0/RB-libssh2/wiki/SSH.Session.CheckHost).\n1. Call [Session.SendCredentials](https://github.com/charonn0/RB-libssh2/wiki/SSH.Session.SendCredentials) to send the user's credentials to the server.\n1. Check the [Session.IsAuthenticated](https://github.com/charonn0/RB-libssh2/wiki/SSH.Session.IsAuthenticated) property to see if the credentials were accepted.\n1. Create data streams over the session, for example the `Channel` or `SFTPSession` classes.\n1. Interact with the created data streams through their [Read](https://github.com/charonn0/RB-libssh2/wiki/SSH.Channel.Read), [Write](https://github.com/charonn0/RB-libssh2/wiki/SSH.Channel.Write), etc. methods.\n1. When finished with a data stream call its [Close](https://github.com/charonn0/RB-libssh2/wiki/SSH.Channel.Close) method.\n1. After all data streams are finished and closed, call [Session.Close](https://github.com/charonn0/RB-libssh2/wiki/SSH.Session.Close) to end the connection.\n\nRefer to the [SSH Connection Example](https://github.com/charonn0/RB-libssh2/wiki/SSH-Examples#creating-a-session-and-establishing-a-connection) for further information.\n\n# How to incorporate libssh2 into your Realbasic/Xojo project\n### Import the SSH module\n1. Download the RB-libssh2 project either in [ZIP archive format](https://github.com/charonn0/RB-libssh2/archive/master.zip) or by cloning the repository with your Git client.\n2. Open the RB-libssh2 project in REALstudio or Xojo. Open your project in a separate window.\n3. Copy the `SSH` module into your project and save.\n\n### Ensure the libssh2 shared library is installed\nlibssh2 is not installed by default on most systems, and will need to be installed separately (or shipped with your app). Pre-built binaries for Windows can be [downloaded from the libcurl project](https://curl.se/windows/). You will also need `libcrypto-1_1.dll` (libssh2 \u003c= 1.9.0) or `libcrypto-3.dll` (libssh2 \u003e= 1.10.0) from the OpenSSL project, also available from libcurl.\n\nRB-libssh2 will raise a PlatformNotSupportedException when used if all required DLLs/SOs/DyLibs are not available at runtime. \n\n# [Examples](https://github.com/charonn0/RB-libssh2/wiki/Examples)\n* [SSH](https://github.com/charonn0/RB-libssh2/wiki/SSH-Examples)\n  * [Establishing a connection](https://github.com/charonn0/RB-libssh2/wiki/SSH-Examples#creating-a-session-and-establishing-a-connection)\n  * [Checking the server's fingerprint](https://github.com/charonn0/RB-libssh2/wiki/SSH-Examples#checking-the-servers-fingerprint)\n  * [Authenticating to the server](https://github.com/charonn0/RB-libssh2/wiki/SSH-Examples#authenticating-to-the-server)\n  * [Execute a command line](https://github.com/charonn0/RB-libssh2/wiki/Process-Start-Example)\n* [SFTP](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples)\n  * [Download](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples#download)\n  * [Recursive download](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples#recursive-download)\n  * [Upload](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples#upload)\n  * [Recursive upload](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples#recursive-upload)\n  * [Directory listing](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples#list-directory)\n  * [Get file permissions](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples#read-file-permissions)\n  * [Set file permissions](https://github.com/charonn0/RB-libssh2/wiki/SFTP-Examples#write-file-permissions)\n* [TCP tunneling](https://github.com/charonn0/RB-libssh2/wiki/TCP-Tunneling)\n  * [Connect](https://github.com/charonn0/RB-libssh2/wiki/SSH.TCPTunnel#connect-example)\n  * [Listen (single connection)](https://github.com/charonn0/RB-libssh2/wiki/SSH.TCPTunnel#listen-example)\n  * [Listen (multiple connections)](https://github.com/charonn0/RB-libssh2/wiki/SSH.TCPListener#example)\n* [SCP](https://github.com/charonn0/RB-libssh2/wiki/SCP-Examples)\n  * [Download](https://github.com/charonn0/RB-libssh2/wiki/SCP-Examples#download)\n  * [Upload](https://github.com/charonn0/RB-libssh2/wiki/SCP-Examples#upload)\n","funding_links":["https://github.com/sponsors/charonn0"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharonn0%2Frb-libssh2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharonn0%2Frb-libssh2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharonn0%2Frb-libssh2/lists"}