greenappers / dartssh Goto Github PK
View Code? Open in Web Editor NEWDart SSH package providing first-class tunnelling primitives.
License: MIT License
Dart SSH package providing first-class tunnelling primitives.
License: MIT License
How to upload to SFTP server with this lib?
Hi,
This is not an issue but a feature/help request.
Your sample app (dartssh.dart) is a good example of a terminal ssh client but what I need is to connect to a server, execute commands and take actions depending on the exit codes of those commands.
I also need to download/upload files like the scp command does.
https://en.wikipedia.org/wiki/Secure_copy_protocol
I can execute commands using the sendChannelData
function and receive the command output but I could not figure out how can I get the exit code of the command.
I think the scp command uses "cat " command under the hood and writes the output to the specified file name. Can this action be simulated using this library?
Are there any plans to release the new version on https://pub.dev/packages/dartssh
Thank you
Is there any way to use this library using futures and streams? The actual SSHClient class seems to be based on callbacks. Is this possible?
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
this. package is not working on macos and web platform
in RFC4254 said:
This message will request that the user's default shell (typically
defined in /etc/passwd in UNIX systems) be started at the other end.
byte SSH_MSG_CHANNEL_REQUEST
uint32 recipient channel
string "exec"
boolean want reply
string command
expose "exec" maybe useful? can I PR this?
I met the error "verify MAC failed"
Could you explain me the cause please ?
This error is generated by the transport.dart
/// Verifies the Message Authentication Code (MAC).
sequenceNumberS2c++;
if (encrypted && packetMacLen != 0) {
Uint8List mac = computeMAC(
MAC.mac(macIdS2c),
macHashLenS,
viewUint8List(decryptBuf, 0, packetLen - packetMacLen),
sequenceNumberS2c - 1,
integrityS2c,
macPrefixS2c);
if (!equalUint8List(
mac,
viewUint8List(
readBuffer.data, packetLen - packetMacLen, packetMacLen))) {
throw FormatException('$hostport: verify MAC failed');
}
}
thx
I have id_rsa on windows
Tryied to parse with pem.parsePem
my file "id_rsa" gives error. And the same with converted id_rsa to pem format.
client = SSHClient(
hostport: parseUri(host),
login: login,
print: print,
response: response,
loadIdentity: () {
if (identity == null && identityFile != null) {
identity = pem.parsePem(io.File(identityFile).readAsStringSync());
}
return identity;
},
ssh-keygen -f id_rsa.pub -m 'PEM' -e > id_rsa.pem
Unhandled exception:
FormatException: type not supported: RSA PUBLIC KEY
#0 parsePem (package:dartssh/pem.dart:171:7)
#1 sshTest.<anonymous closure> (file:///D:/CODING/PROJECTS/TEST/dart-ssh/dart-ssh-test/bin/ssh.dart:56:24)
#2 SSHClient.handleMSG_SERVICE_ACCEPT (package:dartssh/client.dart:337:30)
#3 SSHClient.handlePacket (package:dartssh/client.dart:118:9)
#4 SSHTransport.handleRead (package:dartssh/transport.dart:320:7)
#5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1546:10)
#6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#7 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#8 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#9 _StreamController._add (dart:async/stream_controller.dart:607:7)
#10 _StreamController.add (dart:async/stream_controller.dart:554:5)
#11 _Socket._onData (dart:io-patch/socket_patch.dart:2160:41)
#12 _RootZone.runUnaryGuarded (dart:async/zone.dart:1546:10)
#13 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#14 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#15 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#16 _StreamController._add (dart:async/stream_controller.dart:607:7)
#17 _StreamController.add (dart:async/stream_controller.dart:554:5)
#18 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1696:33)
#19 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1208:14)
#20 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#21 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#22 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:120:13)
#23 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:185:5)
Since RFC said:
6.4. Environment Variable Passing
Environment variables may be passed to the shell/command to be
started later. Uncontrolled setting of environment variables in a
privileged process can be a security hazard. It is recommended that
implementations either maintain a list of allowable variable names or
only set environment variables after the server process has dropped
sufficient privileges.
byte SSH_MSG_CHANNEL_REQUEST
uint32 recipient channel
string "env"
boolean want reply
string variable name
string variable value
Maybe helpful?
Can I PR this?
I know, that this is not a problem with your implementation, but how is it possible to remove those duplicated lines?
If i execute ls the command ls -a
the client outputs
ls -a
. .. .bash_history .bash_logout .bashrc .gnupg .profile
root@xxx1234:~$
root@xxx1234:~$
so it duplicates the given input and the root@xxx1234:~$
line.
Do you know why this happens and how to fix it?
Btw, thanks for that awesome library!
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.