开发者

SSH in Java App with 'expect' like functionality [closed]

开发者 https://www.devze.com 2023-03-14 06:19 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 8 years ago.

Improve this question

With 'expect', one can execute SSH commands and parse the output of those commands to alt开发者_运维问答er program flow. I'd like to do this with Java. That is, I want my Java app to launch a SSH session, execute a command on the remote server, and depend on the output of that command execute the next command, without needing to start a new SSH session.

Is this possible in Java?

Thanks


Self-promoting my project: after looking at other Java-based Expect libraries, I decided to write my own... hope you find it useful. Please open issues in GitHub if you find any problem.

https://github.com/ronniedong/Expect-for-Java

For SSH, I suggest using JSch, as the example in the readme file.


Yes, it's possible. There are some libraries, but I suggest Ganymed SSH-2. You can download it here, and there are also a lot of examples of using functions...


Try ExpectJ.   

0

精彩评论

暂无评论...
验证码 换一张
取 消