Skip to content

Commit

Permalink
fix: using --cmd-binary instead of --target
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Jan 15, 2024
1 parent 4250fa7 commit 4c6f602
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/plugins/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ fn register() {
#[derive(Clone)]
pub(crate) struct Command {
opts: options::Options,
binary: String,
}

impl Command {
pub fn new() -> Self {
Command {
opts: options::Options::default(),
binary: String::default(),
}
}

Expand All @@ -45,9 +43,9 @@ impl Command {
)
.unwrap();

log::debug!("{} {}", &self.binary, args.join(" "));
log::debug!("{} {}", &self.opts.cmd_binary, args.join(" "));

let child = std::process::Command::new(&self.binary)
let child = std::process::Command::new(&self.opts.cmd_binary)
.args(&args)
.stdin(Stdio::null())
.stdout(Stdio::piped())
Expand All @@ -66,7 +64,6 @@ impl Plugin for Command {
}

fn setup(&mut self, opts: &Options) -> Result<(), Error> {
self.binary = opts.target.clone().unwrap();
self.opts = opts.cmd.clone();
Ok(())
}
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/cmd/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ use serde::{Deserialize, Serialize};
#[derive(Parser, Debug, Serialize, Deserialize, Clone, Default)]
#[group(skip)]
pub(crate) struct Options {
#[clap(long)]
/// Command arguments.
pub cmd_binary: String,

#[clap(long, default_value = "")]
/// Command arguments. {USERNAME}, {PASSWORD}, {TARGET} and {PORT} can be used as placeholders.
pub cmd_args: String,
Expand Down

0 comments on commit 4c6f602

Please sign in to comment.