Skip to content

Commit

Permalink
feat!: ✨ Remove support for env variables, put the full path
Browse files Browse the repository at this point in the history
  • Loading branch information
AntwortEinesLebens committed Jun 29, 2024
1 parent 62ad09e commit 63d557b
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/malware/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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,
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit 63d557b

Please sign in to comment.