shaqian / flutter_ssh Goto Github PK
View Code? Open in Web Editor NEWSSH and SFTP client for Flutter
Home Page: https://pub.dartlang.org/packages/ssh
License: MIT License
SSH and SFTP client for Flutter
Home Page: https://pub.dartlang.org/packages/ssh
License: MIT License
i added my phone ip address as hostname. but get this error message.
I noticed that you have implemented a function isConnected
which is really useful, but it has not yet been published to pub.dev.
I am getting this error-
E/SshPlugin( 7624): Connection failed: connection is closed by foreign host
I/flutter ( 7624): Error: connection_failure
I have tried from file zila it is connecting but from android device it gives me this error.
using port 21
app crash on:
result = await client.connect();
flutter 1.12 , real device and simulator same
Hi. After doing a flutter build apk, it does not allow me to connect the application to the internet. Already add the permission in the AndroidManifest.
When using the .connect()
method the app crashes and throws the following error:
FATAL EXCEPTION: Thread-5
E/AndroidRuntime( 1722): Process: com.niklas8.remotefiles, PID: 1722
E/AndroidRuntime( 1722): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: Thread-5
E/AndroidRuntime( 1722): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:794)
E/AndroidRuntime( 1722): at io.flutter.embedding.engine.FlutterJNI.invokePlatformMessageResponseCallback(FlutterJNI.java:727)
E/AndroidRuntime( 1722): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:140)
E/AndroidRuntime( 1722): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:230)
E/AndroidRuntime( 1722): at sq.flutter.ssh.SshPlugin$1.run(SshPlugin.java:169)
E/AndroidRuntime( 1722): at java.lang.Thread.run(Thread.java:762)
This occurred since I updated to Flutter 1.7
On iOS everything is working
After creating an image file with imagepicker, I entered the path of the image file as the file path. But I get a No such file error.
The connection status and download function work.
But I don't know how to use the upload function.
How does it work?
Greetings,
Is there a way to implement session timeout?
I know that in jsch you can invoke: session.setTimeout(60000);
After trying to build with no success with --no-shrink and trying this: #27#issuecomment-599180850
The apps work perfecly when I run it in debug
The error appear when I call connect: PlatformException(connection_failure, Attempt to invoke virtual method java.lang.String java.lang.Object.toString()' on a null object reference, null)
Here's my repo: https://github.com/TheStaticTurtle/DemoArenaMobile-Flutter
In the latest version of Flutter/Android Studio, when building an android release version, the no-shrink workaround no longer works. At runtime, I get PlatformException(connection_failure.... on physical devices. Emulator in debug mode is ok.
Is there any way round this?
When doing stream from await connect() it is blocking the app.
Stream<String> timedConnectionContinous() async* {
bool shoudRepeat = true;
while (shoudRepeat) {
try {
String response = await connect();
yield response;
if (response == "session_connected") break;
} catch (e) {
yield "not connected";
}
await Future.delayed(Duration(seconds: 10));
}
}
How to solve it?
Hi everyone,
I'm experiencing a weird behaviour where I'm not able to import the package, when I use version 0.0.7 in my pubspec.yaml. However, when I downgrade to version 0.0.6 it works!
The exception I get is:
Target of URI doesn't exist: 'package:ssh/ssh.dart'. (Documentation)
Try creating the file referenced by the URI, or Try using a URI for a file that does exist.
best regards
after connecting:
client.connect();
client.connectSFTP();
when loading the directory by calling:
widget.client.sftpLs("/")
it crashes:
on android i got this:
D/SshPlugin(10981): Session connected
I/flutter (10981): connect result: session_connected
E/AndroidRuntime(10981): FATAL EXCEPTION: Thread-5
E/AndroidRuntime(10981): Process: com.example.online_disk, PID: 10981
E/AndroidRuntime(10981): java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Vector com.jcraft.jsch.ChannelSftp.ls(java.lang.String)' on a null object reference
E/AndroidRuntime(10981): at sq.flutter.ssh.SshPlugin$8.run(SshPlugin.java:433)
E/AndroidRuntime(10981): at java.lang.Thread.run(Thread.java:923)
Lost connection to device.
on ios i got this:
flutter: connect result: session_connected
[VERBOSE-2:ui_dart_state.cc(177)] Unhandled Exception: PlatformException(ls_failure, Failed to list path /, null, null)
#0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:582
#1 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:159
#2 SSHClient.sftpLs
package:ssh/ssh.dart:126
#3 DiskWidgetExtension.createScaffold. (package:online_disk/View/Disk/DiskWidgetExtension.dart)
package:online_disk/…/Disk/DiskWidgetExtension.dart:1
On SshPlugin.java, at line 469, the progress monitor used to monitor sftp download (and upload too but in another line), throws an exception over Android with the error "No such file" (which is not true), removing the progress monitor fix the issue, but is not the point, that was a quick fix for me that I was not going to use that feature.
I only tested it over Android using a Nexus 5X, flutter 1.7.8 and ssh 0.0.4
Is there a way to verify host fingerprints before connecting? I can see the output for host fingerprint when connecting, but I don't know how to programmatically access it or prevent it from going ahead and connecting.
all ssh functionalites working in debug mode and release mode
but nothing working in built apk
i am trying to connect to my local network..
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[!] Android Studio (not installed)
[✓] Connected device (1 available)
this is the output of flutter build apk --verbose
https://pastebin.com/LW9zUJ3y
this is my app repo
https://github.com/prinzpiuz/MSM_mobile
got the following error while installing ssh
Because flutter_plugin_pdf_viewer <1.0.7 depends on flutter_cache_manager ^0.3.2 and no versions of flutter_plugin_pdf_viewer match >1.0.7, every version of flutter_plugin_pdf_viewer requires flutter_cache_manager ^0.3.2.
And because flutter_cache_manager >=0.3.0 depends on uuid ^2.0.0 and every version of ssh depends on uuid ^1.0.3, flutter_plugin_pdf_viewer is incompatible with ssh.
So, because invoicyx depends on both ssh ^0.0.5 and flutter_plugin_pdf_viewer any, version solving failed.
pub get failed (1; So, because invoicyx depends on both ssh ^0.0.5 and flutter_plugin_pdf_viewer any, version solving failed.)
exit code 1
Can ssh switch to a newer version of uuid so we can use it?
Hello
I would know if it possible to connect to a VPS directly with ssh tunnelling
In putty, I use the command
-L 9999:localhost:9009 root@IP_ADDRESS -pw PaSSWORD
Thx
Hi, What do you suggest to deal with "27" escape characters? For example, if I just create a text widget with the SSH shell output, it will look like this: Image.
Hello,
I'm trying to connect to a device from my own Flutter app, but when I try to connect to SFTP I get the following error:
I/flutter ( 6530): timer triggered
I/art ( 6530): Background sticky concurrent mark sweep GC freed 11068(504KB) AllocSpace objects, 14(372KB) LOS objects, 21% free, 4MB/5MB, paused 5.367ms total 14.984ms
I/flutter ( 6530): ssh connected
E/SshPlugin( 6530): Error connecting SFTP:java.io.IOException: inputstream is closed
I/flutter ( 6530): Error: sftp_failure
I/flutter ( 6530): Error Message: java.io.IOException: inputstream is closed
This is my code:
Timer(const Duration(seconds: 30), () async {
print("timer triggered");
if (_sshClient == null) {
_sshClient = new SSHClient(
host: _strumAddress,
port: 22,
username: "****",
passwordOrKey: "******",
);
}
try {
String result = await _sshClient.connect();
if (result == "session_connected") {
print("ssh connected");
var result;
result = await _sshClient.connectSFTP();
}
} on PlatformException catch (e) {
print('Error: ${e.code}\nError Message: ${e.message}');
_sshClient.disconnect();
_sshClient = null;
}
});
I only tested on Android, and I'm sure that the server is running, and that credentials are correct (I can connect from Windows using pscp.exe and OpenSSH 'spc' command).
Is there any hint you can give me? Some way to have a verbose output that may share some light on this?
Thanks in advance
Hi.
Thanks for your wonderful api.
I found that if I download using sftp, it works well on Android, and iOS well, except...
On iPhone 6 Plus machine, S/W version 12.4.6
small files are OK, but if I download a file larger than 20 mB, then the progress goes on and when hit 100, the app crashes without any message.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.5 19F96, locale ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 3.5)
[✓] Connected device (1 available)
it is hard to provide verbose since this happens only on old iPhone
It works well on later version iPhone and androids.
PlatformException(connection_failure, java.lang.ClassNotFoundException: com.jcraft.jsch.jce.Random, null)
An exception occurs when trying to connect on release APK, works fine on debug.
On both iOS and Android, disconnect never completes.
This happens even for a simple use case of:
SSHClient _client;
await _client.connect();
await _client.disconnect();
I'm on Flutter Channel dev, v1.1.8, on Mac OS X 10.14.3.
When using the sftpDownload
function the app throws this exception:
E/SshPlugin(25046): Failed to download /home/niklas/.bashrc
E/flutter (25046): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(download_failure, , null)
Tested on Xiaomi Mi 9T, Android 9, flutter 1.7.8, ssh 0.0.4
Here are my dependencies:
ssh: ^0.0.5
flutter_cache_manager: ^1.1.3
uuid: ^2.0.4
path_provider: ^1.4.4
cached_network_image: ^1.1.3
image_picker: ^0.6.2+2
got below issue----------------------------------
Because ssh 0.0.5 depends on uuid ^1.0.3 and no versions of ssh match >0.0.5 <0.1.0, ssh ^0.0.5 requires uuid ^1.0.3.
So, because project1 depends on both ssh ^0.0.5 and uuid ^2.0.4, version solving failed.
pub get failed (1)
changed uuid to ^1.0.3
got another issue -----------------------------
Because flutter_cache_manager >=0.3.0 depends on uuid ^2.0.0 and yszltech depends on uuid ^1.0.3, flutter_cache_manager >=0.3.0 is forbidden.
So, because yszltech depends on flutter_cache_manager ^1.1.3, version solving failed.
pub get failed (1)
please someone help me on this issue, thanks.
Hi, I don't see the documentation mention anything about generating or copying SSH keys. Is that something I would be able to do? I feel like this would help with any compatibility issues with openssh's new format.
For some reason, it does work when I'm debugging; but after I build the production APK, it throws this error:
PlatformException(connection_failure, java.lang.ClassNotFoundException: com.jcraft.jsch.jce.Random, null)
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.1 19B88, locale en-US)
• Flutter version 1.12.13+hotfix.5 at /Users/juanm04/dev/tools/flutter
• Framework revision 27321ebbad (6 days ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/juanm04/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/juanm04/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage
on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
sudo gem install cocoapods
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[!] IntelliJ IDEA Ultimate Edition (version 2019.2.4)
• IntelliJ at /Applications/IntelliJ IDEA.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] VS Code (version 1.41.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.1
[✓] Connected device (1 available)
• ONEPLUS A6013 • 192.168.86.123:5555 • android-arm64 • Android 10 (API 29)
Can you implement private key validation for rsa, ecdsa, ed25519 keys?
I'm interested in your library and trying to run the example to test SFTP access - however after calling connect()
the system just seems to hang and nothing resolves
Is this due to my host being an IP Address? And If so is there a correct way to do this?
var client = new SSHClient(
host: "192.168.10.5",
port: 21,
username: "user",
passwordOrKey: "pass",
);
try {
print("Attempting connection");
String result = await client.connect(); //Never get past here!
if (result == "session_connected") {
result = await client.connectSFTP();
if (result == "sftp_connected") {`
...
Connecting to some servers requires more time that the default timeout set for this library. This option is provided by the JSch library in .connect() command, while it is not present in this flutter library.
I'm running into this issue when I run this on linux.
[ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: MissingPluginException(No implementation found for method connectToHost on channel ssh)
I'm guessing this is an issue with the plugin not being registered, so this might be an upstream error.
I would like to be able to send signals like SIGINT or Ctrl-C or other Ctrl-Charachter or something similar.
I noticed that JSch has a method which is sendSignal. This might help.
Thanks
Is there a chance to support Windows desktop based on OpenSSL libraries (manually added to the project as in case of sqlite3)?
Good Morning,
just try to integrate flutter_ssh. pubspec and import works fine but actually trying to connect i always receive the error "unknown_client".
I am using it on a machine with android 7.1 and i also have included the libraries dependency in the build grade file.
Any help solving my "stupid" error" highly appreciated :)
Greets from Manila
Ralph
Im getting this error when i run app in release mode
Connection failed: java.lang.ClassNotFoundException: com.jcraft.jsch.jce.Random
but in debug mode plugin run with no error
Note: i use plugin to download file from sftp
It seems that this library does not allow to query the remote path via sftp. So there are hacks such as this one:
https://github.com/niklas-8/RemoteFiles/blob/master/lib/services/connection_methods.dart#L87
to get the remote path. The problem here is that execute send an SSH exec request. SFTP only servers generally does not accept exec requests but only sftp requests.
In Jsch I think the method to use is realpath
Hi,
First I had the problem with no internet connection as mentioned here #32 but adding the flag --no-shrink solved that problem. But I still cant connect nor create a SSHClient. Everything works as expected on iOS and in Android debug mode. I am having a hard time to debug this as well. But I´ve narrowed it down to where it fails:
"var client = new SSHClient(....)"
Can I catch any exception when new SSHClient fails?
Do I need to add (except from INTERNET) any android permissions to use SSH?
Ive tried searching but no success.
EDIT:
It fails when I run result = await client.connect();
Im also getting this warning (as well in debug mode):
"Note: /Users/razbook3.0/development/flutter/.pub-cache/hosted/pub.dartlang.org/ssh-0.0.6/android/src/main/java/sq/flutter/ssh/SshPlugin.java uses unchecked or unsafe operations."
Thanks /Rasmus
I tried to upload a file but after successfull connect and connectSFTP I got a strange exception while trying to sftpUpload. I found info that many plugins had such issue and needed a fix.
E/SshPlugin(26101): Failed to upload /data/user/0/com.example.picker/app_flutter/file0.jpg
E/flutter (26101): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(upload_failure, java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: Thread-8, null)
E/flutter (26101): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)
E/flutter (26101): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:33)
E/flutter (26101):
E/flutter (26101): #2 SSHClient.sftpUpload (package:ssh/ssh.dart:185:33)
E/flutter (26101):
E/flutter (26101): #3 MyApp.sendPhotos (package:picker/main.dart:126:24)
E/flutter (26101):
E/flutter (26101): #4 MyApp.build. (package:picker/main.dart:74:22)
E/flutter (26101): #5 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:635:14)
E/flutter (26101): #6 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:711:32)
E/flutter (26101): #7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (26101): #8 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11)
E/flutter (26101): #9 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:275:7)
E/flutter (26101): #10 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:455:9)
E/flutter (26101): #11 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:75:13)
E/flutter (26101): #12 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:102:11)
E/flutter (26101): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
E/flutter (26101): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (26101): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
binding.dart:102:7)
E/flutter (26101): #17 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gesturesE/flutter (26101): #18 _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (26101): #19 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (26101): #21 _invoke1 (dart:ui/hooks.dart:250:10)
In iOS I get a response like this:
\^[]0;pi@raspberrypi: ~\^G\^[[01;32mpi@raspberrypi\^[[00m:\^[[01;34<…>
In Android I see this:
�]0;pi@raspberrypi: ~��[01;32mpi@raspberrypi�[00m:�[01;34m~ $�[00m �ll
It looks like the encoded characters in Android are not being converted to strings properly.
'ssh/SshPlugin.h' file not found
in GeneratedPluginRegistrant.m
file when build iOS project
call client.connect()
throw NoClassDefFoundError
exception:
W/le.startupname(16110): Unresolved exception class when finding catch block: org.ietf.jgss.GSSException
E/AndroidRuntime(16110): FATAL EXCEPTION: Thread-2
E/AndroidRuntime(16110): Process: com.example.startupnamer, PID: 16110
E/AndroidRuntime(16110): java.lang.NoClassDefFoundError: Failed resolution of: Lorg/ietf/jgss/Oid;
E/AndroidRuntime(16110): at com.jcraft.jsch.jgss.GSSContextKrb5.create(GSSContextKrb5.java:55)
E/AndroidRuntime(16110): at com.jcraft.jsch.UserAuthGSSAPIWithMIC.start(UserAuthGSSAPIWithMIC.java:125)
E/AndroidRuntime(16110): at com.jcraft.jsch.Session.connect(Session.java:470)
E/AndroidRuntime(16110): at com.jcraft.jsch.Session.connect(Session.java:183)
E/AndroidRuntime(16110): at sq.flutter.ssh.SshPlugin$1.run(SshPlugin.java:156)
E/AndroidRuntime(16110): at java.lang.Thread.run(Thread.java:764)
E/AndroidRuntime(16110): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.ietf.jgss.Oid" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.example.startupnamer-YbOYR6B1BxIvTZSHi5YUmw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.startupnamer-YbOYR6B1BxIvTZSHi5YUmw==/lib/arm64, /data/app/com.example.startupnamer-YbOYR6B1BxIvTZSHi5YUmw==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
E/AndroidRuntime(16110): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime(16110): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(16110): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(16110): ... 6 more
code:
var client = new SSHClient(
host: "www.xxxx.com",
port: 22,
username: "root",
passwordOrKey: "xxxxx",
);
try{
String re = await client.connect();
if (re == "session_connected"){
print("connecte");
}
}catch(e){
print('Error: ${e.toString()}');
}
Hey,
My App uses some other packages depending on uuid ^2.0.0. The ssh package depends on uuid ^1.0.3.
Could you please update youre this package?
Here some changelogs from pub.dev:
- v2.0.1
Fix regression where CryptoRNG was default, moved back to MathRNG
Added ability to set RNG globally to skip having to set it in every function call
Allows you to set the v1 clock sequence, nodeID, and seed bytes to use cryptoRNG separately from globalRNG.
- v2.0.0
Fixup the API to split out Buffer and Non-buffer usages.
Switch to build in Random.secure() and remove custom AES implementation.
Less dependencies.
Docs
Cleanup
- v1.0.3
Fix SDK constraints to allow Dart 2.0 stable.
Here the output from flutter:
Because no versions of flutter_cache_manager match >0.3.2 <0.4.0 and flutter_cache_manager 0.3.2 depends on uuid ^2.0.0, flutter_cache_manager ^0.3.2 requires uuid ^2.0.0.
And because every version of ssh depends on uuid ^1.0.3, flutter_cache_manager ^0.3.2 is incompatible with ssh.
So, because MyApp depends on both ssh ^0.0.3 and flutter_cache_manager ^0.3.2, version solving failed.
Thank you very much!
Unfortunately it does not work under Flutter Web and I do not get an error message.
In your documentation you state, that MacOS users need: puttygen
.
However this command works exactly the same.
No need for any additional commands :)
ssh-keygen -p -m PEM -f ~/.ssh/id_rsa
App crashes on startup with the error:
E/AndroidRuntime(19915): FATAL EXCEPTION: Thread-2 E/AndroidRuntime(19915): Process: xyz.mevans.ftpclient, PID: 19915 E/AndroidRuntime(19915): java.lang.NullPointerException: Attempt to read from field 'com.jcraft.jsch.Session sq.flutter.ssh.SshPlugin$SSHClient._session' on a null object reference E/AndroidRuntime(19915): at sq.flutter.ssh.SshPlugin$6.run(SshPlugin.java:278) E/AndroidRuntime(19915): at java.lang.Thread.run(Thread.java:764)
The document is not very clear.
How do I know the connection state of ssh?
What will happen if I call client.connect()
multiple times?
Thanks!
The code I have literally copy-pasted from example. I have tested this library on real device and when there is client.startShell
in code, then whole app is crashing. This bug does not exist on Simulator. Any tips how to solve it?
var client = new SSHClient(
host: controlServer.host,
port: 22,
username: controlServer.login,
passwordOrKey: controlServer.password);
String result = await client.connect();
try {
String result = await client.connect();
if (result == "session_connected") {
result = await client.startShell(
ptyType: "xterm",
callback: (dynamic res) {
});
if (result == "shell_started") {
print(await client.writeToShell("echo hello > world\n"));
print(await client.writeToShell("cat world\n"));
new Future.delayed(
const Duration(seconds: 5),
() async => await client.closeShell(),
);
}
}
} catch (PlatformException){
print('Error: ${}\nError Message: e}');
}
Here are my dependencies:
ssh: ^0.0.5
flutter_cache_manager: ^1.1.3
uuid: ^2.0.4
path_provider: ^1.4.4
cached_network_image: ^1.1.3
image_picker: ^0.6.2+2
got below issue----------------------------------
Because ssh 0.0.5 depends on uuid ^1.0.3 and no versions of ssh match >0.0.5 <0.1.0, ssh ^0.0.5 requires uuid ^1.0.3.
So, because project1 depends on both ssh ^0.0.5 and uuid ^2.0.4, version solving failed.
pub get failed (1)
changed uuid to ^1.0.3
got another issue -----------------------------
Because flutter_cache_manager >=0.3.0 depends on uuid ^2.0.0 and yszltech depends on uuid ^1.0.3, flutter_cache_manager >=0.3.0 is forbidden.
So, because yszltech depends on flutter_cache_manager ^1.1.3, version solving failed.
pub get failed (1)
please someone help me on this issue, thanks.
Hello and thank you for this usefull package !
I use it to send multiples files (using wildcard 'folder/*.png') between a RaspberryPi and my phone, everything is going well but I noticed that the progress value doesn't handle the multiple files cases and I had to change a bit the package code to :
long newPerc = this.count;// * 100 / max;
(line 629)
Otherwise, it will show a percent compared to the first file, so after the first one is sent, value goes over 100%...
So now I can pass the max value (total size of the folder obtained from sftpLs) and the progress makes more sense to me...
The best for me would be the "max" value not displayed so I can make the division and return a %...
When receiving the response, the Android version uses BufferedReader.readLine() in the execute function, which removes linebreaks, then reconstructs them using \r\n
. Preferably, .readLine() shouldn't be used at all, since there's no way of knowing what the original linebreak was. Reasonably, something more akin to the official example. At the very least, it should be changed to \n
, as the SSH server is very likely a Linux server (even if there are some awkward Windows adaptions), which would be using \n
, not \r\n
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.