(order: &arg_parser::Order, output_folder_path: &Path)
| 75 | } |
| 76 | |
| 77 | pub fn process_output(order: &arg_parser::Order, output_folder_path: &Path) -> io::Result<()> { |
| 78 | let output_path = match &order.output { |
| 79 | Some(p) => p, |
| 80 | None => return Ok(()), |
| 81 | }; |
| 82 | |
| 83 | if let Some(parent) = output_path.parent() { |
| 84 | if !parent.exists() { |
| 85 | fs::create_dir_all(parent)?; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | let source_binary = get_source_binary_filename(order, output_folder_path); |
| 90 | |
| 91 | if !source_binary.is_file() { |
| 92 | return Err(io::Error::new( |
| 93 | io::ErrorKind::NotFound, |
| 94 | format!("Source file does not exist: {:?}", source_binary), |
| 95 | )); |
| 96 | } |
| 97 | |
| 98 | fs::copy(&source_binary, output_path)?; |
| 99 | println!("[+] Your binary has been written here: {:?}", output_path); |
| 100 | |
| 101 | Ok(()) |
| 102 | } |
| 103 | |
| 104 | pub fn generate_random_filename(order: &arg_parser::Order) -> String { |
| 105 | let mut rng = rand::rng(); |
no test coverage detected