All Projects → shaqian → flutter_ssh

shaqian / flutter_ssh

Licence: MIT license
SSH and SFTP client for Flutter

Programming Languages

objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
dart
5743 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to flutter ssh

File Storage
File storage abstraction for Yii2
Stars: ✭ 116 (+10.48%)
Mutual labels:  sftp
Whipftp
OpenSource FTP / SFTP client
Stars: ✭ 158 (+50.48%)
Mutual labels:  sftp
Example Airflow Dags
Example DAGs using hooks and operators from Airflow Plugins
Stars: ✭ 243 (+131.43%)
Mutual labels:  sftp
Centos Ssh
OpenSSH / Supervisor / EPEL/IUS/SCL Repos - CentOS - Docker image build.
Stars: ✭ 126 (+20%)
Mutual labels:  sftp
Restic Backup Docker
A docker container to automate backups with restic
Stars: ✭ 142 (+35.24%)
Mutual labels:  sftp
Premotem
Personal Remote Manager
Stars: ✭ 161 (+53.33%)
Mutual labels:  sftp
Lssh
List selection type alternative ssh/scp/sftp client. Pure Go.
Stars: ✭ 110 (+4.76%)
Mutual labels:  sftp
RB-libcURL
A Realbasic and Xojo binding to libcurl
Stars: ✭ 19 (-81.9%)
Mutual labels:  sftp
Sshj
ssh, scp and sftp for java
Stars: ✭ 2,016 (+1820%)
Mutual labels:  sftp
Sftpgo
Fully featured and highly configurable SFTP server with optional HTTP, FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob
Stars: ✭ 3,534 (+3265.71%)
Mutual labels:  sftp
Etl.net
Mass processing data with a complete ETL for .net developers
Stars: ✭ 129 (+22.86%)
Mutual labels:  sftp
Wolfssh
wolfSSH is a small, fast, portable SSH implementation, including support for SCP and SFTP.
Stars: ✭ 142 (+35.24%)
Mutual labels:  sftp
Drone Cache
A Drone plugin for caching current workspace files between builds to reduce your build times
Stars: ✭ 194 (+84.76%)
Mutual labels:  sftp
Vs Deploy
Visual Studio Code extension that provides commands to deploy files of a workspace to a destination.
Stars: ✭ 123 (+17.14%)
Mutual labels:  sftp
gftp
gFTP is a free multithreaded file transfer client for *NIX based machines. 56 language translations available.
Stars: ✭ 81 (-22.86%)
Mutual labels:  sftp
S3 Sftp Proxy
An AWS S3 gateway proxying SFTP connections.
Stars: ✭ 112 (+6.67%)
Mutual labels:  sftp
Grunt Sftp Deploy
Grunt task for code deployment over sftp
Stars: ✭ 158 (+50.48%)
Mutual labels:  sftp
Ssh-Pascal
Delphi ssh library wrapping libssh2
Stars: ✭ 42 (-60%)
Mutual labels:  sftp
termscp
🖥 A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3
Stars: ✭ 707 (+573.33%)
Mutual labels:  sftp
Vscode Remote Workspace
Multi protocol support for handling remote files like local ones in Visual Studio Code.
Stars: ✭ 197 (+87.62%)
Mutual labels:  sftp

ssh

SSH and SFTP client for Flutter. Wraps iOS library NMSSH and Android library JSch.

Installation

Add ssh as a dependency in your pubspec.yaml file.

Known issue

  • Platform exception in release mode for Android:

    PlatformException(connection_failure, java.lang.ClassNotFoundException: com.jcraft.jsch.jce.Random, null)
    

    There are 2 workarounds:

    • Disable shrink:

      flutter build apk --no-shrink

    • Configure proguard-rules. Refer to this comment for details.

Usage

Create a client using password authentication

import 'package:ssh/ssh.dart';

var client = new SSHClient(
  host: "my.sshtest",
  port: 22,
  username: "sha",
  passwordOrKey: "Password01.",
);

Create a client using public key authentication

import 'package:ssh/ssh.dart';

var client = new SSHClient(
  host: "my.sshtest",
  port: 22,
  username: "sha",
  passwordOrKey: {
    "privateKey": """-----BEGIN RSA PRIVATE KEY-----
    ......
-----END RSA PRIVATE KEY-----""",
    "passphrase": "passphrase-for-key",
  },
);

OpenSSH keys

Recent versions of OpenSSH introduce a proprietary key format that is not supported by most other software, including this one, you must convert it to a PEM-format RSA key using the puttygen tool. On Windows this is a graphical tool. On the Mac, install it per these instructions. On Linux install your distribution's putty or puttygen packages.

  • Temporarily remove the passphrase from the original key (enter blank password as the new password)
    ssh-keygen -p -f id_rsa
  • convert to RSA PEM format
    puttygen id_rsa -O private-openssh -o id_rsa_unencrypted
  • re-apply the passphrase to the original key
    ssh-keygen -p -f id_rsa
  • apply a passphrase to the converted key:
    puttygen id_rsa_unencrypted -P -O private-openssh -o id_rsa_flutter
  • remove the unencrypted version:
    rm id_rsa_unencrypted

Connect client

await client.connect();

Close client

await client.disconnect();

Execute SSH command

var result = await client.execute("ps");

Shell

Start shell:

  • Supported ptyType: vanilla, vt100, vt102, vt220, ansi, xterm
var result = await client.startShell(
  ptyType: "xterm", // defaults to vanilla
  callback: (dynamic res) {
    print(res);     // read from shell
  }
);

Write to shell:

await client.writeToShell("ls\n");

Close shell:

await client.closeShell();

SFTP

Connect SFTP:

await client.connectSFTP();

List directory:

var array = await client.sftpLs("/home"); // defaults to .

Create directory:

await client.sftpMkdir("testdir");

Rename file or directory:

await client.sftpRename(
  oldPath: "testfile",
  newPath: "newtestfile",
);

Remove directory:

await client.sftpRmdir("testdir");

Remove file:

await client.sftpRm("testfile");

Download file:

var filePath = await client.sftpDownload(
  path: "testfile",
  toPath: tempPath,
  callback: (progress) {
    print(progress); // read download progress
  },
);

// Cancel download:
await client.sftpCancelDownload();

Upload file:

await client.sftpUpload(
  path: filePath,
  toPath: ".",
  callback: (progress) {
    print(progress); // read upload progress
  },
);

// Cancel upload:
await client.sftpCancelUpload();

Close SFTP:

await client.disconnectSFTP();

Demo

Refer to the example.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].