In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

Overview

In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

Quick example (简单例子):

fn main() {
    let ssh: SSH = SSH::new();
    // enable logging
    ssh.enable_log(true).unwrap();
    let mut session = ssh.get_session("127.0.0.1:22").unwrap();
    session.set_user_and_password("root".to_string(), "123456".to_string());
    session.connect().unwrap();
    exec(&mut session);
    shell(&mut session);
    // t_shell(&mut session);
}

fn exec(session: &mut Session) {
    let exec: ChannelExec = session.open_exec().unwrap();
    let vec = exec.send_command("ls -all").unwrap();
    println!("{}", String::from_utf8(vec).unwrap());
}

fn shell(session: &mut Session) {
    let mut shell = session.open_shell().unwrap();
    thread::sleep(time::Duration::from_millis(200));
    let vec = shell.read().unwrap();
    let result = String::from_utf8(vec).unwrap();
    println!("{}", result);
    shell.write(b"ls -a\r").unwrap();
    thread::sleep(time::Duration::from_millis(200));
    let vec = shell.read().unwrap();
    let result = String::from_utf8(vec).unwrap();
    println!("{}", result);
    shell.close().unwrap();
}

fn t_shell(session: &mut Session) {
    let shell = session.open_shell().unwrap();
    let c1 = Arc::new(Mutex::new(shell));
    let c2 = Arc::clone(&c1);
    let t1 = thread::spawn( move || {
        loop {
            let x = c1.lock().unwrap().read().unwrap();
            if x.is_empty() { continue }
            stdout().write(x.as_slice()).unwrap();
            stdout().flush().unwrap();
        }
    });

    let t2 = thread::spawn( move || {
        loop {
            let mut cm = String::new();
            stdin().read_line(&mut cm).unwrap();
            c2.lock().unwrap().write(cm.as_bytes()).unwrap();
        }
    });

    t1.join().unwrap();
    t2.join().unwrap();
}

Supported algorithms (支持的算法):

algorithms is supported
curve25519-sha256
ecdh-sha2-nistp256
ssh-ed25519
rsa
[email protected]

Supported authentication modes (支持的身份验证方式):

user auth is supported
publickey ×
password
hostbased ×

Supported channels (支持的连接通道)

channel is supported
shell
exec
subsystem ×

Not currently supported scp, sftp (目前不支持 scp sftp)

Comments
  • Looping ssh connection Timeout

    Looping ssh connection Timeout

    Hey, i was wondoring if it could possible to do that, because i'm encounring difficuties. The first connection connects successfully but all subsequent connections return an error on session.connect()

    if i do session.connect().unwrap() : thread 'main' panicked at 'called "Result::unwrap()" on an "Err" value: Error: { Kind(Timeout), Message(time out.) }

    { Kind(Timeout) }

    loop {
      let mut session: Session = ssh::create_session();
      session.set_timeout(3);
      session.set_user_and_password("user", "password");
      match session.connect("127.0.0.1:22") {
             Ok(_res) => {
                  //Do something
             },
             Err(_err) => {
                  //handle error
            }
      }
    session.close().unwrap();
    }
    

    Thank you

    bug 
    opened by Paulo-21 9
  • [Bug] Can't use example to connect to sshd server: key exchange error.

    [Bug] Can't use example to connect to sshd server: key exchange error.

    Hi, I used example to connect to sshd server. but it show "key exchange error."

    code (home/workspace/ssh-rs/examples/exec): `use ssh_rs::ssh;

    fn main() { let mut session = ssh::create_session(); session.set_user_and_password("root", "P@ssw0rd"); session.connect("192.168.101.136:22").unwrap(); // Usage 1 let exec = session.open_exec().unwrap(); let vec: Vec = exec.send_command("ls -all").unwrap(); println!("{}", String::from_utf8(vec).unwrap()); // Usage 2 let channel = session.open_channel().unwrap(); let exec = channel.open_exec().unwrap(); let vec: Vec = exec.send_command("ls -all").unwrap(); println!("{}", String::from_utf8(vec).unwrap()); // Close session. session.close().unwrap(); }`

    [root@codeworkspace exec]# [root@codeworkspace src]# cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.09s Running /home/workspace/ssh-rs/examples/exec/target/debug/exec thread 'main' panicked at 'called Result::unwrap() on an Err value: Error: { Kind(SshError("key exchange error.")), Message(key exchange error.) }', src/main.rs:6:43 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

    sshd server info: [root@localhost ~]# cat /etc/*release CentOS release 6.5 (Final) LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-n CentOS release 6.5 (Final) CentOS release 6.5 (Final) [root@localhost ~]# rpm -qa | grep ssh libssh2-1.4.2-1.el6.x86_64 openssh-askpass-5.3p1-94.el6.x86_64 openssh-clients-5.3p1-94.el6.x86_64 openssh-5.3p1-94.el6.x86_64 openssh-server-5.3p1-94.el6.x86_64

    i capture pcap package in sshd server,it will attach in this web。 filter rule: ip.addr == 192.168.101.136

    opened by qy513314 6
  • Can you make an example of tokio?

    Can you make an example of tokio?

    My code:

    async fn ws_handler(
        ws: WebSocketUpgrade,
        user_agent: Option<TypedHeader<headers::UserAgent>>,
    ) -> impl IntoResponse {
        if let Some(TypedHeader(user_agent)) = user_agent {
            println!("`{}` connected", user_agent.as_str());
        }
    
        ws.on_upgrade(handle_socket)
    }
    
    async fn handle_socket(mut socket: WebSocket) {
        let session = ssh::create_session()
        .username("root")
        .password("123456")
        .connect("192.168.1.9:22").unwrap();
    
        let a_exec = Arc::new(RefCell::new(Mutex::new(session.run_local())));
        
        loop {
            let m_exec = a_exec.clone();
            if let Some(msg) = socket.recv().await {
                if let Ok(msg) = msg {
                    match msg {
                        Message::Text(t) => {
                            println!("client sent str: {:?}", t);
                            let b_exec_m = m_exec.borrow_mut();
                            let b_exec = b_exec_m.lock().await.open_exec();
                            let vec = b_exec.unwrap().send_command(&t).unwrap();
                            
        
                            // let vec = exec.send_command(&t).unwrap();
                            if socket
                                .send(Message::Text(String::from_utf8(vec).unwrap()))
                                .await
                                .is_err()
                            {
                                println!("client disconnected");
                            };
                        }
                        Message::Binary(_) => {
                            println!("client sent binary data");
                        }
                        Message::Ping(_) => {
                            println!("socket ping");
                        }
                        Message::Pong(_) => {
                            println!("socket pong");
                        }
                        Message::Close(_) => {
                            println!("client disconnected");
                            return;
                        }
                    }
                } else {
                    println!("client disconnected");
                    return;
                }
            } else {
                println!("client disconnected");
                return;
            }
        }
    
    // loop {
    //     if socket
    //         .send(Message::Text(String::from("Hi!")))
    //         .await
    //         .is_err()
    //     {
    //         println!("client disconnected");
    //         return;
    //     }
    //     tokio::time::sleep(std::time::Duration::from_secs(3)).await;
    // }
    

    }

    Error:

    error: future cannot be sent between threads safely
       --> src\main.rs:93:8
        |
    93  |     ws.on_upgrade(handle_socket)
        |        ^^^^^^^^^^ future returned by `handle_socket` is not `Send`
        |
        = help: the trait `Sync` is not implemented for `RefCell<tauri::async_runtime::Mutex<LocalSession<TcpStream>>>`
    note: future is not `Send` as this value is used across an await
       --> src\main.rs:106:41
        |
    102 |     let a_exec = Arc::new(RefCell::new(Mutex::new(session.run_local())));
        |         ------ has type `Arc<RefCell<tauri::async_runtime::Mutex<LocalSession<TcpStream>>>>` which is not `Send`
    ...
    106 |         if let Some(msg) = socket.recv().await {
        |                                         ^^^^^^ await occurs here, with `a_exec` maybe used later
    ...
    161 | }
        | - `a_exec` is later dropped here
    note: required by a bound in `WebSocketUpgrade::on_upgrade`
       --> C:\Users\fullee\.cargo\registry\src\github.com-1ecc6299db9ec823\axum-0.5.17\src\extract\ws.rs:236:36
        |
    236 |         Fut: Future<Output = ()> + Send + 'static,
        |                                    ^^^^ required by this bound in `WebSocketUpgrade::on_upgrade`
    
    error: future cannot be sent between threads safely
       --> src\main.rs:93:8
        |
    93  |     ws.on_upgrade(handle_socket)
        |        ^^^^^^^^^^ future returned by `handle_socket` is not `Send`
        |
        = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NonNull<tauri::async_runtime::Mutex<LocalSession<TcpStream>>>`
    note: future is not `Send` as this value is used across an await
       --> src\main.rs:112:53
        |
    111 |                         let b_exec_m = m_exec.borrow_mut();
        |                             -------- has type `RefMut<'_, tauri::async_runtime::Mutex<LocalSession<TcpStream>>>` which is not `Send`
    112 |                         let b_exec = b_exec_m.lock().await.open_exec();
        |                                                     ^^^^^^ await occurs here, with `b_exec_m` maybe used later
    ...
    124 |                     }
        |                     - `b_exec_m` is later dropped here
    note: required by a bound in `WebSocketUpgrade::on_upgrade`
       --> C:\Users\fullee\.cargo\registry\src\github.com-1ecc6299db9ec823\axum-0.5.17\src\extract\ws.rs:236:36
        |
    236 |         Fut: Future<Output = ()> + Send + 'static,
        |                                    ^^^^ required by this bound in `WebSocketUpgrade::on_upgrade`
    
    error: future cannot be sent between threads safely
       --> src\main.rs:93:8
        |
    93  |     ws.on_upgrade(handle_socket)
        |        ^^^^^^^^^^ future returned by `handle_socket` is not `Send`
        |
        = help: the trait `Sync` is not implemented for `std::cell::Cell<isize>`
    note: future is not `Send` as this value is used across an await
       --> src\main.rs:112:53
        |
    111 |                         let b_exec_m = m_exec.borrow_mut();
        |                             -------- has type `RefMut<'_, tauri::async_runtime::Mutex<LocalSession<TcpStream>>>` which is not `Send`
    112 |                         let b_exec = b_exec_m.lock().await.open_exec();
        |                                                     ^^^^^^ await occurs here, with `b_exec_m` maybe used later
    ...
    124 |                     }
        |                     - `b_exec_m` is later dropped here
    note: required by a bound in `WebSocketUpgrade::on_upgrade`
       --> C:\Users\fullee\.cargo\registry\src\github.com-1ecc6299db9ec823\axum-0.5.17\src\extract\ws.rs:236:36
        |
    236 |         Fut: Future<Output = ()> + Send + 'static,
        |                                    ^^^^ required by this bound in `WebSocketUpgrade::on_upgrade`
    
    error: future cannot be sent between threads safely
       --> src\main.rs:93:8
        |
    93  |     ws.on_upgrade(handle_socket)
        |        ^^^^^^^^^^ future returned by `handle_socket` is not `Send`
        |
        = help: within `LocalSession<TcpStream>`, the trait `Send` is not implemented for `Rc<RefCell<ssh_rs::client::client::Client>>`
    note: future is not `Send` as this value is used across an await
       --> src\main.rs:112:53
        |
    112 |                         let b_exec = b_exec_m.lock().await.open_exec();
        |                                      --------       ^^^^^^ await occurs here, with `b_exec_m` maybe used later
        |                                      |
        |                                      has type `&tauri::async_runtime::Mutex<LocalSession<TcpStream>>` which is not `Send`
    note: `b_exec_m` is later dropped here
       --> src\main.rs:112:71
        |
    112 |                         let b_exec = b_exec_m.lock().await.open_exec();
        |                                                                       ^
    help: consider moving this into a `let` binding to create a shorter lived borrow
       --> src\main.rs:112:38
        |
    112 |                         let b_exec = b_exec_m.lock().await.open_exec();
        |                                      ^^^^^^^^^^^^^^^
    note: required by a bound in `WebSocketUpgrade::on_upgrade`
       --> C:\Users\fullee\.cargo\registry\src\github.com-1ecc6299db9ec823\axum-0.5.17\src\extract\ws.rs:236:36
        |
    236 |         Fut: Future<Output = ()> + Send + 'static,
        |                                    ^^^^ required by this bound in `WebSocketUpgrade::on_upgrade`
    
    error: future cannot be sent between threads safely
       --> src\main.rs:93:8
        |
    93  |     ws.on_upgrade(handle_socket)
        |        ^^^^^^^^^^ future returned by `handle_socket` is not `Send`
        |
        = help: within `LocalSession<TcpStream>`, the trait `Send` is not implemented for `Rc<RefCell<TcpStream>>`
    note: future is not `Send` as this value is used across an await
       --> src\main.rs:112:53
        |
    112 |                         let b_exec = b_exec_m.lock().await.open_exec();
        |                                      --------       ^^^^^^ await occurs here, with `b_exec_m` maybe used later
        |                                      |
        |                                      has type `&tauri::async_runtime::Mutex<LocalSession<TcpStream>>` which is not `Send`
    note: `b_exec_m` is later dropped here
       --> src\main.rs:112:71
    112 |                         let b_exec = b_exec_m.lock().await.open_exec();
        |                                                                       ^
    help: consider moving this into a `let` binding to create a shorter lived borrow
       --> src\main.rs:112:38
        |
    112 |                         let b_exec = b_exec_m.lock().await.open_exec();
        |                                      ^^^^^^^^^^^^^^^
    note: required by a bound in `WebSocketUpgrade::on_upgrade`
       --> C:\Users\fullee\.cargo\registry\src\github.com-1ecc6299db9ec823\axum-0.5.17\src\extract\ws.rs:236:36
        |
    236 |         Fut: Future<Output = ()> + Send + 'static,
        |                                    ^^^^ required by this bound in `WebSocketUpgrade::on_upgrade`
    
    warning: `tauri-app` (bin "tauri-app") generated 3 warnings
    error: could not compile `tauri-app` due to 5 previous errors; 3 warnings emitted
    
    opened by fullee 3
  • Fix all warning generated by cargo clippy, and auto format it.

    Fix all warning generated by cargo clippy, and auto format it.

    Hi there,

    Actually, I'd like to build an ssh wasm application and found this crate, which is closest to what I need But the problem is that wasm needs a websocket and in order not to break the existing logic, it needs to be asynchronous. So I'm going to change this

    pub struct Client {
        pub(crate) stream: TcpStream,
        pub(crate) sequence: Sequence,
        pub(crate) timeout: Timeout,
        pub(crate) encryption: Option<Box<dyn Encryption>>,
        pub(crate) is_encryption: bool,
        pub(crate) session_id: Vec<u8>,
    }
    

    To

    use tokio::io::{AsyncRead, AsyncWrite};
    
    pub struct Client<S> 
    where
        S: AsyncRead + AsyncWrite + Unpin,
    {
        pub(crate) stream: S,
        pub(crate) sequence: Sequence,
        pub(crate) timeout: Timeout,
        pub(crate) encryption: Option<Box<dyn Encryption>>,
        pub(crate) is_encryption: bool,
        pub(crate) session_id: Vec<u8>,
    }
    

    Just like my own crate vnc-rs does

    But these changes seemed huge, so I decided to start with cargo clippy & fmt on the existing code while getting the tests for cargo all successful.

    As fmt can be a real turn-off for code reviews, I made a separate commit of fmt and the other containing just the clippy results. Hope this is helpful to you.

    $ cargo clippy --fix
        Checking ssh-rs v0.2.1 (/home/my/projects/ssh-rs)
        Finished dev [unoptimized + debuginfo] target(s) in 1.77s
    $ cargo test
       Compiling ssh-rs v0.2.1 (/home/my/projects/ssh-rs)
        Finished test [unoptimized + debuginfo] target(s) in 0.78s
         Running unittests src/lib.rs (target/debug/deps/ssh_rs-bd2d7b9dabb611b3)
    
    running 0 tests
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
    
       Doc-tests ssh-rs
    
    running 8 tests
    test src/lib.rs - (line 9) - compile ... ok
    test src/lib.rs - (line 49) - compile ... ok
    test src/lib.rs - (line 33) - compile ... ok
    test src/lib.rs - (line 21) - compile ... ok
    test src/lib.rs - (line 137) - compile ... ok
    test src/lib.rs - (line 103) - compile ... ok
    test src/lib.rs - (line 84) - compile ... ok
    test src/lib.rs - (line 65) - compile ... ok
    
    test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
    

    BRs

    opened by HsuJv 3
  • channel_scp_u 文件的错误

    channel_scp_u 文件的错误

    第24行,

    log::info!("start to upload files, \ local [{}] files will be synchronized to the remote [{}] folder.", remote_path_str,local_path_str);

    local_path_str,remote_path_str 位置写反了。

    bug 
    opened by xijaja 3
  • Exec commands that need sudo

    Exec commands that need sudo

    How to execute commands that need sudo, like:

    let vec: Vec<u8> = exec.send_command("sudo systemctl stop some.service").unwrap();
    println!("{}", String::from_utf8(vec).unwrap());
    
    opened by andresv 2
  • Problem with minimum libc version

    Problem with minimum libc version

    Hey, i got this error with your library, could we do something to make my program work on my relatively old computer ?

    It seems that i only have libc 2.23

    i precise that i cant perform upgarde on my machine

    ./client: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by ./client)
    ./client: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./client)
    ./client: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./client)
    ./client: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./client)
    
    

    Thank you

    opened by Paulo-21 2
  • Add timeout support for read operation

    Add timeout support for read operation

    I'v read your sample code, the read operation seems not non-blocking, so the code will stuck there. You could have to add timeout support for it, hence the code can be executed until the end.

    enhancement 
    opened by laeo 2
  • Add a new feature to enable those deprecated algorithms

    Add a new feature to enable those deprecated algorithms

    As mentioned in #32, we may need to give the user opportunities to connect to the old server that only support ssh-rsa sha1 as their host key algorithm.

    Please don't merge this one before #32 done

    TODO: IMO we should expose APIs to let the user choose which algorithms they need, or use the default configuration, rather than we do this in a black box. But it will be an API change @1148118271 What do you think about this change

    opened by HsuJv 1
  • Add bio support to decouple the ssh client from std::net::TcpStream

    Add bio support to decouple the ssh client from std::net::TcpStream

    The main commit is the first one It adds a generic type to the ssh client, decoupling the structure from TcpStream to IO: Read + Write. This allows the user to connect to the ssh server using different methods (e.g. WebSocket or some other proxies). POC at here which works fine.

    In order not to break the compatibility of the existing APIs, a new API connect_bio has been added which asks the user to provide its buffered input/output objects. Whereas the type-specific bindings for TcpStream were always established in the old connect API.

    impl Session<TcpStream> {
        pub fn connect<A>(&mut self, addr: A) -> SshResult<()>
        where
            A: ToSocketAddrs,
        {
            if self.user_info.is_none() {
                return Err(SshError::from("user info is none."));
            }
            // 建立通道
            let tcp = TcpStream::connect(addr)?;
            // default nonblocking
            tcp.set_nonblocking(true).unwrap();
    
            log::info!("session opened.");
            self.connect_bio(tcp)
        }
    }
    
    
    impl<IO> Session<IO>
    where
        IO: Read + Write,
    {
        pub fn connect_bio(&mut self, stream: IO) -> SshResult<()> {
            if self.user_info.is_none() {
                return Err(SshError::from("user info is none."));
            }
            // 建立通道
            self.client = Some(Client::<IO>::connect(
                stream,
                self.timeout_sec,
                self.user_info.clone().unwrap(),
            )?);
            log::info!("session opened.");
            self.post_connect()
        }
    }
    

    All the old examples work fine. Add a new example to show how bio works.

    opened by HsuJv 1
  • Scp download rename

    Scp download rename

    Changes are: first: Create a sample folder for ease of use and testing. second: Create a workflow to do automation compile check on multiple platform example third: Scp now supports a rename, keeping the same as scp command. fourth Yet another clippy.

    The critical fixes are src/channel_scp.rs src/channel_scp_d.rs

    The test cases are: https://github.com/HsuJv/ssh-rs/blob/d79c25f9996731d2d4696215e666434ca60eb55d/examples/scp/src/main.rs#L7-L69

    opened by HsuJv 1
  • Can't use example to connect to server

    Can't use example to connect to server

    Try to use example to my server, get error as blow.

    thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 5',/home/zj/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/ssh-rs-0.1.2/src/key_agreement.rs:105:36

    opened by JulianZhang 5
  • Arch Linux 打包问题

    Arch Linux 打包问题

    准备将 ssh-rs 打包到 AUR 仓库 编写了 PKGBUILD 如下

    # Maintainer: taotieren <[email protected]>
    
    pkgname=ssh-rs
    pkgver=0.1.2
    pkgrel=1
    pkgdesc="In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol"
    arch=('any')
    url="https://github.com/1148118271/ssh-rs"
    license=('Apache-2.0')
    provides=(${pkgname})
    conflicts=(${pkgname} ${pkgname}-git)
    #replaces=(${pkgname})
    depends=('cargo')
    makedepends=('make' 'git' 'cmake' 'gcc' 'rust')
    backup=()
    options=('!strip')
    #install=${pkgname}.install
    source=("${pkgname}-${pkgver}.tar.gz::https://ghproxy.com/${url}/archive/refs/tags/v${pkgver}.tar.gz")
    sha256sums=('8559f1a5dab8c0a2740da562feec85f967fbb39aa2797e3c0590213b898e64e3')
    build() {
    # build crm
        cd "${srcdir}/${pkgname}-${pkgver}/"
        cargo build --frozen --release --all-features
    }
    
    check() {
        cd "${srcdir}/${pkgname}-${pkgver}/"
        cargo test  --frozen --release --all-features
    }
    
    package() {
        cd "${srcdir}/${pkgname}-${pkgver}/"
        export RUSTUP_TOOLCHAIN=stable
        cargo install --no-track --frozen --all-features --root "$pkgdir/usr/" --path .
    }
    
    

    本地编译日志如下:

    ➜  ssh-rs git:(master) makepkg -sf                                    
    ==> 正在创建软件包:ssh-rs 0.1.2-1 (Tue 11 Jan 2022 06:22:49 PM CST)
    ==> 正在检查运行时依赖关系...
    ==> 正在检查编译时依赖关系
    ==> 获取源代码...
      -> 找到 ssh-rs-0.1.2.tar.gz
    ==> 正在验证 source 文件,使用sha256sums...
        ssh-rs-0.1.2.tar.gz ... 通过
    ==> 正在释放源码...
      -> 正在解压缩 ssh-rs-0.1.2.tar.gz,使用 bsdtar
    ==> 正在删除现存的 $pkgdir/ 目录...
    ==> 正在开始 build()...
       Compiling cc v1.0.72
       Compiling libc v0.2.112
       Compiling getrandom v0.1.16
       Compiling pkg-config v0.3.24
       Compiling cfg-if v1.0.0
       Compiling autocfg v1.0.1
       Compiling ppv-lite86 v0.2.15
       Compiling once_cell v1.8.0
       Compiling foreign-types-shared v0.1.1
       Compiling openssl v0.10.38
       Compiling spin v0.5.2
       Compiling bitflags v1.3.2
       Compiling untrusted v0.7.1
       Compiling foreign-types v0.3.2
       Compiling openssl-src v111.17.0+1.1.1m
       Compiling openssl-sys v0.9.72
       Compiling ring v0.16.20
       Compiling rand_core v0.5.1
       Compiling rand_chacha v0.2.2
       Compiling rand v0.7.3
       Compiling ssh-rs v0.1.2 (/home/taotieren/git_clone/aur/ssh-rs/src/ssh-rs-0.1.2)
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/error.rs:110:45
        |
    110 |             SshErrorKind::IoError(io) => io.description(),
        |                                             ^^^^^^^^^^^
        |
        = note: `#[warn(deprecated)]` on by default
    
    warning: variable `crypt` is assigned to, but never used
      --> src/key_agreement.rs:25:17
       |
    25 |         let mut crypt: String = String::new();
       |                 ^^^^^
       |
       = note: `#[warn(unused_variables)]` on by default
       = note: consider using `_crypt` instead
    
    warning: value assigned to `crypt` is never read
      --> src/key_agreement.rs:49:29
       |
    49 | ...                   crypt = String::from(a);
       |                       ^^^^^
       |
       = note: `#[warn(unused_assignments)]` on by default
       = help: maybe it is overwritten before being read?
    
    warning: associated function is never used: `new`
      --> src/packet.rs:21:19
       |
    21 |     pub(crate) fn new() -> Packet {
       |                   ^^^
       |
       = note: `#[warn(dead_code)]` on by default
    
    warning: associated function is never used: `put_data`
      --> src/packet.rs:25:19
       |
    25 |     pub(crate) fn put_data(&mut self, d: Data) {
       |                   ^^^^^^^^
    
    warning: function is never used: `get_error`
       --> src/error.rs:143:4
        |
    143 | fn get_error() -> Result<(), SshError> {
        |    ^^^^^^^^^
    
    warning: `ssh-rs` (lib) generated 6 warnings
        Finished release [optimized] target(s) in 30.71s
    ==> 正在开始 check()...
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/error.rs:110:45
        |
    110 |             SshErrorKind::IoError(io) => io.description(),
        |                                             ^^^^^^^^^^^
        |
        = note: `#[warn(deprecated)]` on by default
    
    warning: variable `crypt` is assigned to, but never used
      --> src/key_agreement.rs:25:17
       |
    25 |         let mut crypt: String = String::new();
       |                 ^^^^^
       |
       = note: `#[warn(unused_variables)]` on by default
       = note: consider using `_crypt` instead
    
    warning: value assigned to `crypt` is never read
      --> src/key_agreement.rs:49:29
       |
    49 | ...                   crypt = String::from(a);
       |                       ^^^^^
       |
       = note: `#[warn(unused_assignments)]` on by default
       = help: maybe it is overwritten before being read?
    
    warning: associated function is never used: `new`
      --> src/packet.rs:21:19
       |
    21 |     pub(crate) fn new() -> Packet {
       |                   ^^^
       |
       = note: `#[warn(dead_code)]` on by default
    
    warning: associated function is never used: `put_data`
      --> src/packet.rs:25:19
       |
    25 |     pub(crate) fn put_data(&mut self, d: Data) {
       |                   ^^^^^^^^
    
    warning: function is never used: `get_error`
       --> src/error.rs:143:4
        |
    143 | fn get_error() -> Result<(), SshError> {
        |    ^^^^^^^^^
    
       Compiling ssh-rs v0.1.2 (/home/taotieren/git_clone/aur/ssh-rs/src/ssh-rs-0.1.2)
    warning: `ssh-rs` (lib) generated 6 warnings
    warning: unused import: `std::sync::atomic::Ordering::Relaxed`
     --> src/tests.rs:7:9
      |
    7 |     use std::sync::atomic::Ordering::Relaxed;
      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: `#[warn(unused_imports)]` on by default
    
    warning: unused import: `global_variable`
     --> src/tests.rs:9:17
      |
    9 |     use crate::{global_variable, message, SSH, strings};
      |                 ^^^^^^^^^^^^^^^
    
    error[E0599]: no method named `write` found for struct `Arc<Mutex<Client>>` in the current scope
      --> src/tests.rs:40:24
       |
    40 |         channel.stream.write(packet.as_slice()).unwrap();
       |                        ^^^^^ method not found in `Arc<Mutex<Client>>`
    
    error[E0599]: no method named `read` found for struct `Arc<Mutex<Client>>` in the current scope
      --> src/tests.rs:43:46
       |
    43 |                 let results = channel.stream.read().unwrap();
       |                                              ^^^^ method not found in `Arc<Mutex<Client>>`
    
    error[E0599]: no method named `write` found for struct `Arc<Mutex<Client>>` in the current scope
      --> src/tests.rs:73:24
       |
    73 |         channel.stream.write(packet.as_slice()).unwrap();
       |                        ^^^^^ method not found in `Arc<Mutex<Client>>`
    
    error[E0599]: no method named `read` found for struct `Arc<Mutex<Client>>` in the current scope
      --> src/tests.rs:76:46
       |
    76 |                 let results = channel.stream.read().unwrap();
       |                                              ^^^^ method not found in `Arc<Mutex<Client>>`
    
    error[E0599]: no method named `write` found for struct `Arc<Mutex<Client>>` in the current scope
       --> src/tests.rs:110:28
        |
    110 |             channel.stream.write(packet.as_slice()).unwrap();
        |                            ^^^^^ method not found in `Arc<Mutex<Client>>`
    
    error[E0599]: no method named `write` found for struct `Arc<Mutex<Client>>` in the current scope
       --> src/tests.rs:118:24
        |
    118 |         channel.stream.write(packet.as_slice()).unwrap();
        |                        ^^^^^ method not found in `Arc<Mutex<Client>>`
    
    warning: unused import: `Write`
     --> src/tests.rs:4:25
      |
    4 |     use std::io::{Read, Write};
      |                         ^^^^^
    
    For more information about this error, try `rustc --explain E0599`.
    warning: `ssh-rs` (lib test) generated 4 warnings (1 duplicate)
    error: could not compile `ssh-rs` due to 6 previous errors; 4 warnings emitted
    ==> 错误: 在 check() 中发生一个错误。
        正在放弃...
    ➜  ssh-rs git:(master)
    
    opened by taotieren 1
Owner
陈年旧事。
陈年旧事。
ssh-box: use ssh keys to encrypt files

ssh-box: use ssh keys to encrypt files work in progress ssh-box file format A file encrypted by ssh-box is an ASCII-armored binary file. The binary co

Tony Finch 3 Jun 27, 2022
Rust encryption library for practical time-lock encryption.

tlock_age: Hybrid Timelock Encryption/Decryption in Rust tlock_age is a library to encrypt and decrypt age filekey using tlock scheme. It provides an

Thibault 5 Mar 29, 2023
Authenticated Encryption with Associated Data Algorithms: high-level encryption ciphers

RustCrypto: Authenticated Encryption with Associated Data (AEAD) Algorithms Collection of Authenticated Encryption with Associated Data (AEAD) algorit

Rust Crypto 457 Jan 4, 2023
A Substrate-based PoA node supporting dynamic addition/removal of authorities.

Substrate PoA A sample Substrate runtime for a PoA blockchain that allows: Dynamically add/remove authorities. Automatically remove authorities when t

Gautam Dhameja 10 Jun 16, 2022
A prototype implementation of the Host Identity Protocol v2 for bare-metal systems, written in pure-rust.

Host Identity Protocol for bare-metal systems, using Rust I've been evaluating TLS replacements in constrained environments for a while now. Embedded

null 31 Dec 12, 2022
A Rust Implementation of China's Standards of Encryption Algorithms(SM2/SM3/SM4)

gm-rs A Pure Rust High-Performance Implementation of China's Standards of Encryption Algorithms(SM2/SM3/SM4) Usage Add this to your Cargo.toml: [depen

null 2 Oct 27, 2022
This is a Order-preserving encryption (OPE) lib inspired by cryptdb's ope implementation.

Ope in rust This is an Order-preserving encryption (OPE) lib inspired by cryptdb's ope implementation. It is a pure rust implementation, no c dependen

Sentclose 8 Jul 19, 2023
Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture.

?? Martinez ?? Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture. Why run Martinez? Look at

Arthur·Thomas 23 Jul 3, 2022
rabe is an Attribute Based Encryption library, written in Rust

Rabe rabe is a rust library implementing several Attribute Based Encryption (ABE) schemes using a modified version of the bn library of zcash (type-3

Fraunhofer AISEC 52 Dec 15, 2022
A Rust library for lattice-based additive homomorphic encryption.

Cupcake Cupcake is an efficient Rust library for the (additive version of) Fan-Vercauteren homomorphic encryption scheme, offering capabilities to enc

Facebook Research 365 Dec 11, 2022
A Rust Library of China's Standards of Encryption Algorithms (SM2/3/4)

Libsm Libsm is an open source pure rust library of China Cryptographic Algorithm Standards. It is completed by a collaborative effort between the Cryp

CITAHub 149 Dec 23, 2022
Rust library for practical time-lock encryption using `drand` threshold network

tlock-rs: Practical Timelock Encryption/Decryption in Rust This repo contains pure Rust implementation of drand/tlock scheme. It provides time-based e

Timofey 32 Jan 8, 2023
WebAssembly wrapper of the rage encryption library

rage-wasm: WebAssembly wrapper of rage rage is a simple, modern, and secure file encryption tool, using the age format. It features small explicit key

Kan-Ru Chen 35 Dec 16, 2022
Meta-repository for Miscreant: misuse-resistant symmetric encryption library with AES-SIV (RFC 5297) and AES-PMAC-SIV support

The best crypto you've never heard of, brought to you by Phil Rogaway A misuse resistant symmetric encryption library designed to support authenticate

miscreant. 480 Dec 8, 2022
Use Touch ID / Secure Enclave for SSH Authentication!

SeKey About SeKey is a SSH Agent that allow users to authenticate to UNIX/Linux SSH servers using the Secure Enclave How it Works? The Secure Enclave

SeKey 2.3k Jan 5, 2023
use your GitHub SSH keys to authenticate to sshd

aeneid If you squint, GitHub is basically a free, zero-ops IdP that provides SSH public keys. Let's use it to authenticate to OpenSSH! What / How? The

Nikhil Jha 21 Dec 6, 2022
Retrieving SSH and GPS keys from GitHub and GitLab

Dormarch Retrieving SSH and GPS keys from GitHub and GitLab Usage After having installed Dormarch, you can see all the options with dormarch -h. To re

Riccardo Padovani 2 Dec 24, 2021
Authorize an ssh session using your keys on GitHub.

GitHub AuthorizedKeysCommand (hubakc) Heavily inspired by https://github.com/sequencer/gitakc . It allows someone login to the server using their ssh

Wenzhuo Liu 5 Nov 11, 2022
Git FIDO Helper - Sign your Git commits with multiple resident SSH keys

gfh Git FIDO helper, or God Fucking Help me. gfh is a tool for helping you sign your commits in Git with resident SSH keys stored on multiple FIDO dev

Michael Mitchell 16 Nov 30, 2022