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

पैकेज विवरणv2.2.3

ssh2

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

AndroidiOS
30-दिन डाउनलोड
60
लाइक
32
Pub अंक
130

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

flutter pub add ssh2

पैकेज अवलोकन

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

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

उपयोग

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

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

  • प्लेटफॉर्म-स्वतंत्र SSH और SFTP समर्थन
  • मूल लाइब्रेरी एकीकरण (NMSSH, JSch)
  • सुरक्षित एन्क्रिप्टेड कनेक्शन
  • दूरस्थ सर्वर पर कमांड निष्पादन
  • फ़ाइल स्थानांतरण क्षमता
  • प्लेटफॉर्म-विशिष्ट प्रदर्शन अनुकूलन

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

  • दूरस्थ प्रशासन उपकरण बना रहे विकासकर्ता
  • सुरक्षित सर्वर एक्सेस की आवश्यकता वाले ऐप्स
  • CI/CD एकीकरण विशेषताएँ
  • आईओटी उपकरण सेटअप ऐप्स
  • सुरक्षित फ़ाइल प्रबंधन की आवश्यकता वाले अनुप्रयोग

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

  • iOS और Android पर मूल निर्भरता की आवश्यकता होती है
  • Android और iOS प्लेटफॉर्म तक सीमित
  • फायरवॉल या की प्रमाणीकरण के लिए अतिरिक्त सेटअप की आवश्यकता हो सकती है
  • वेब या डेस्कटॉप लक्ष्यों के लिए उपयुक्त नहीं
  • SSH कुंजियों और प्रमाणपत्रों के हैंडलिंग में संभावित जटिलता

मूल README

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

ssh2

SSH and SFTP client for Flutter. Wraps iOS library NMSSH and Android library JSch. This is a fork of flutter_ssh: https://github.com/shaqian/flutter_ssh

Wraps iOS library NMSSH and Android library JSch.

Installation

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

Known issue

  • Older Gradle versions are not supported due to incompatibilities with the newer JSch dependency. This release was tested with Gradle version 7.0.2.

Usage

Create a client using password authentication
import 'package:ssh2/ssh2.dart';

var client = new SSHClient(
  host: "my.sshtest",
  port: 22,
  username: "sha",
  passwordOrKey: "Password01.",
);
Create a client using public key authentication
import 'package:ssh2/ssh2.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");
Get the fingerprint of the remote host
var result = await client.getHostFingerprint();
Get the banner of the remote host
var result = await client.getBanner();
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.

श्रेणियाँ

निर्भरताएँ

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

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

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