Code Monkey home page Code Monkey logo

quickssh's Introduction

QuickSSH

纯Java实现SSH协议

快速入门

  • 导入QuickSSH
<dependency>
  <groupId>cn.schoolwow</groupId>
  <artifactId>QuickSSH</artifactId>
  <version>{最新版本}</version>
</dependency>

QuickSSH最新版本查询

  • 构建SSHClient
//密码方式登录
SSHClient client = QuickSSH.newInstance()
        .host("127.0.0.1")
        .port(22)
        .username("root")
        .password("123456")
        .build();
//公钥文件方式登录
SSHClient client = QuickSSH.newInstance()
        .host("127.0.0.1")
        .port(22)
        .username("root")
        //目前仅支持rsa类型
        .publickey("/path/to/id_rsa", "passphrase")
        .build();
//执行exec命令
String resut = sshClient.exec("pwd");
//获取sftp命令
SFTPChannel sftpChannel = sshClient.sftp();
sftpChannel.xxxxxx();
//1.0.1版本新增本地端口转发和远程端口转发
LocalForwardChannel localForwardChannel = sshClient.localForwardChannel();
//访问本机9999端口,系统会将发往9999端口的数据转发到服务器的80端口
localForwardChannel.localForward(9999,"0.0.0.0",80);

RemoteForwardChannel remoteForwardChannel = sshClient.remoteForwardChannel();
//访问远程机器的本机10000端口,系统会将数据转发到本机的80端口
remoteForwardChannel.remoteForward(10000,"127.0.0.1",80);
System.out.println("请在远程机器本地(127.0.0.1)访问10000端口,该请求会转发至本机的80端口!");

反馈

若有问题请提交Issue或者发送邮件到[email protected]

开源协议

本软件使用LGPL开源协议!

quickssh's People

Contributors

sunyue1380 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

liucbf mxd888

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.