From 63d557bb8f97574db6972d8a11bc68e883884303 Mon Sep 17 00:00:00 2001 From: AntwortEinesLebens Date: Sat, 29 Jun 2024 12:47:09 +0200 Subject: [PATCH] =?UTF-8?q?feat!:=20=E2=9C=A8=20Remove=20support=20for=20e?= =?UTF-8?q?nv=20variables,=20put=20the=20full=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/malware/file.rs | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/malware/file.rs b/src/malware/file.rs index 4714913..85707dd 100644 --- a/src/malware/file.rs +++ b/src/malware/file.rs @@ -21,10 +21,8 @@ You can use `SET | more` or `Get-ChildItem Env:` to get the list use crate::malware::tools::{process_is_admin, regex_to_string}; use base64::engine::{general_purpose, Engine}; use clap::Parser; -use std::env; -use std::ffi::OsString; use std::io::Result as IOResult; -use std::path::{Path, PathBuf}; +use std::path::Path; use std::time::Duration; use std::{thread, time}; @@ -33,27 +31,11 @@ pub struct FileCreate { #[clap( short = 'f', long, - required = false, + required = true, default_value = "", help = "Full path filename (regex)" )] filename: String, - #[clap( - short = 'v', - long, - required = false, - default_value = "", - help = "Use the CMD variable" - )] - cmd_var: String, - #[clap( - short = 'p', - long, - required = false, - default_value = "", - help = "Use the CMD path" - )] - cmd_path: String, #[clap( short = 'm', long, @@ -111,15 +93,6 @@ impl FileCreate { return 1; } - let fullname: String; - if self.filename.len() > 0 { - fullname = regex_to_string(&self.filename); - } else { - let filename: String = regex_to_string(&self.cmd_path); - let var_path: OsString = env::var_os(&self.cmd_var).unwrap(); - let full_path: PathBuf = Path::new(&var_path).join(filename); - fullname = String::from(full_path.to_string_lossy()); - } println!("Create a file on disk");