We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code:
use ssh2::Session; use ssh2::TraceFlags; use std::io::prelude::*; use std::net::TcpStream;
fn main() { let tcp = TcpStream::connect("XXXXXX:22").unwrap();
let mut sess = Session::new().unwrap(); sess.trace(TraceFlags::all()); sess.set_tcp_stream(tcp); sess.handshake().unwrap(); let username = "XXX"; let password = "XXXXX"; sess.userauth_password(username, password).unwrap(); println!("{:?}", sess.authenticated()); let mut channel = sess.channel_session().unwrap(); let command = "display interface brief"; // let command = "hostname"; channel.exec(command).unwrap(); let mut s = String::new(); channel.read_to_string(&mut s).unwrap(); println!("{}", s); channel.wait_close().unwrap(); println!("{}", channel.exit_status().unwrap());
}
trace: libssh2] 1.964524 Transport: Packet type 94 received, length=18 [libssh2] 1.964533 Conn: 9 bytes packet_add() for 0/1/0 [libssh2] 1.964547 Conn: increasing read_avail by 9 bytes to 89/2095097 [libssh2] 1.964562 Conn: channel_read() got 80 of data from 0/1/0 [ul] [libssh2] 1.964573 Conn: channel_read() got 9 of data from 0/1/0 [ul] [libssh2] 1.964592 Conn: channel_read() wants 1952 bytes from channel 0/1 stream #0 [libssh2] 1.964608 Failure Event: -37 - would block [libssh2] 1.997268 Conn: channel_read() wants 1952 bytes from channel 0/1 stream #0 [libssh2] 1.997332 Socket: Error recving 16384 bytes (got 104) [libssh2] 1.997344 Failure Event: -43 - transport read thread 'main' panicked at src/main.rs:30:36: called Result::unwrap() on an Err value: Custom { kind: Other, error: "transport read" } note: run with RUST_BACKTRACE=1 environment variable to display a backtrace [libssh2] 1.997885 Conn: Freeing channel 0/1 resources [libssh2] 1.997899 Conn: Sending EOF on channel 0/1
Result::unwrap()
Err
RUST_BACKTRACE=1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
code:
use ssh2::Session;
use ssh2::TraceFlags;
use std::io::prelude::*;
use std::net::TcpStream;
fn main() {
let tcp = TcpStream::connect("XXXXXX:22").unwrap();
}
trace:
libssh2] 1.964524 Transport: Packet type 94 received, length=18
[libssh2] 1.964533 Conn: 9 bytes packet_add() for 0/1/0
[libssh2] 1.964547 Conn: increasing read_avail by 9 bytes to 89/2095097
[libssh2] 1.964562 Conn: channel_read() got 80 of data from 0/1/0 [ul]
[libssh2] 1.964573 Conn: channel_read() got 9 of data from 0/1/0 [ul]
[libssh2] 1.964592 Conn: channel_read() wants 1952 bytes from channel 0/1 stream #0
[libssh2] 1.964608 Failure Event: -37 - would block
[libssh2] 1.997268 Conn: channel_read() wants 1952 bytes from channel 0/1 stream #0
[libssh2] 1.997332 Socket: Error recving 16384 bytes (got 104)
[libssh2] 1.997344 Failure Event: -43 - transport read
thread 'main' panicked at src/main.rs:30:36:
called
Result::unwrap()
on anErr
value: Custom { kind: Other, error: "transport read" }note: run with
RUST_BACKTRACE=1
environment variable to display a backtrace[libssh2] 1.997885 Conn: Freeing channel 0/1 resources
[libssh2] 1.997899 Conn: Sending EOF on channel 0/1
The text was updated successfully, but these errors were encountered: