mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-05-02 10:19:59 -07:00
raise error for timeout
This commit is contained in:
committed by
Will Greenberg
parent
b72712faa2
commit
7b97ffc01d
@@ -42,7 +42,7 @@ pub async fn telnet_send_command_with_output(
|
||||
writer.write_all(format!("echo RAYHUNTER_'TELNET'_COMMAND_START; {command}; echo RAYHUNTER_'TELNET'_COMMAND_DONE\r\n").as_bytes()).await?;
|
||||
|
||||
let mut read_buf = Vec::new();
|
||||
let _ = timeout(Duration::from_secs(10), async {
|
||||
timeout(Duration::from_secs(10), async {
|
||||
loop {
|
||||
let Ok(byte) = reader.read_u8().await else {
|
||||
break;
|
||||
@@ -60,7 +60,8 @@ pub async fn telnet_send_command_with_output(
|
||||
}
|
||||
}
|
||||
})
|
||||
.await;
|
||||
.await
|
||||
.context("command timed out after 10 seconds")?;
|
||||
let string = String::from_utf8_lossy(&read_buf);
|
||||
let start = string.rfind("RAYHUNTER_TELNET_COMMAND_START");
|
||||
let end = string.rfind("RAYHUNTER_TELNET_COMMAND_DONE");
|
||||
|
||||
Reference in New Issue
Block a user