From 562dbf0e39fa8e0866c50d72014a5c4baf44215a Mon Sep 17 00:00:00 2001 From: TIMER_err Date: Sat, 19 Oct 2024 23:59:59 +0800 Subject: [PATCH] new injector --- yolbi_injector/src/server.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/yolbi_injector/src/server.rs b/yolbi_injector/src/server.rs index 41e22ce..1845f84 100644 --- a/yolbi_injector/src/server.rs +++ b/yolbi_injector/src/server.rs @@ -1,5 +1,5 @@ use indicatif::{ProgressBar, ProgressStyle}; -use std::io::{self, Read}; +use std::io::{self, Read, Write}; use std::net::{Shutdown, TcpListener, TcpStream}; use std::str; @@ -56,13 +56,11 @@ fn handle_client(mut stream: TcpStream) -> io::Result<()> { "P1" => { if let Ok(value) = values[1].parse::() { next = value as u64; - // progress_bar.set_position(value as u64); } } "P2" => { if let Ok(value) = values[1].parse::() { next = value as u64; - // progress_bar.set_position(value as u64); } } "E1" => { @@ -79,11 +77,6 @@ fn handle_client(mut stream: TcpStream) -> io::Result<()> { } "CLOSE" => { println!("INJECT SUCCESSFULLY"); - println!("input any key to exit"); - let mut input = String::new(); - if io::stdin().read_line(&mut input).is_err() { - println!("unexpected error"); - } break; } _ => {} @@ -91,6 +84,12 @@ fn handle_client(mut stream: TcpStream) -> io::Result<()> { } } } + println!("Press any key to exit..."); + io::stdout().flush()?; + let mut input = [0u8; 1]; + if let Ok(_) = io::stdin().read(&mut input) { + println!("Exiting..."); + } stream.shutdown(Shutdown::Both)?; Ok(())