पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv0.0.7

ssh

Flutter के लिए SSH और SFTP क्लाइंट। iOS लाइब्रेरी NMSSH और Android लाइब्रेरी JSch को लपेटता है।

30-दिन डाउनलोड
83
लाइक
42
Pub अंक
35

पैकेज इंस्टॉल करें

flutter pub add ssh

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

एक फ्लटर पैकेज जो नेटिव लाइब्रेरी को लपेटकर iOS के लिए NMSSH और Android के लिए JSch का उपयोग करके SSH और SFTP क्लाइंट कार्यक्षमता प्रदान करता है। यह फ्लटर एप्लिकेशन में सुरक्षित दूरस्थ कनेक्शन और फ़ाइल ट्रांसफर की अनुमति देता है, जो पासवर्ड या कीज़ के माध्यम से प्रमाणीकरण समर्थित है। यह पैकेज क्रॉस-प्लेटफॉर्म नेटवर्क ऑपरेशन के साथ सुरक्षित प्रोटोकॉल की आवश्यकता वाले डेवलपर्स के लिए डिज़ाइन किया गया है। यह एप्लिकेशन में एसएचएच-आधारित वर्कफ़्लो को एकीकृत करने को सरल बनाता है बिना गहन प्लेटफॉर्म-विशिष्ट ज्ञान के आवश्यकता के।

उपयोग

  • रिमोट सर्वर प्रबंधन
  • SFTP के माध्यम से सुरक्षित फ़ाइल स्थानांतरण
  • स्वचालित डेप्लॉयमेंट स्क्रिप्ट्स
  • सुरक्षित उपकरण कॉन्फ़िगरेशन
  • रिमोट डीबगिंग
  • प्रणाली प्रशासन कार्य

मुख्य विशेषताएँ

  • प्लेटफॉर्म-स्वतंत्र SSH/SFTP समर्थन
  • पासवर्ड और कुंजी-आधारित प्रमाणीकरण
  • iOS NMSSH और Android JSch के साथ एकीकरण
  • संपर्क और फ़ाइल संचालन के लिए सरल API
  • सुरक्षित एन्क्रिप्टेड संचार

इनके लिए उपयुक्त

  • प्रशासन उपकरण बनाने वाले विकासकर्ता
  • दूरस्थ पहुँच की आवश्यकता वाले मोबाइल एप्स
  • मोबाइल ऐप्स में CI/CD एकीकरण
  • नेटवर्क स्वचालन परियोजनाएं
  • सुरक्षित डेटा आदान-प्रदान करने वाले ऐप्स

विचार योग्य बातें

  • iOS और Android पर मूल लाइब्रेरी सेटअप की आवश्यकता होती है
  • iOS और Android प्लेटफॉर्म के लिए सीमित
  • प्रमाणीकरण प्रमाण प्रमाणित रूप से हैंडल किए जाने चाहिए
  • कम शक्ति वाले उपकरणों पर संभावित कार्य प्रदर्शन अतिरिक्त बोझ
  • SSH सत्रों के लिए कोई निर्मित UI घटक नहीं हैं

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

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.

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 2 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट