Giter Site home page Giter Site logo

dartssh's People

Contributors

greenappers avatar pedia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dartssh's Issues

Execute commands and download files

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?

Future/Stream based SSH

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?

Need a advice with ssh tunnelling

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

expose exec command

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?

Verify MAC failed error cause ?

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

parsePem doesnt work

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;
        },

Command i used to convert id_rsa to pem

ssh-keygen -f id_rsa.pub -m 'PEM' -e > id_rsa.pem

Error

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)

implement env of MSG_CHANNEL_REQUEST

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?

Duplicated root@xxx1234:~$ line

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.