mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-15 17:05:05 +01:00
more clie
This commit is contained in:
parent
85f89b6f84
commit
4ec67dee07
2 changed files with 24 additions and 0 deletions
|
|
@ -311,6 +311,10 @@ impl ChannelsState {
|
||||||
|
|
||||||
let channel_request = match request_type {
|
let channel_request = match request_type {
|
||||||
"pty-req" => {
|
"pty-req" => {
|
||||||
|
if !self.is_server {
|
||||||
|
return Err(peer_error!("server tried to open pty"));
|
||||||
|
}
|
||||||
|
|
||||||
let term = packet.utf8_string()?;
|
let term = packet.utf8_string()?;
|
||||||
let width_chars = packet.u32()?;
|
let width_chars = packet.u32()?;
|
||||||
let height_rows = packet.u32()?;
|
let height_rows = packet.u32()?;
|
||||||
|
|
@ -337,10 +341,18 @@ impl ChannelsState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"shell" => {
|
"shell" => {
|
||||||
|
if !self.is_server {
|
||||||
|
return Err(peer_error!("server tried to open shell"));
|
||||||
|
}
|
||||||
|
|
||||||
info!(channel = %our_channel, "Opening shell");
|
info!(channel = %our_channel, "Opening shell");
|
||||||
ChannelRequest::Shell { want_reply }
|
ChannelRequest::Shell { want_reply }
|
||||||
}
|
}
|
||||||
"exec" => {
|
"exec" => {
|
||||||
|
if !self.is_server {
|
||||||
|
return Err(peer_error!("server tried to execute command"));
|
||||||
|
}
|
||||||
|
|
||||||
let command = packet.string()?;
|
let command = packet.string()?;
|
||||||
info!(channel = %our_channel, command = %String::from_utf8_lossy(command), "Executing command");
|
info!(channel = %our_channel, command = %String::from_utf8_lossy(command), "Executing command");
|
||||||
ChannelRequest::Exec {
|
ChannelRequest::Exec {
|
||||||
|
|
@ -349,6 +361,10 @@ impl ChannelsState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"env" => {
|
"env" => {
|
||||||
|
if !self.is_server {
|
||||||
|
return Err(peer_error!("server tried to set environment var"));
|
||||||
|
}
|
||||||
|
|
||||||
let name = packet.utf8_string()?;
|
let name = packet.utf8_string()?;
|
||||||
let value = packet.string()?;
|
let value = packet.string()?;
|
||||||
|
|
||||||
|
|
@ -361,6 +377,10 @@ impl ChannelsState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"signal" => {
|
"signal" => {
|
||||||
|
if !self.is_server {
|
||||||
|
return Err(peer_error!("server tried to send signal"));
|
||||||
|
}
|
||||||
|
|
||||||
debug!(channel = %our_channel, "Received signal");
|
debug!(channel = %our_channel, "Received signal");
|
||||||
// Ignore signals, something we can do.
|
// Ignore signals, something we can do.
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,10 @@ impl ClientConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_open(&self) -> bool {
|
||||||
|
matches!(self.state, ClientConnectionState::Open(_))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn next_msg_to_send(&mut self) -> Option<ssh_transport::Msg> {
|
pub fn next_msg_to_send(&mut self) -> Option<ssh_transport::Msg> {
|
||||||
self.transport.next_msg_to_send()
|
self.transport.next_msg_to_send()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue