mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-14 16:35:06 +01:00
stuff
This commit is contained in:
parent
cb504817d3
commit
ad84db6998
2 changed files with 18 additions and 20 deletions
21
src/main.rs
21
src/main.rs
|
|
@ -95,23 +95,14 @@ async fn handle_connection(next: (TcpStream, SocketAddr)) -> Result<()> {
|
||||||
},
|
},
|
||||||
ChannelUpdateKind::Request(req) => {
|
ChannelUpdateKind::Request(req) => {
|
||||||
match req.kind {
|
match req.kind {
|
||||||
ChannelRequestKind::PtyReq { .. } => {
|
ChannelRequestKind::PtyReq { .. } => {}
|
||||||
if req.want_reply {
|
ChannelRequestKind::Shell => {}
|
||||||
state.do_operation(
|
ChannelRequestKind::Exec { .. } => {}
|
||||||
update.number.construct_op(ChannelOperationKind::Success),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChannelRequestKind::Shell => {
|
|
||||||
if req.want_reply {
|
|
||||||
state.do_operation(
|
|
||||||
update.number.construct_op(ChannelOperationKind::Success),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if req.want_reply {
|
if req.want_reply {
|
||||||
// TODO: sent the reply.
|
state.do_operation(
|
||||||
|
update.number.construct_op(ChannelOperationKind::Success),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChannelUpdateKind::Data { data } => {
|
ChannelUpdateKind::Data { data } => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use std::collections::{HashMap, VecDeque};
|
use std::collections::{HashMap, VecDeque};
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, info, warn};
|
||||||
|
|
||||||
use ssh_transport::client_error;
|
use ssh_transport::client_error;
|
||||||
use ssh_transport::packet::Packet;
|
use ssh_transport::packet::Packet;
|
||||||
|
|
@ -58,6 +58,9 @@ pub enum ChannelRequestKind {
|
||||||
term_modes: Vec<u8>,
|
term_modes: Vec<u8>,
|
||||||
},
|
},
|
||||||
Shell,
|
Shell,
|
||||||
|
Exec {
|
||||||
|
command: Vec<u8>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChannelNumber {
|
impl ChannelNumber {
|
||||||
|
|
@ -226,12 +229,16 @@ impl ServerChannelsState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"shell" => {
|
"shell" => {
|
||||||
let _ = self.channel(our_channel)?;
|
info!(?our_channel, "Opening shell");
|
||||||
|
|
||||||
debug!(?our_channel, "Opening shell");
|
|
||||||
|
|
||||||
ChannelRequestKind::Shell
|
ChannelRequestKind::Shell
|
||||||
}
|
}
|
||||||
|
"exec" => {
|
||||||
|
let command = packet.string()?;
|
||||||
|
info!(?our_channel, command = ?String::from_utf8_lossy(command), "Executing command");
|
||||||
|
ChannelRequestKind::Exec {
|
||||||
|
command: command.to_owned(),
|
||||||
|
}
|
||||||
|
}
|
||||||
"signal" => {
|
"signal" => {
|
||||||
debug!(?our_channel, "Received signal");
|
debug!(?our_channel, "Received signal");
|
||||||
// Ignore signals, something we can do.
|
// Ignore signals, something we can do.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue