updated the cargo.toml to optimize the binary

also removed some debugging print statements to
clean up the output when running in a real
environment.
This commit is contained in:
pyro57000
2025-10-17 09:39:34 -05:00
parent f1e482529c
commit e08d19c565
2 changed files with 9 additions and 14 deletions

View File

@@ -8,3 +8,10 @@ clap = { version = "4.5.41", features = ["derive"] }
colored = "3.0.0" colored = "3.0.0"
tokio = { version = "1.48.0", features = ["full"] } tokio = { version = "1.48.0", features = ["full"] }
walkdir = "2.5.0" walkdir = "2.5.0"
[profile.release]
opt-level ="z"
lto = true
strip = true
codegen-units = 1
panic = "abort"

View File

@@ -36,7 +36,7 @@ struct Args{
#[arg(short, long, help = "path to save output file Defaults to not saving output.")] #[arg(short, long, help = "path to save output file Defaults to not saving output.")]
outfile: Option<PathBuf>, outfile: Option<PathBuf>,
#[arg(long, help = "number of threads to use, default to 10. \nNote thre thread count will be doubled, one set for share finder tasks, and one set for file and infor finding tasks.")] #[arg(long, help = "number of threads to use, default to 10.")]
threads: Option<usize>, threads: Option<usize>,
#[arg(short, long, help = "specific targets. should be comma separated.")] #[arg(short, long, help = "specific targets. should be comma separated.")]
@@ -79,26 +79,14 @@ async fn task_handler(id: usize, current_task: FinderTask, tx: Sender<Message>){
TaskType::Share => { TaskType::Share => {
println!("scanning {}", current_task.target); println!("scanning {}", current_task.target);
let share_list_res = Command::new("net").arg("view").arg(current_task.target.clone()).arg("/all").output(); let share_list_res = Command::new("net").arg("view").arg(current_task.target.clone()).arg("/all").output();
let mut error_string = String::new();
let mut success_string = String::new(); let mut success_string = String::new();
if share_list_res.is_ok(){ if share_list_res.is_ok(){
let output = share_list_res.unwrap(); let output = share_list_res.unwrap();
if output.stdout.len() > 0{ if output.stdout.len() > 0{
success_string = String::from_utf8_lossy(&output.stdout).to_string(); success_string = String::from_utf8_lossy(&output.stdout).to_string();
} }
if output.stderr.len() > 0{
error_string = String::from_utf8_lossy(&output.stderr).to_string();
} }
} if success_string.len() > 0{
else{
error_string = share_list_res.err().unwrap().to_string();
}
if error_string.len() > 0{
eprintln!("{}", "Error listing shares!".red());
eprint!("{}", error_string.red());
}
else if success_string.len() > 0{
let mut sent_lines = Vec::new(); let mut sent_lines = Vec::new();
for line in success_string.lines(){ for line in success_string.lines(){
if line.contains("Disk"){ if line.contains("Disk"){